2 #define TRACE_SYSTEM bcachefs
4 #if !defined(_TRACE_BCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_BCACHE_H
7 #include <linux/tracepoint.h>
9 DECLARE_EVENT_CLASS(bpos,
10 TP_PROTO(struct bpos p),
19 __entry->inode = p.inode;
20 __entry->offset = p.offset;
23 TP_printk("%llu:%llu", __entry->inode, __entry->offset)
26 DECLARE_EVENT_CLASS(bkey,
27 TP_PROTO(const struct bkey *k),
37 __entry->inode = k->p.inode;
38 __entry->offset = k->p.offset;
39 __entry->size = k->size;
42 TP_printk("%llu:%llu len %u", __entry->inode,
43 __entry->offset, __entry->size)
46 DECLARE_EVENT_CLASS(bch_dev,
47 TP_PROTO(struct bch_dev *ca),
51 __array(char, uuid, 16 )
52 __field(unsigned, tier )
56 memcpy(__entry->uuid, ca->uuid.b, 16);
57 __entry->tier = ca->mi.tier;
60 TP_printk("%pU tier %u", __entry->uuid, __entry->tier)
63 DECLARE_EVENT_CLASS(bch_fs,
64 TP_PROTO(struct bch_fs *c),
68 __array(char, uuid, 16 )
72 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
75 TP_printk("%pU", __entry->uuid)
78 DECLARE_EVENT_CLASS(bio,
79 TP_PROTO(struct bio *bio),
84 __field(sector_t, sector )
85 __field(unsigned int, nr_sector )
86 __array(char, rwbs, 6 )
90 __entry->dev = bio->bi_disk ? bio_dev(bio) : 0;
91 __entry->sector = bio->bi_iter.bi_sector;
92 __entry->nr_sector = bio->bi_iter.bi_size >> 9;
93 blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
96 TP_printk("%d,%d %s %llu + %u",
97 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
98 (unsigned long long)__entry->sector, __entry->nr_sector)
103 DEFINE_EVENT(bio, read_split,
104 TP_PROTO(struct bio *bio),
108 DEFINE_EVENT(bio, read_bounce,
109 TP_PROTO(struct bio *bio),
113 DEFINE_EVENT(bio, read_retry,
114 TP_PROTO(struct bio *bio),
118 DEFINE_EVENT(bio, promote,
119 TP_PROTO(struct bio *bio),
125 DEFINE_EVENT(bch_fs, journal_full,
126 TP_PROTO(struct bch_fs *c),
130 DEFINE_EVENT(bch_fs, journal_entry_full,
131 TP_PROTO(struct bch_fs *c),
135 DEFINE_EVENT(bio, journal_write,
136 TP_PROTO(struct bio *bio),
142 DEFINE_EVENT(bpos, bkey_pack_pos_fail,
143 TP_PROTO(struct bpos p),
149 DECLARE_EVENT_CLASS(btree_node,
150 TP_PROTO(struct bch_fs *c, struct btree *b),
154 __array(char, uuid, 16 )
158 __field(u64, offset )
162 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
163 __entry->level = b->level;
164 __entry->id = b->btree_id;
165 __entry->inode = b->key.k.p.inode;
166 __entry->offset = b->key.k.p.offset;
169 TP_printk("%pU %u id %u %llu:%llu",
170 __entry->uuid, __entry->level, __entry->id,
171 __entry->inode, __entry->offset)
174 DEFINE_EVENT(btree_node, btree_read,
175 TP_PROTO(struct bch_fs *c, struct btree *b),
179 TRACE_EVENT(btree_write,
180 TP_PROTO(struct btree *b, unsigned bytes, unsigned sectors),
181 TP_ARGS(b, bytes, sectors),
184 __field(enum bkey_type, type)
185 __field(unsigned, bytes )
186 __field(unsigned, sectors )
190 __entry->type = btree_node_type(b);
191 __entry->bytes = bytes;
192 __entry->sectors = sectors;
195 TP_printk("bkey type %u bytes %u sectors %u",
196 __entry->type , __entry->bytes, __entry->sectors)
199 DEFINE_EVENT(btree_node, btree_node_alloc,
200 TP_PROTO(struct bch_fs *c, struct btree *b),
204 DEFINE_EVENT(btree_node, btree_node_free,
205 TP_PROTO(struct bch_fs *c, struct btree *b),
209 DEFINE_EVENT(btree_node, btree_node_reap,
210 TP_PROTO(struct bch_fs *c, struct btree *b),
214 DECLARE_EVENT_CLASS(btree_node_cannibalize_lock,
215 TP_PROTO(struct bch_fs *c),
219 __array(char, uuid, 16 )
223 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
226 TP_printk("%pU", __entry->uuid)
229 DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize_lock_fail,
230 TP_PROTO(struct bch_fs *c),
234 DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize_lock,
235 TP_PROTO(struct bch_fs *c),
239 DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize,
240 TP_PROTO(struct bch_fs *c),
244 DEFINE_EVENT(bch_fs, btree_node_cannibalize_unlock,
245 TP_PROTO(struct bch_fs *c),
249 TRACE_EVENT(btree_reserve_get_fail,
250 TP_PROTO(struct bch_fs *c, size_t required, struct closure *cl),
251 TP_ARGS(c, required, cl),
254 __array(char, uuid, 16 )
255 __field(size_t, required )
256 __field(struct closure *, cl )
260 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
261 __entry->required = required;
265 TP_printk("%pU required %zu by %p", __entry->uuid,
266 __entry->required, __entry->cl)
269 TRACE_EVENT(btree_insert_key,
270 TP_PROTO(struct bch_fs *c, struct btree *b, struct bkey_i *k),
276 __field(u64, offset )
281 __entry->id = b->btree_id;
282 __entry->inode = k->k.p.inode;
283 __entry->offset = k->k.p.offset;
284 __entry->size = k->k.size;
287 TP_printk("btree %u: %llu:%llu len %u", __entry->id,
288 __entry->inode, __entry->offset, __entry->size)
291 DEFINE_EVENT(btree_node, btree_split,
292 TP_PROTO(struct bch_fs *c, struct btree *b),
296 DEFINE_EVENT(btree_node, btree_compact,
297 TP_PROTO(struct bch_fs *c, struct btree *b),
301 DEFINE_EVENT(btree_node, btree_set_root,
302 TP_PROTO(struct bch_fs *c, struct btree *b),
306 /* Garbage collection */
308 DEFINE_EVENT(btree_node, btree_gc_coalesce,
309 TP_PROTO(struct bch_fs *c, struct btree *b),
313 TRACE_EVENT(btree_gc_coalesce_fail,
314 TP_PROTO(struct bch_fs *c, int reason),
319 __array(char, uuid, 16 )
323 __entry->reason = reason;
324 memcpy(__entry->uuid, c->disk_sb->user_uuid.b, 16);
327 TP_printk("%pU: %u", __entry->uuid, __entry->reason)
330 DEFINE_EVENT(btree_node, btree_gc_rewrite_node,
331 TP_PROTO(struct bch_fs *c, struct btree *b),
335 DEFINE_EVENT(btree_node, btree_gc_rewrite_node_fail,
336 TP_PROTO(struct bch_fs *c, struct btree *b),
340 DEFINE_EVENT(bch_fs, gc_start,
341 TP_PROTO(struct bch_fs *c),
345 DEFINE_EVENT(bch_fs, gc_end,
346 TP_PROTO(struct bch_fs *c),
350 DEFINE_EVENT(bch_fs, gc_coalesce_start,
351 TP_PROTO(struct bch_fs *c),
355 DEFINE_EVENT(bch_fs, gc_coalesce_end,
356 TP_PROTO(struct bch_fs *c),
360 DEFINE_EVENT(bch_dev, sectors_saturated,
361 TP_PROTO(struct bch_dev *ca),
365 DEFINE_EVENT(bch_fs, gc_sectors_saturated,
366 TP_PROTO(struct bch_fs *c),
370 DEFINE_EVENT(bch_fs, gc_cannot_inc_gens,
371 TP_PROTO(struct bch_fs *c),
377 TRACE_EVENT(alloc_batch,
378 TP_PROTO(struct bch_dev *ca, size_t free, size_t total),
379 TP_ARGS(ca, free, total),
382 __array(char, uuid, 16 )
383 __field(size_t, free )
384 __field(size_t, total )
388 memcpy(__entry->uuid, ca->uuid.b, 16);
389 __entry->free = free;
390 __entry->total = total;
393 TP_printk("%pU free %zu total %zu",
394 __entry->uuid, __entry->free, __entry->total)
397 TRACE_EVENT(invalidate,
398 TP_PROTO(struct bch_dev *ca, u64 offset, unsigned sectors),
399 TP_ARGS(ca, offset, sectors),
402 __field(unsigned, sectors )
404 __field(__u64, offset )
408 __entry->dev = ca->disk_sb.bdev->bd_dev;
409 __entry->offset = offset,
410 __entry->sectors = sectors;
413 TP_printk("invalidated %u sectors at %d,%d sector=%llu",
414 __entry->sectors, MAJOR(__entry->dev),
415 MINOR(__entry->dev), __entry->offset)
418 DEFINE_EVENT(bch_fs, rescale_prios,
419 TP_PROTO(struct bch_fs *c),
423 DECLARE_EVENT_CLASS(bucket_alloc,
424 TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
425 TP_ARGS(ca, reserve),
428 __array(char, uuid, 16)
429 __field(enum alloc_reserve, reserve )
433 memcpy(__entry->uuid, ca->uuid.b, 16);
434 __entry->reserve = reserve;
437 TP_printk("%pU reserve %d", __entry->uuid, __entry->reserve)
440 DEFINE_EVENT(bucket_alloc, bucket_alloc,
441 TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
445 DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
446 TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
450 DEFINE_EVENT(bucket_alloc, open_bucket_alloc_fail,
451 TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
457 DEFINE_EVENT(bkey, move_extent,
458 TP_PROTO(const struct bkey *k),
462 DEFINE_EVENT(bkey, move_alloc_fail,
463 TP_PROTO(const struct bkey *k),
467 DEFINE_EVENT(bkey, move_race,
468 TP_PROTO(const struct bkey *k),
472 TRACE_EVENT(move_data,
473 TP_PROTO(struct bch_fs *c, u64 sectors_moved,
475 TP_ARGS(c, sectors_moved, keys_moved),
478 __array(char, uuid, 16 )
479 __field(u64, sectors_moved )
480 __field(u64, keys_moved )
484 memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
485 __entry->sectors_moved = sectors_moved;
486 __entry->keys_moved = keys_moved;
489 TP_printk("%pU sectors_moved %llu keys_moved %llu",
490 __entry->uuid, __entry->sectors_moved, __entry->keys_moved)
494 TP_PROTO(struct bch_dev *ca,
495 u64 sectors_moved, u64 sectors_not_moved,
496 u64 buckets_moved, u64 buckets_not_moved),
498 sectors_moved, sectors_not_moved,
499 buckets_moved, buckets_not_moved),
502 __array(char, uuid, 16 )
503 __field(u64, sectors_moved )
504 __field(u64, sectors_not_moved )
505 __field(u64, buckets_moved )
506 __field(u64, buckets_not_moved )
510 memcpy(__entry->uuid, ca->uuid.b, 16);
511 __entry->sectors_moved = sectors_moved;
512 __entry->sectors_not_moved = sectors_not_moved;
513 __entry->buckets_moved = buckets_moved;
514 __entry->buckets_not_moved = buckets_moved;
517 TP_printk("%pU sectors moved %llu remain %llu buckets moved %llu remain %llu",
519 __entry->sectors_moved, __entry->sectors_not_moved,
520 __entry->buckets_moved, __entry->buckets_not_moved)
523 #endif /* _TRACE_BCACHE_H */
525 /* This part must be outside protection */
526 #include <trace/define_trace.h>