Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM bcache |
| 3 | |
| 4 | #if !defined(_TRACE_BCACHE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_BCACHE_H |
| 6 | |
| 7 | #include <linux/tracepoint.h> |
| 8 | |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 9 | DECLARE_EVENT_CLASS(bcache_request, |
Kent Overstreet | 220bb38 | 2013-09-10 19:02:45 -0700 | [diff] [blame] | 10 | TP_PROTO(struct bcache_device *d, struct bio *bio), |
| 11 | TP_ARGS(d, bio), |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 12 | |
| 13 | TP_STRUCT__entry( |
| 14 | __field(dev_t, dev ) |
| 15 | __field(unsigned int, orig_major ) |
| 16 | __field(unsigned int, orig_minor ) |
| 17 | __field(sector_t, sector ) |
| 18 | __field(dev_t, orig_sector ) |
| 19 | __field(unsigned int, nr_sector ) |
| 20 | __array(char, rwbs, 6 ) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 21 | ), |
| 22 | |
| 23 | TP_fast_assign( |
| 24 | __entry->dev = bio->bi_bdev->bd_dev; |
Kent Overstreet | 220bb38 | 2013-09-10 19:02:45 -0700 | [diff] [blame] | 25 | __entry->orig_major = d->disk->major; |
| 26 | __entry->orig_minor = d->disk->first_minor; |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 27 | __entry->sector = bio->bi_iter.bi_sector; |
| 28 | __entry->orig_sector = bio->bi_iter.bi_sector - 16; |
| 29 | __entry->nr_sector = bio->bi_iter.bi_size >> 9; |
| 30 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 31 | ), |
| 32 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 33 | TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)", |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 34 | MAJOR(__entry->dev), MINOR(__entry->dev), |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 35 | __entry->rwbs, (unsigned long long)__entry->sector, |
| 36 | __entry->nr_sector, __entry->orig_major, __entry->orig_minor, |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 37 | (unsigned long long)__entry->orig_sector) |
| 38 | ); |
| 39 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 40 | DECLARE_EVENT_CLASS(bkey, |
| 41 | TP_PROTO(struct bkey *k), |
| 42 | TP_ARGS(k), |
| 43 | |
| 44 | TP_STRUCT__entry( |
| 45 | __field(u32, size ) |
| 46 | __field(u32, inode ) |
| 47 | __field(u64, offset ) |
| 48 | __field(bool, dirty ) |
| 49 | ), |
| 50 | |
| 51 | TP_fast_assign( |
| 52 | __entry->inode = KEY_INODE(k); |
| 53 | __entry->offset = KEY_OFFSET(k); |
| 54 | __entry->size = KEY_SIZE(k); |
| 55 | __entry->dirty = KEY_DIRTY(k); |
| 56 | ), |
| 57 | |
| 58 | TP_printk("%u:%llu len %u dirty %u", __entry->inode, |
| 59 | __entry->offset, __entry->size, __entry->dirty) |
| 60 | ); |
| 61 | |
| 62 | DECLARE_EVENT_CLASS(btree_node, |
| 63 | TP_PROTO(struct btree *b), |
| 64 | TP_ARGS(b), |
| 65 | |
| 66 | TP_STRUCT__entry( |
| 67 | __field(size_t, bucket ) |
| 68 | ), |
| 69 | |
| 70 | TP_fast_assign( |
| 71 | __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0); |
| 72 | ), |
| 73 | |
| 74 | TP_printk("bucket %zu", __entry->bucket) |
| 75 | ); |
| 76 | |
| 77 | /* request.c */ |
| 78 | |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 79 | DEFINE_EVENT(bcache_request, bcache_request_start, |
Kent Overstreet | 220bb38 | 2013-09-10 19:02:45 -0700 | [diff] [blame] | 80 | TP_PROTO(struct bcache_device *d, struct bio *bio), |
| 81 | TP_ARGS(d, bio) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 82 | ); |
| 83 | |
| 84 | DEFINE_EVENT(bcache_request, bcache_request_end, |
Kent Overstreet | 220bb38 | 2013-09-10 19:02:45 -0700 | [diff] [blame] | 85 | TP_PROTO(struct bcache_device *d, struct bio *bio), |
| 86 | TP_ARGS(d, bio) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 87 | ); |
| 88 | |
| 89 | DECLARE_EVENT_CLASS(bcache_bio, |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 90 | TP_PROTO(struct bio *bio), |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 91 | TP_ARGS(bio), |
| 92 | |
| 93 | TP_STRUCT__entry( |
| 94 | __field(dev_t, dev ) |
| 95 | __field(sector_t, sector ) |
| 96 | __field(unsigned int, nr_sector ) |
| 97 | __array(char, rwbs, 6 ) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 98 | ), |
| 99 | |
| 100 | TP_fast_assign( |
| 101 | __entry->dev = bio->bi_bdev->bd_dev; |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 102 | __entry->sector = bio->bi_iter.bi_sector; |
| 103 | __entry->nr_sector = bio->bi_iter.bi_size >> 9; |
| 104 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 105 | ), |
| 106 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 107 | TP_printk("%d,%d %s %llu + %u", |
| 108 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, |
| 109 | (unsigned long long)__entry->sector, __entry->nr_sector) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 110 | ); |
| 111 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 112 | DEFINE_EVENT(bcache_bio, bcache_bypass_sequential, |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 113 | TP_PROTO(struct bio *bio), |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 114 | TP_ARGS(bio) |
| 115 | ); |
| 116 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 117 | DEFINE_EVENT(bcache_bio, bcache_bypass_congested, |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 118 | TP_PROTO(struct bio *bio), |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 119 | TP_ARGS(bio) |
| 120 | ); |
| 121 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 122 | TRACE_EVENT(bcache_read, |
| 123 | TP_PROTO(struct bio *bio, bool hit, bool bypass), |
| 124 | TP_ARGS(bio, hit, bypass), |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 125 | |
| 126 | TP_STRUCT__entry( |
| 127 | __field(dev_t, dev ) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 128 | __field(sector_t, sector ) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 129 | __field(unsigned int, nr_sector ) |
| 130 | __array(char, rwbs, 6 ) |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 131 | __field(bool, cache_hit ) |
| 132 | __field(bool, bypass ) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 133 | ), |
| 134 | |
| 135 | TP_fast_assign( |
| 136 | __entry->dev = bio->bi_bdev->bd_dev; |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 137 | __entry->sector = bio->bi_iter.bi_sector; |
| 138 | __entry->nr_sector = bio->bi_iter.bi_size >> 9; |
| 139 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size); |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 140 | __entry->cache_hit = hit; |
| 141 | __entry->bypass = bypass; |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 142 | ), |
| 143 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 144 | TP_printk("%d,%d %s %llu + %u hit %u bypass %u", |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 145 | MAJOR(__entry->dev), MINOR(__entry->dev), |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 146 | __entry->rwbs, (unsigned long long)__entry->sector, |
| 147 | __entry->nr_sector, __entry->cache_hit, __entry->bypass) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 148 | ); |
| 149 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 150 | TRACE_EVENT(bcache_write, |
| 151 | TP_PROTO(struct bio *bio, bool writeback, bool bypass), |
| 152 | TP_ARGS(bio, writeback, bypass), |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 153 | |
| 154 | TP_STRUCT__entry( |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 155 | __field(dev_t, dev ) |
| 156 | __field(sector_t, sector ) |
| 157 | __field(unsigned int, nr_sector ) |
| 158 | __array(char, rwbs, 6 ) |
| 159 | __field(bool, writeback ) |
| 160 | __field(bool, bypass ) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 161 | ), |
| 162 | |
| 163 | TP_fast_assign( |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 164 | __entry->dev = bio->bi_bdev->bd_dev; |
Kent Overstreet | 4f024f3 | 2013-10-11 15:44:27 -0700 | [diff] [blame] | 165 | __entry->sector = bio->bi_iter.bi_sector; |
| 166 | __entry->nr_sector = bio->bi_iter.bi_size >> 9; |
| 167 | blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_iter.bi_size); |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 168 | __entry->writeback = writeback; |
| 169 | __entry->bypass = bypass; |
| 170 | ), |
| 171 | |
| 172 | TP_printk("%d,%d %s %llu + %u hit %u bypass %u", |
| 173 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 174 | __entry->rwbs, (unsigned long long)__entry->sector, |
| 175 | __entry->nr_sector, __entry->writeback, __entry->bypass) |
| 176 | ); |
| 177 | |
| 178 | DEFINE_EVENT(bcache_bio, bcache_read_retry, |
| 179 | TP_PROTO(struct bio *bio), |
| 180 | TP_ARGS(bio) |
| 181 | ); |
| 182 | |
| 183 | DEFINE_EVENT(bkey, bcache_cache_insert, |
| 184 | TP_PROTO(struct bkey *k), |
| 185 | TP_ARGS(k) |
| 186 | ); |
| 187 | |
| 188 | /* Journal */ |
| 189 | |
| 190 | DECLARE_EVENT_CLASS(cache_set, |
| 191 | TP_PROTO(struct cache_set *c), |
| 192 | TP_ARGS(c), |
| 193 | |
| 194 | TP_STRUCT__entry( |
| 195 | __array(char, uuid, 16 ) |
| 196 | ), |
| 197 | |
| 198 | TP_fast_assign( |
| 199 | memcpy(__entry->uuid, c->sb.set_uuid, 16); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 200 | ), |
| 201 | |
| 202 | TP_printk("%pU", __entry->uuid) |
| 203 | ); |
| 204 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 205 | DEFINE_EVENT(bkey, bcache_journal_replay_key, |
| 206 | TP_PROTO(struct bkey *k), |
| 207 | TP_ARGS(k) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 208 | ); |
| 209 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 210 | DEFINE_EVENT(cache_set, bcache_journal_full, |
| 211 | TP_PROTO(struct cache_set *c), |
| 212 | TP_ARGS(c) |
| 213 | ); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 214 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 215 | DEFINE_EVENT(cache_set, bcache_journal_entry_full, |
| 216 | TP_PROTO(struct cache_set *c), |
| 217 | TP_ARGS(c) |
| 218 | ); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 219 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 220 | DEFINE_EVENT(bcache_bio, bcache_journal_write, |
| 221 | TP_PROTO(struct bio *bio), |
| 222 | TP_ARGS(bio) |
| 223 | ); |
| 224 | |
| 225 | /* Btree */ |
| 226 | |
| 227 | DEFINE_EVENT(cache_set, bcache_btree_cache_cannibalize, |
| 228 | TP_PROTO(struct cache_set *c), |
| 229 | TP_ARGS(c) |
| 230 | ); |
| 231 | |
| 232 | DEFINE_EVENT(btree_node, bcache_btree_read, |
| 233 | TP_PROTO(struct btree *b), |
| 234 | TP_ARGS(b) |
| 235 | ); |
| 236 | |
| 237 | TRACE_EVENT(bcache_btree_write, |
| 238 | TP_PROTO(struct btree *b), |
| 239 | TP_ARGS(b), |
| 240 | |
| 241 | TP_STRUCT__entry( |
| 242 | __field(size_t, bucket ) |
| 243 | __field(unsigned, block ) |
| 244 | __field(unsigned, keys ) |
| 245 | ), |
| 246 | |
| 247 | TP_fast_assign( |
| 248 | __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0); |
| 249 | __entry->block = b->written; |
Kent Overstreet | a85e968 | 2013-12-20 17:28:16 -0800 | [diff] [blame] | 250 | __entry->keys = b->keys.set[b->keys.nsets].data->keys; |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 251 | ), |
| 252 | |
| 253 | TP_printk("bucket %zu", __entry->bucket) |
| 254 | ); |
| 255 | |
| 256 | DEFINE_EVENT(btree_node, bcache_btree_node_alloc, |
| 257 | TP_PROTO(struct btree *b), |
| 258 | TP_ARGS(b) |
| 259 | ); |
| 260 | |
| 261 | DEFINE_EVENT(btree_node, bcache_btree_node_alloc_fail, |
| 262 | TP_PROTO(struct btree *b), |
| 263 | TP_ARGS(b) |
| 264 | ); |
| 265 | |
| 266 | DEFINE_EVENT(btree_node, bcache_btree_node_free, |
| 267 | TP_PROTO(struct btree *b), |
| 268 | TP_ARGS(b) |
| 269 | ); |
| 270 | |
| 271 | TRACE_EVENT(bcache_btree_gc_coalesce, |
| 272 | TP_PROTO(unsigned nodes), |
| 273 | TP_ARGS(nodes), |
| 274 | |
| 275 | TP_STRUCT__entry( |
| 276 | __field(unsigned, nodes ) |
| 277 | ), |
| 278 | |
| 279 | TP_fast_assign( |
| 280 | __entry->nodes = nodes; |
| 281 | ), |
| 282 | |
| 283 | TP_printk("coalesced %u nodes", __entry->nodes) |
| 284 | ); |
| 285 | |
| 286 | DEFINE_EVENT(cache_set, bcache_gc_start, |
| 287 | TP_PROTO(struct cache_set *c), |
| 288 | TP_ARGS(c) |
| 289 | ); |
| 290 | |
| 291 | DEFINE_EVENT(cache_set, bcache_gc_end, |
| 292 | TP_PROTO(struct cache_set *c), |
| 293 | TP_ARGS(c) |
| 294 | ); |
| 295 | |
| 296 | DEFINE_EVENT(bkey, bcache_gc_copy, |
| 297 | TP_PROTO(struct bkey *k), |
| 298 | TP_ARGS(k) |
| 299 | ); |
| 300 | |
| 301 | DEFINE_EVENT(bkey, bcache_gc_copy_collision, |
| 302 | TP_PROTO(struct bkey *k), |
| 303 | TP_ARGS(k) |
| 304 | ); |
| 305 | |
Kent Overstreet | 85b1492 | 2013-05-14 20:33:16 -0700 | [diff] [blame] | 306 | TRACE_EVENT(bcache_btree_insert_key, |
| 307 | TP_PROTO(struct btree *b, struct bkey *k, unsigned op, unsigned status), |
| 308 | TP_ARGS(b, k, op, status), |
| 309 | |
| 310 | TP_STRUCT__entry( |
| 311 | __field(u64, btree_node ) |
| 312 | __field(u32, btree_level ) |
| 313 | __field(u32, inode ) |
| 314 | __field(u64, offset ) |
| 315 | __field(u32, size ) |
| 316 | __field(u8, dirty ) |
| 317 | __field(u8, op ) |
| 318 | __field(u8, status ) |
| 319 | ), |
| 320 | |
| 321 | TP_fast_assign( |
| 322 | __entry->btree_node = PTR_BUCKET_NR(b->c, &b->key, 0); |
| 323 | __entry->btree_level = b->level; |
| 324 | __entry->inode = KEY_INODE(k); |
| 325 | __entry->offset = KEY_OFFSET(k); |
| 326 | __entry->size = KEY_SIZE(k); |
| 327 | __entry->dirty = KEY_DIRTY(k); |
| 328 | __entry->op = op; |
| 329 | __entry->status = status; |
| 330 | ), |
| 331 | |
| 332 | TP_printk("%u for %u at %llu(%u): %u:%llu len %u dirty %u", |
| 333 | __entry->status, __entry->op, |
| 334 | __entry->btree_node, __entry->btree_level, |
| 335 | __entry->inode, __entry->offset, |
| 336 | __entry->size, __entry->dirty) |
| 337 | ); |
| 338 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 339 | DECLARE_EVENT_CLASS(btree_split, |
| 340 | TP_PROTO(struct btree *b, unsigned keys), |
| 341 | TP_ARGS(b, keys), |
| 342 | |
| 343 | TP_STRUCT__entry( |
| 344 | __field(size_t, bucket ) |
| 345 | __field(unsigned, keys ) |
| 346 | ), |
| 347 | |
| 348 | TP_fast_assign( |
| 349 | __entry->bucket = PTR_BUCKET_NR(b->c, &b->key, 0); |
| 350 | __entry->keys = keys; |
| 351 | ), |
| 352 | |
| 353 | TP_printk("bucket %zu keys %u", __entry->bucket, __entry->keys) |
| 354 | ); |
| 355 | |
| 356 | DEFINE_EVENT(btree_split, bcache_btree_node_split, |
| 357 | TP_PROTO(struct btree *b, unsigned keys), |
| 358 | TP_ARGS(b, keys) |
| 359 | ); |
| 360 | |
| 361 | DEFINE_EVENT(btree_split, bcache_btree_node_compact, |
| 362 | TP_PROTO(struct btree *b, unsigned keys), |
| 363 | TP_ARGS(b, keys) |
| 364 | ); |
| 365 | |
| 366 | DEFINE_EVENT(btree_node, bcache_btree_set_root, |
| 367 | TP_PROTO(struct btree *b), |
| 368 | TP_ARGS(b) |
| 369 | ); |
| 370 | |
Kent Overstreet | 48a915a | 2013-10-31 15:43:22 -0700 | [diff] [blame] | 371 | TRACE_EVENT(bcache_keyscan, |
| 372 | TP_PROTO(unsigned nr_found, |
| 373 | unsigned start_inode, uint64_t start_offset, |
| 374 | unsigned end_inode, uint64_t end_offset), |
| 375 | TP_ARGS(nr_found, |
| 376 | start_inode, start_offset, |
| 377 | end_inode, end_offset), |
| 378 | |
| 379 | TP_STRUCT__entry( |
| 380 | __field(__u32, nr_found ) |
| 381 | __field(__u32, start_inode ) |
| 382 | __field(__u64, start_offset ) |
| 383 | __field(__u32, end_inode ) |
| 384 | __field(__u64, end_offset ) |
| 385 | ), |
| 386 | |
| 387 | TP_fast_assign( |
| 388 | __entry->nr_found = nr_found; |
| 389 | __entry->start_inode = start_inode; |
| 390 | __entry->start_offset = start_offset; |
| 391 | __entry->end_inode = end_inode; |
| 392 | __entry->end_offset = end_offset; |
| 393 | ), |
| 394 | |
| 395 | TP_printk("found %u keys from %u:%llu to %u:%llu", __entry->nr_found, |
| 396 | __entry->start_inode, __entry->start_offset, |
| 397 | __entry->end_inode, __entry->end_offset) |
| 398 | ); |
| 399 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 400 | /* Allocator */ |
| 401 | |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 402 | TRACE_EVENT(bcache_invalidate, |
| 403 | TP_PROTO(struct cache *ca, size_t bucket), |
| 404 | TP_ARGS(ca, bucket), |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 405 | |
| 406 | TP_STRUCT__entry( |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 407 | __field(unsigned, sectors ) |
| 408 | __field(dev_t, dev ) |
| 409 | __field(__u64, offset ) |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 410 | ), |
| 411 | |
| 412 | TP_fast_assign( |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 413 | __entry->dev = ca->bdev->bd_dev; |
| 414 | __entry->offset = bucket << ca->set->bucket_bits; |
| 415 | __entry->sectors = GC_SECTORS_USED(&ca->buckets[bucket]); |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 416 | ), |
| 417 | |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 418 | TP_printk("invalidated %u sectors at %d,%d sector=%llu", |
| 419 | __entry->sectors, MAJOR(__entry->dev), |
| 420 | MINOR(__entry->dev), __entry->offset) |
| 421 | ); |
| 422 | |
| 423 | TRACE_EVENT(bcache_alloc, |
| 424 | TP_PROTO(struct cache *ca, size_t bucket), |
| 425 | TP_ARGS(ca, bucket), |
| 426 | |
| 427 | TP_STRUCT__entry( |
| 428 | __field(dev_t, dev ) |
| 429 | __field(__u64, offset ) |
| 430 | ), |
| 431 | |
| 432 | TP_fast_assign( |
| 433 | __entry->dev = ca->bdev->bd_dev; |
| 434 | __entry->offset = bucket << ca->set->bucket_bits; |
| 435 | ), |
| 436 | |
| 437 | TP_printk("allocated %d,%d sector=%llu", MAJOR(__entry->dev), |
| 438 | MINOR(__entry->dev), __entry->offset) |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 439 | ); |
| 440 | |
| 441 | TRACE_EVENT(bcache_alloc_fail, |
Kent Overstreet | 7836541 | 2013-12-17 01:29:34 -0800 | [diff] [blame] | 442 | TP_PROTO(struct cache *ca, unsigned reserve), |
| 443 | TP_ARGS(ca, reserve), |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 444 | |
| 445 | TP_STRUCT__entry( |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 446 | __field(dev_t, dev ) |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 447 | __field(unsigned, free ) |
| 448 | __field(unsigned, free_inc ) |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 449 | __field(unsigned, blocked ) |
| 450 | ), |
| 451 | |
| 452 | TP_fast_assign( |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 453 | __entry->dev = ca->bdev->bd_dev; |
Kent Overstreet | 7836541 | 2013-12-17 01:29:34 -0800 | [diff] [blame] | 454 | __entry->free = fifo_used(&ca->free[reserve]); |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 455 | __entry->free_inc = fifo_used(&ca->free_inc); |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 456 | __entry->blocked = atomic_read(&ca->set->prio_blocked); |
| 457 | ), |
| 458 | |
Kent Overstreet | 2531d9ee | 2014-03-17 16:55:55 -0700 | [diff] [blame^] | 459 | TP_printk("alloc fail %d,%d free %u free_inc %u blocked %u", |
Kent Overstreet | 7159b1a | 2014-02-12 18:43:32 -0800 | [diff] [blame] | 460 | MAJOR(__entry->dev), MINOR(__entry->dev), __entry->free, |
Kent Overstreet | 2531d9ee | 2014-03-17 16:55:55 -0700 | [diff] [blame^] | 461 | __entry->free_inc, __entry->blocked) |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 462 | ); |
| 463 | |
| 464 | /* Background writeback */ |
| 465 | |
| 466 | DEFINE_EVENT(bkey, bcache_writeback, |
| 467 | TP_PROTO(struct bkey *k), |
| 468 | TP_ARGS(k) |
| 469 | ); |
| 470 | |
| 471 | DEFINE_EVENT(bkey, bcache_writeback_collision, |
| 472 | TP_PROTO(struct bkey *k), |
| 473 | TP_ARGS(k) |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 474 | ); |
| 475 | |
| 476 | #endif /* _TRACE_BCACHE_H */ |
| 477 | |
| 478 | /* This part must be outside protection */ |
| 479 | #include <trace/define_trace.h> |