xref: /linux/fs/bcachefs/trace.h (revision 89baec780f8b218f5a8bce777b13b6116e416ff6)
11c6fdbd8SKent Overstreet /* SPDX-License-Identifier: GPL-2.0 */
21c6fdbd8SKent Overstreet #undef TRACE_SYSTEM
31c6fdbd8SKent Overstreet #define TRACE_SYSTEM bcachefs
41c6fdbd8SKent Overstreet 
51c6fdbd8SKent Overstreet #if !defined(_TRACE_BCACHEFS_H) || defined(TRACE_HEADER_MULTI_READ)
61c6fdbd8SKent Overstreet #define _TRACE_BCACHEFS_H
71c6fdbd8SKent Overstreet 
81c6fdbd8SKent Overstreet #include <linux/tracepoint.h>
91c6fdbd8SKent Overstreet 
101c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bpos,
111c6fdbd8SKent Overstreet 	TP_PROTO(struct bpos *p),
121c6fdbd8SKent Overstreet 	TP_ARGS(p),
131c6fdbd8SKent Overstreet 
141c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
151c6fdbd8SKent Overstreet 		__field(u64,	inode				)
161c6fdbd8SKent Overstreet 		__field(u64,	offset				)
171c6fdbd8SKent Overstreet 	),
181c6fdbd8SKent Overstreet 
191c6fdbd8SKent Overstreet 	TP_fast_assign(
201c6fdbd8SKent Overstreet 		__entry->inode	= p->inode;
211c6fdbd8SKent Overstreet 		__entry->offset	= p->offset;
221c6fdbd8SKent Overstreet 	),
231c6fdbd8SKent Overstreet 
241c6fdbd8SKent Overstreet 	TP_printk("%llu:%llu", __entry->inode, __entry->offset)
251c6fdbd8SKent Overstreet );
261c6fdbd8SKent Overstreet 
271c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bkey,
281c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
291c6fdbd8SKent Overstreet 	TP_ARGS(k),
301c6fdbd8SKent Overstreet 
311c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
321c6fdbd8SKent Overstreet 		__field(u64,	inode				)
331c6fdbd8SKent Overstreet 		__field(u64,	offset				)
341c6fdbd8SKent Overstreet 		__field(u32,	size				)
351c6fdbd8SKent Overstreet 	),
361c6fdbd8SKent Overstreet 
371c6fdbd8SKent Overstreet 	TP_fast_assign(
381c6fdbd8SKent Overstreet 		__entry->inode	= k->p.inode;
391c6fdbd8SKent Overstreet 		__entry->offset	= k->p.offset;
401c6fdbd8SKent Overstreet 		__entry->size	= k->size;
411c6fdbd8SKent Overstreet 	),
421c6fdbd8SKent Overstreet 
431c6fdbd8SKent Overstreet 	TP_printk("%llu:%llu len %u", __entry->inode,
441c6fdbd8SKent Overstreet 		  __entry->offset, __entry->size)
451c6fdbd8SKent Overstreet );
461c6fdbd8SKent Overstreet 
471c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bch_fs,
481c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
491c6fdbd8SKent Overstreet 	TP_ARGS(c),
501c6fdbd8SKent Overstreet 
511c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
521c6fdbd8SKent Overstreet 		__array(char,		uuid,	16 )
531c6fdbd8SKent Overstreet 	),
541c6fdbd8SKent Overstreet 
551c6fdbd8SKent Overstreet 	TP_fast_assign(
561c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
571c6fdbd8SKent Overstreet 	),
581c6fdbd8SKent Overstreet 
591c6fdbd8SKent Overstreet 	TP_printk("%pU", __entry->uuid)
601c6fdbd8SKent Overstreet );
611c6fdbd8SKent Overstreet 
621c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bio,
631c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
641c6fdbd8SKent Overstreet 	TP_ARGS(bio),
651c6fdbd8SKent Overstreet 
661c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
671c6fdbd8SKent Overstreet 		__field(dev_t,		dev			)
681c6fdbd8SKent Overstreet 		__field(sector_t,	sector			)
691c6fdbd8SKent Overstreet 		__field(unsigned int,	nr_sector		)
701c6fdbd8SKent Overstreet 		__array(char,		rwbs,	6		)
711c6fdbd8SKent Overstreet 	),
721c6fdbd8SKent Overstreet 
731c6fdbd8SKent Overstreet 	TP_fast_assign(
741c6fdbd8SKent Overstreet 		__entry->dev		= bio->bi_bdev ? bio_dev(bio) : 0;
751c6fdbd8SKent Overstreet 		__entry->sector		= bio->bi_iter.bi_sector;
761c6fdbd8SKent Overstreet 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
771c6fdbd8SKent Overstreet 		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
781c6fdbd8SKent Overstreet 	),
791c6fdbd8SKent Overstreet 
801c6fdbd8SKent Overstreet 	TP_printk("%d,%d  %s %llu + %u",
811c6fdbd8SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
821c6fdbd8SKent Overstreet 		  (unsigned long long)__entry->sector, __entry->nr_sector)
831c6fdbd8SKent Overstreet );
841c6fdbd8SKent Overstreet 
851c6fdbd8SKent Overstreet /* io.c: */
861c6fdbd8SKent Overstreet 
871c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_split,
881c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
891c6fdbd8SKent Overstreet 	TP_ARGS(bio)
901c6fdbd8SKent Overstreet );
911c6fdbd8SKent Overstreet 
921c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_bounce,
931c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
941c6fdbd8SKent Overstreet 	TP_ARGS(bio)
951c6fdbd8SKent Overstreet );
961c6fdbd8SKent Overstreet 
971c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_retry,
981c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
991c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1001c6fdbd8SKent Overstreet );
1011c6fdbd8SKent Overstreet 
1021c6fdbd8SKent Overstreet DEFINE_EVENT(bio, promote,
1031c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1041c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1051c6fdbd8SKent Overstreet );
1061c6fdbd8SKent Overstreet 
1071c6fdbd8SKent Overstreet /* Journal */
1081c6fdbd8SKent Overstreet 
1091c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, journal_full,
1101c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
1111c6fdbd8SKent Overstreet 	TP_ARGS(c)
1121c6fdbd8SKent Overstreet );
1131c6fdbd8SKent Overstreet 
1141c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, journal_entry_full,
1151c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
1161c6fdbd8SKent Overstreet 	TP_ARGS(c)
1171c6fdbd8SKent Overstreet );
1181c6fdbd8SKent Overstreet 
1191c6fdbd8SKent Overstreet DEFINE_EVENT(bio, journal_write,
1201c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1211c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1221c6fdbd8SKent Overstreet );
1231c6fdbd8SKent Overstreet 
1248a92e545SKent Overstreet TRACE_EVENT(journal_reclaim_start,
1258a92e545SKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 min_nr,
1268a92e545SKent Overstreet 		 u64 prereserved, u64 prereserved_total,
1278a92e545SKent Overstreet 		 u64 btree_cache_dirty, u64 btree_cache_total,
1288a92e545SKent Overstreet 		 u64 btree_key_cache_dirty, u64 btree_key_cache_total),
1298a92e545SKent Overstreet 	TP_ARGS(c, min_nr, prereserved, prereserved_total,
1308a92e545SKent Overstreet 		btree_cache_dirty, btree_cache_total,
1318a92e545SKent Overstreet 		btree_key_cache_dirty, btree_key_cache_total),
1328a92e545SKent Overstreet 
1338a92e545SKent Overstreet 	TP_STRUCT__entry(
1348a92e545SKent Overstreet 		__array(char,		uuid,	16		)
1358a92e545SKent Overstreet 		__field(u64,		min_nr			)
1368a92e545SKent Overstreet 		__field(u64,		prereserved		)
1378a92e545SKent Overstreet 		__field(u64,		prereserved_total	)
1388a92e545SKent Overstreet 		__field(u64,		btree_cache_dirty	)
1398a92e545SKent Overstreet 		__field(u64,		btree_cache_total	)
1408a92e545SKent Overstreet 		__field(u64,		btree_key_cache_dirty	)
1418a92e545SKent Overstreet 		__field(u64,		btree_key_cache_total	)
1428a92e545SKent Overstreet 	),
1438a92e545SKent Overstreet 
1448a92e545SKent Overstreet 	TP_fast_assign(
1458a92e545SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
1468a92e545SKent Overstreet 		__entry->min_nr			= min_nr;
1478a92e545SKent Overstreet 		__entry->prereserved		= prereserved;
1488a92e545SKent Overstreet 		__entry->prereserved_total	= prereserved_total;
1498a92e545SKent Overstreet 		__entry->btree_cache_dirty	= btree_cache_dirty;
1508a92e545SKent Overstreet 		__entry->btree_cache_total	= btree_cache_total;
1518a92e545SKent Overstreet 		__entry->btree_key_cache_dirty	= btree_key_cache_dirty;
1528a92e545SKent Overstreet 		__entry->btree_key_cache_total	= btree_key_cache_total;
1538a92e545SKent Overstreet 	),
1548a92e545SKent Overstreet 
1558a92e545SKent Overstreet 	TP_printk("%pU min %llu prereserved %llu/%llu btree cache %llu/%llu key cache %llu/%llu",
1568a92e545SKent Overstreet 		  __entry->uuid,
1578a92e545SKent Overstreet 		  __entry->min_nr,
1588a92e545SKent Overstreet 		  __entry->prereserved,
1598a92e545SKent Overstreet 		  __entry->prereserved_total,
1608a92e545SKent Overstreet 		  __entry->btree_cache_dirty,
1618a92e545SKent Overstreet 		  __entry->btree_cache_total,
1628a92e545SKent Overstreet 		  __entry->btree_key_cache_dirty,
1638a92e545SKent Overstreet 		  __entry->btree_key_cache_total)
1648a92e545SKent Overstreet );
1658a92e545SKent Overstreet 
1668a92e545SKent Overstreet TRACE_EVENT(journal_reclaim_finish,
1678a92e545SKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 nr_flushed),
1688a92e545SKent Overstreet 	TP_ARGS(c, nr_flushed),
1698a92e545SKent Overstreet 
1708a92e545SKent Overstreet 	TP_STRUCT__entry(
1718a92e545SKent Overstreet 		__array(char,		uuid,	16 )
1728a92e545SKent Overstreet 		__field(u64,		nr_flushed )
1738a92e545SKent Overstreet 	),
1748a92e545SKent Overstreet 
1758a92e545SKent Overstreet 	TP_fast_assign(
1768a92e545SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
1778a92e545SKent Overstreet 		__entry->nr_flushed = nr_flushed;
1788a92e545SKent Overstreet 	),
1798a92e545SKent Overstreet 
1808a92e545SKent Overstreet 	TP_printk("%pU flushed %llu", __entry->uuid, __entry->nr_flushed)
1818a92e545SKent Overstreet );
1828a92e545SKent Overstreet 
1831c6fdbd8SKent Overstreet /* bset.c: */
1841c6fdbd8SKent Overstreet 
1851c6fdbd8SKent Overstreet DEFINE_EVENT(bpos, bkey_pack_pos_fail,
1861c6fdbd8SKent Overstreet 	TP_PROTO(struct bpos *p),
1871c6fdbd8SKent Overstreet 	TP_ARGS(p)
1881c6fdbd8SKent Overstreet );
1891c6fdbd8SKent Overstreet 
1901c6fdbd8SKent Overstreet /* Btree */
1911c6fdbd8SKent Overstreet 
1921c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(btree_node,
1931c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
1941c6fdbd8SKent Overstreet 	TP_ARGS(c, b),
1951c6fdbd8SKent Overstreet 
1961c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
1971c6fdbd8SKent Overstreet 		__array(char,		uuid,		16	)
1981c6fdbd8SKent Overstreet 		__field(u8,		level			)
1991c6fdbd8SKent Overstreet 		__field(u8,		id			)
2001c6fdbd8SKent Overstreet 		__field(u64,		inode			)
2011c6fdbd8SKent Overstreet 		__field(u64,		offset			)
2021c6fdbd8SKent Overstreet 	),
2031c6fdbd8SKent Overstreet 
2041c6fdbd8SKent Overstreet 	TP_fast_assign(
2051c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
206c43a6ef9SKent Overstreet 		__entry->level		= b->c.level;
207c43a6ef9SKent Overstreet 		__entry->id		= b->c.btree_id;
2081c6fdbd8SKent Overstreet 		__entry->inode		= b->key.k.p.inode;
2091c6fdbd8SKent Overstreet 		__entry->offset		= b->key.k.p.offset;
2101c6fdbd8SKent Overstreet 	),
2111c6fdbd8SKent Overstreet 
2121c6fdbd8SKent Overstreet 	TP_printk("%pU  %u id %u %llu:%llu",
2131c6fdbd8SKent Overstreet 		  __entry->uuid, __entry->level, __entry->id,
2141c6fdbd8SKent Overstreet 		  __entry->inode, __entry->offset)
2151c6fdbd8SKent Overstreet );
2161c6fdbd8SKent Overstreet 
2171c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_read,
2181c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2191c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2201c6fdbd8SKent Overstreet );
2211c6fdbd8SKent Overstreet 
2221c6fdbd8SKent Overstreet TRACE_EVENT(btree_write,
2231c6fdbd8SKent Overstreet 	TP_PROTO(struct btree *b, unsigned bytes, unsigned sectors),
2241c6fdbd8SKent Overstreet 	TP_ARGS(b, bytes, sectors),
2251c6fdbd8SKent Overstreet 
2261c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
22726609b61SKent Overstreet 		__field(enum btree_node_type,	type)
2281c6fdbd8SKent Overstreet 		__field(unsigned,	bytes			)
2291c6fdbd8SKent Overstreet 		__field(unsigned,	sectors			)
2301c6fdbd8SKent Overstreet 	),
2311c6fdbd8SKent Overstreet 
2321c6fdbd8SKent Overstreet 	TP_fast_assign(
2331c6fdbd8SKent Overstreet 		__entry->type	= btree_node_type(b);
2341c6fdbd8SKent Overstreet 		__entry->bytes	= bytes;
2351c6fdbd8SKent Overstreet 		__entry->sectors = sectors;
2361c6fdbd8SKent Overstreet 	),
2371c6fdbd8SKent Overstreet 
2381c6fdbd8SKent Overstreet 	TP_printk("bkey type %u bytes %u sectors %u",
2391c6fdbd8SKent Overstreet 		  __entry->type , __entry->bytes, __entry->sectors)
2401c6fdbd8SKent Overstreet );
2411c6fdbd8SKent Overstreet 
2421c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_alloc,
2431c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2441c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2451c6fdbd8SKent Overstreet );
2461c6fdbd8SKent Overstreet 
2471c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_free,
2481c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2491c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2501c6fdbd8SKent Overstreet );
2511c6fdbd8SKent Overstreet 
2521c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_reap,
2531c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2541c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2551c6fdbd8SKent Overstreet );
2561c6fdbd8SKent Overstreet 
2571c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(btree_node_cannibalize_lock,
2581c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2591c6fdbd8SKent Overstreet 	TP_ARGS(c),
2601c6fdbd8SKent Overstreet 
2611c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
2621c6fdbd8SKent Overstreet 		__array(char,			uuid,	16	)
2631c6fdbd8SKent Overstreet 	),
2641c6fdbd8SKent Overstreet 
2651c6fdbd8SKent Overstreet 	TP_fast_assign(
2661c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
2671c6fdbd8SKent Overstreet 	),
2681c6fdbd8SKent Overstreet 
2691c6fdbd8SKent Overstreet 	TP_printk("%pU", __entry->uuid)
2701c6fdbd8SKent Overstreet );
2711c6fdbd8SKent Overstreet 
2721c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize_lock_fail,
2731c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2741c6fdbd8SKent Overstreet 	TP_ARGS(c)
2751c6fdbd8SKent Overstreet );
2761c6fdbd8SKent Overstreet 
2771c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize_lock,
2781c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2791c6fdbd8SKent Overstreet 	TP_ARGS(c)
2801c6fdbd8SKent Overstreet );
2811c6fdbd8SKent Overstreet 
2821c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node_cannibalize_lock, btree_node_cannibalize,
2831c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2841c6fdbd8SKent Overstreet 	TP_ARGS(c)
2851c6fdbd8SKent Overstreet );
2861c6fdbd8SKent Overstreet 
2871c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, btree_node_cannibalize_unlock,
2881c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2891c6fdbd8SKent Overstreet 	TP_ARGS(c)
2901c6fdbd8SKent Overstreet );
2911c6fdbd8SKent Overstreet 
2921c6fdbd8SKent Overstreet TRACE_EVENT(btree_reserve_get_fail,
2931c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, size_t required, struct closure *cl),
2941c6fdbd8SKent Overstreet 	TP_ARGS(c, required, cl),
2951c6fdbd8SKent Overstreet 
2961c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
2971c6fdbd8SKent Overstreet 		__array(char,			uuid,	16	)
2981c6fdbd8SKent Overstreet 		__field(size_t,			required	)
2991c6fdbd8SKent Overstreet 		__field(struct closure *,	cl		)
3001c6fdbd8SKent Overstreet 	),
3011c6fdbd8SKent Overstreet 
3021c6fdbd8SKent Overstreet 	TP_fast_assign(
3031c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
3041c6fdbd8SKent Overstreet 		__entry->required = required;
3051c6fdbd8SKent Overstreet 		__entry->cl = cl;
3061c6fdbd8SKent Overstreet 	),
3071c6fdbd8SKent Overstreet 
3081c6fdbd8SKent Overstreet 	TP_printk("%pU required %zu by %p", __entry->uuid,
3091c6fdbd8SKent Overstreet 		  __entry->required, __entry->cl)
3101c6fdbd8SKent Overstreet );
3111c6fdbd8SKent Overstreet 
3121c6fdbd8SKent Overstreet TRACE_EVENT(btree_insert_key,
3131c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b, struct bkey_i *k),
3141c6fdbd8SKent Overstreet 	TP_ARGS(c, b, k),
3151c6fdbd8SKent Overstreet 
3161c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
3171c6fdbd8SKent Overstreet 		__field(u8,		id			)
3181c6fdbd8SKent Overstreet 		__field(u64,		inode			)
3191c6fdbd8SKent Overstreet 		__field(u64,		offset			)
3201c6fdbd8SKent Overstreet 		__field(u32,		size			)
3211c6fdbd8SKent Overstreet 	),
3221c6fdbd8SKent Overstreet 
3231c6fdbd8SKent Overstreet 	TP_fast_assign(
324c43a6ef9SKent Overstreet 		__entry->id		= b->c.btree_id;
3251c6fdbd8SKent Overstreet 		__entry->inode		= k->k.p.inode;
3261c6fdbd8SKent Overstreet 		__entry->offset		= k->k.p.offset;
3271c6fdbd8SKent Overstreet 		__entry->size		= k->k.size;
3281c6fdbd8SKent Overstreet 	),
3291c6fdbd8SKent Overstreet 
3301c6fdbd8SKent Overstreet 	TP_printk("btree %u: %llu:%llu len %u", __entry->id,
3311c6fdbd8SKent Overstreet 		  __entry->inode, __entry->offset, __entry->size)
3321c6fdbd8SKent Overstreet );
3331c6fdbd8SKent Overstreet 
3341c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_split,
3351c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3361c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3371c6fdbd8SKent Overstreet );
3381c6fdbd8SKent Overstreet 
3391c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_compact,
3401c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3411c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3421c6fdbd8SKent Overstreet );
3431c6fdbd8SKent Overstreet 
3441c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_merge,
3451c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3461c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3471c6fdbd8SKent Overstreet );
3481c6fdbd8SKent Overstreet 
3491c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_set_root,
3501c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3511c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3521c6fdbd8SKent Overstreet );
3531c6fdbd8SKent Overstreet 
3541c6fdbd8SKent Overstreet /* Garbage collection */
3551c6fdbd8SKent Overstreet 
3561c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_gc_rewrite_node,
3571c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3581c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3591c6fdbd8SKent Overstreet );
3601c6fdbd8SKent Overstreet 
3611c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_gc_rewrite_node_fail,
3621c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3631c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3641c6fdbd8SKent Overstreet );
3651c6fdbd8SKent Overstreet 
3661c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, gc_start,
3671c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
3681c6fdbd8SKent Overstreet 	TP_ARGS(c)
3691c6fdbd8SKent Overstreet );
3701c6fdbd8SKent Overstreet 
3711c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, gc_end,
3721c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
3731c6fdbd8SKent Overstreet 	TP_ARGS(c)
3741c6fdbd8SKent Overstreet );
3751c6fdbd8SKent Overstreet 
3761c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, gc_cannot_inc_gens,
3771c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
3781c6fdbd8SKent Overstreet 	TP_ARGS(c)
3791c6fdbd8SKent Overstreet );
3801c6fdbd8SKent Overstreet 
3811c6fdbd8SKent Overstreet /* Allocator */
3821c6fdbd8SKent Overstreet 
383*89baec78SKent Overstreet TRACE_EVENT(alloc_scan,
384*89baec78SKent Overstreet 	TP_PROTO(struct bch_dev *ca, u64 found, u64 inc_gen, u64 inc_gen_skipped),
385*89baec78SKent Overstreet 	TP_ARGS(ca, found, inc_gen, inc_gen_skipped),
3861c6fdbd8SKent Overstreet 
3871c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
388*89baec78SKent Overstreet 		__field(dev_t,		dev		)
389*89baec78SKent Overstreet 		__field(u64,		found		)
390*89baec78SKent Overstreet 		__field(u64,		inc_gen		)
391*89baec78SKent Overstreet 		__field(u64,		inc_gen_skipped	)
3921c6fdbd8SKent Overstreet 	),
3931c6fdbd8SKent Overstreet 
3941c6fdbd8SKent Overstreet 	TP_fast_assign(
395*89baec78SKent Overstreet 		__entry->dev		= ca->disk_sb.bdev->bd_dev;
396*89baec78SKent Overstreet 		__entry->found		= found;
397*89baec78SKent Overstreet 		__entry->inc_gen	= inc_gen;
398*89baec78SKent Overstreet 		__entry->inc_gen_skipped = inc_gen_skipped;
3991c6fdbd8SKent Overstreet 	),
4001c6fdbd8SKent Overstreet 
401*89baec78SKent Overstreet 	TP_printk("%d,%d found %llu inc_gen %llu inc_gen_skipped %llu",
402*89baec78SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
403*89baec78SKent Overstreet 		  __entry->found, __entry->inc_gen, __entry->inc_gen_skipped)
4041c6fdbd8SKent Overstreet );
4051c6fdbd8SKent Overstreet 
4061c6fdbd8SKent Overstreet TRACE_EVENT(invalidate,
4071c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, u64 offset, unsigned sectors),
4081c6fdbd8SKent Overstreet 	TP_ARGS(ca, offset, sectors),
4091c6fdbd8SKent Overstreet 
4101c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
4111c6fdbd8SKent Overstreet 		__field(unsigned,	sectors			)
4121c6fdbd8SKent Overstreet 		__field(dev_t,		dev			)
4131c6fdbd8SKent Overstreet 		__field(__u64,		offset			)
4141c6fdbd8SKent Overstreet 	),
4151c6fdbd8SKent Overstreet 
4161c6fdbd8SKent Overstreet 	TP_fast_assign(
4171c6fdbd8SKent Overstreet 		__entry->dev		= ca->disk_sb.bdev->bd_dev;
4181c6fdbd8SKent Overstreet 		__entry->offset		= offset,
4191c6fdbd8SKent Overstreet 		__entry->sectors	= sectors;
4201c6fdbd8SKent Overstreet 	),
4211c6fdbd8SKent Overstreet 
4221c6fdbd8SKent Overstreet 	TP_printk("invalidated %u sectors at %d,%d sector=%llu",
423*89baec78SKent Overstreet 		  __entry->sectors,
424*89baec78SKent Overstreet 		  MAJOR(__entry->dev),
425*89baec78SKent Overstreet 		  MINOR(__entry->dev),
426*89baec78SKent Overstreet 		  __entry->offset)
4271c6fdbd8SKent Overstreet );
4281c6fdbd8SKent Overstreet 
4291c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bucket_alloc,
4301c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4311c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve),
4321c6fdbd8SKent Overstreet 
4331c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
434*89baec78SKent Overstreet 		__field(dev_t,			dev	)
4351c6fdbd8SKent Overstreet 		__field(enum alloc_reserve,	reserve	)
4361c6fdbd8SKent Overstreet 	),
4371c6fdbd8SKent Overstreet 
4381c6fdbd8SKent Overstreet 	TP_fast_assign(
439*89baec78SKent Overstreet 		__entry->dev		= ca->disk_sb.bdev->bd_dev;
4401c6fdbd8SKent Overstreet 		__entry->reserve	= reserve;
4411c6fdbd8SKent Overstreet 	),
4421c6fdbd8SKent Overstreet 
443*89baec78SKent Overstreet 	TP_printk("%d,%d reserve %d",
444*89baec78SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
445*89baec78SKent Overstreet 		  __entry->reserve)
4461c6fdbd8SKent Overstreet );
4471c6fdbd8SKent Overstreet 
4481c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc,
4491c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4501c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve)
4511c6fdbd8SKent Overstreet );
4521c6fdbd8SKent Overstreet 
4531c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
4541c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4551c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve)
4561c6fdbd8SKent Overstreet );
4571c6fdbd8SKent Overstreet 
4581c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, open_bucket_alloc_fail,
4591c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4601c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve)
4611c6fdbd8SKent Overstreet );
4621c6fdbd8SKent Overstreet 
4631c6fdbd8SKent Overstreet /* Moving IO */
4641c6fdbd8SKent Overstreet 
4651c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_extent,
4661c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
4671c6fdbd8SKent Overstreet 	TP_ARGS(k)
4681c6fdbd8SKent Overstreet );
4691c6fdbd8SKent Overstreet 
4701c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_alloc_fail,
4711c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
4721c6fdbd8SKent Overstreet 	TP_ARGS(k)
4731c6fdbd8SKent Overstreet );
4741c6fdbd8SKent Overstreet 
4751c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_race,
4761c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
4771c6fdbd8SKent Overstreet 	TP_ARGS(k)
4781c6fdbd8SKent Overstreet );
4791c6fdbd8SKent Overstreet 
4801c6fdbd8SKent Overstreet TRACE_EVENT(move_data,
4811c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 sectors_moved,
4821c6fdbd8SKent Overstreet 		 u64 keys_moved),
4831c6fdbd8SKent Overstreet 	TP_ARGS(c, sectors_moved, keys_moved),
4841c6fdbd8SKent Overstreet 
4851c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
4861c6fdbd8SKent Overstreet 		__array(char,		uuid,	16	)
4871c6fdbd8SKent Overstreet 		__field(u64,		sectors_moved	)
4881c6fdbd8SKent Overstreet 		__field(u64,		keys_moved	)
4891c6fdbd8SKent Overstreet 	),
4901c6fdbd8SKent Overstreet 
4911c6fdbd8SKent Overstreet 	TP_fast_assign(
4921c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
4931c6fdbd8SKent Overstreet 		__entry->sectors_moved = sectors_moved;
4941c6fdbd8SKent Overstreet 		__entry->keys_moved = keys_moved;
4951c6fdbd8SKent Overstreet 	),
4961c6fdbd8SKent Overstreet 
4971c6fdbd8SKent Overstreet 	TP_printk("%pU sectors_moved %llu keys_moved %llu",
4981c6fdbd8SKent Overstreet 		__entry->uuid, __entry->sectors_moved, __entry->keys_moved)
4991c6fdbd8SKent Overstreet );
5001c6fdbd8SKent Overstreet 
5011c6fdbd8SKent Overstreet TRACE_EVENT(copygc,
502e6d11615SKent Overstreet 	TP_PROTO(struct bch_fs *c,
5031c6fdbd8SKent Overstreet 		 u64 sectors_moved, u64 sectors_not_moved,
5041c6fdbd8SKent Overstreet 		 u64 buckets_moved, u64 buckets_not_moved),
505e6d11615SKent Overstreet 	TP_ARGS(c,
5061c6fdbd8SKent Overstreet 		sectors_moved, sectors_not_moved,
5071c6fdbd8SKent Overstreet 		buckets_moved, buckets_not_moved),
5081c6fdbd8SKent Overstreet 
5091c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
5101c6fdbd8SKent Overstreet 		__array(char,		uuid,	16		)
5111c6fdbd8SKent Overstreet 		__field(u64,		sectors_moved		)
5121c6fdbd8SKent Overstreet 		__field(u64,		sectors_not_moved	)
5131c6fdbd8SKent Overstreet 		__field(u64,		buckets_moved		)
5141c6fdbd8SKent Overstreet 		__field(u64,		buckets_not_moved	)
5151c6fdbd8SKent Overstreet 	),
5161c6fdbd8SKent Overstreet 
5171c6fdbd8SKent Overstreet 	TP_fast_assign(
518e6d11615SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
5191c6fdbd8SKent Overstreet 		__entry->sectors_moved		= sectors_moved;
5201c6fdbd8SKent Overstreet 		__entry->sectors_not_moved	= sectors_not_moved;
5211c6fdbd8SKent Overstreet 		__entry->buckets_moved		= buckets_moved;
5221c6fdbd8SKent Overstreet 		__entry->buckets_not_moved = buckets_moved;
5231c6fdbd8SKent Overstreet 	),
5241c6fdbd8SKent Overstreet 
5251c6fdbd8SKent Overstreet 	TP_printk("%pU sectors moved %llu remain %llu buckets moved %llu remain %llu",
5261c6fdbd8SKent Overstreet 		__entry->uuid,
5271c6fdbd8SKent Overstreet 		__entry->sectors_moved, __entry->sectors_not_moved,
5281c6fdbd8SKent Overstreet 		__entry->buckets_moved, __entry->buckets_not_moved)
5291c6fdbd8SKent Overstreet );
5301c6fdbd8SKent Overstreet 
531297604c9SKent Overstreet TRACE_EVENT(transaction_restart_ip,
532297604c9SKent Overstreet 	TP_PROTO(unsigned long caller, unsigned long ip),
533297604c9SKent Overstreet 	TP_ARGS(caller, ip),
534297604c9SKent Overstreet 
535297604c9SKent Overstreet 	TP_STRUCT__entry(
536297604c9SKent Overstreet 		__field(unsigned long,		caller	)
537297604c9SKent Overstreet 		__field(unsigned long,		ip	)
538297604c9SKent Overstreet 	),
539297604c9SKent Overstreet 
540297604c9SKent Overstreet 	TP_fast_assign(
541297604c9SKent Overstreet 		__entry->caller	= caller;
542297604c9SKent Overstreet 		__entry->ip	= ip;
543297604c9SKent Overstreet 	),
544297604c9SKent Overstreet 
5453dc5fcfcSKent Overstreet 	TP_printk("%pS %pS", (void *) __entry->caller, (void *) __entry->ip)
546297604c9SKent Overstreet );
547297604c9SKent Overstreet 
548ba5c6557SKent Overstreet DECLARE_EVENT_CLASS(transaction_restart,
54920bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
55020bceecbSKent Overstreet 	TP_ARGS(ip),
551ba5c6557SKent Overstreet 
552ba5c6557SKent Overstreet 	TP_STRUCT__entry(
553ba5c6557SKent Overstreet 		__field(unsigned long,		ip	)
554ba5c6557SKent Overstreet 	),
555ba5c6557SKent Overstreet 
556ba5c6557SKent Overstreet 	TP_fast_assign(
557ba5c6557SKent Overstreet 		__entry->ip = ip;
558ba5c6557SKent Overstreet 	),
559ba5c6557SKent Overstreet 
560ba5c6557SKent Overstreet 	TP_printk("%pS", (void *) __entry->ip)
561ba5c6557SKent Overstreet );
562ba5c6557SKent Overstreet 
563ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_btree_node_reused,
56420bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
56520bceecbSKent Overstreet 	TP_ARGS(ip)
566ba5c6557SKent Overstreet );
567ba5c6557SKent Overstreet 
568a301dc38SKent Overstreet TRACE_EVENT(trans_restart_would_deadlock,
569a301dc38SKent Overstreet 	TP_PROTO(unsigned long	trans_ip,
570a301dc38SKent Overstreet 		 unsigned long	caller_ip,
5712527dd91SKent Overstreet 		 bool		in_traverse_all,
572a301dc38SKent Overstreet 		 unsigned	reason,
573a301dc38SKent Overstreet 		 enum btree_id	have_btree_id,
574a301dc38SKent Overstreet 		 unsigned	have_iter_type,
5752527dd91SKent Overstreet 		 struct bpos	*have_pos,
576a301dc38SKent Overstreet 		 enum btree_id	want_btree_id,
5772527dd91SKent Overstreet 		 unsigned	want_iter_type,
5782527dd91SKent Overstreet 		 struct bpos	*want_pos),
5792527dd91SKent Overstreet 	TP_ARGS(trans_ip, caller_ip, in_traverse_all, reason,
5802527dd91SKent Overstreet 		have_btree_id, have_iter_type, have_pos,
5812527dd91SKent Overstreet 		want_btree_id, want_iter_type, want_pos),
582a301dc38SKent Overstreet 
583a301dc38SKent Overstreet 	TP_STRUCT__entry(
584a301dc38SKent Overstreet 		__field(unsigned long,		trans_ip	)
585a301dc38SKent Overstreet 		__field(unsigned long,		caller_ip	)
5862527dd91SKent Overstreet 		__field(u8,			in_traverse_all	)
587a301dc38SKent Overstreet 		__field(u8,			reason		)
588a301dc38SKent Overstreet 		__field(u8,			have_btree_id	)
589a301dc38SKent Overstreet 		__field(u8,			have_iter_type	)
590a301dc38SKent Overstreet 		__field(u8,			want_btree_id	)
591a301dc38SKent Overstreet 		__field(u8,			want_iter_type	)
5922527dd91SKent Overstreet 
5932527dd91SKent Overstreet 		__field(u64,			have_pos_inode	)
5942527dd91SKent Overstreet 		__field(u64,			have_pos_offset	)
5952527dd91SKent Overstreet 		__field(u32,			have_pos_snapshot)
5962527dd91SKent Overstreet 		__field(u32,			want_pos_snapshot)
5972527dd91SKent Overstreet 		__field(u64,			want_pos_inode	)
5982527dd91SKent Overstreet 		__field(u64,			want_pos_offset	)
599a301dc38SKent Overstreet 	),
600a301dc38SKent Overstreet 
601a301dc38SKent Overstreet 	TP_fast_assign(
602a301dc38SKent Overstreet 		__entry->trans_ip		= trans_ip;
603a301dc38SKent Overstreet 		__entry->caller_ip		= caller_ip;
6042527dd91SKent Overstreet 		__entry->in_traverse_all	= in_traverse_all;
605a301dc38SKent Overstreet 		__entry->reason			= reason;
606a301dc38SKent Overstreet 		__entry->have_btree_id		= have_btree_id;
607a301dc38SKent Overstreet 		__entry->have_iter_type		= have_iter_type;
608a301dc38SKent Overstreet 		__entry->want_btree_id		= want_btree_id;
609a301dc38SKent Overstreet 		__entry->want_iter_type		= want_iter_type;
6102527dd91SKent Overstreet 
6112527dd91SKent Overstreet 		__entry->have_pos_inode		= have_pos->inode;
6122527dd91SKent Overstreet 		__entry->have_pos_offset	= have_pos->offset;
6132527dd91SKent Overstreet 		__entry->have_pos_snapshot	= have_pos->snapshot;
6142527dd91SKent Overstreet 
6152527dd91SKent Overstreet 		__entry->want_pos_inode		= want_pos->inode;
6162527dd91SKent Overstreet 		__entry->want_pos_offset	= want_pos->offset;
6172527dd91SKent Overstreet 		__entry->want_pos_snapshot	= want_pos->snapshot;
618a301dc38SKent Overstreet 	),
619a301dc38SKent Overstreet 
6202527dd91SKent Overstreet 	TP_printk("%pS %pS traverse_all %u because %u have %u:%u %llu:%llu:%u want %u:%u %llu:%llu:%u",
621a301dc38SKent Overstreet 		  (void *) __entry->trans_ip,
622a301dc38SKent Overstreet 		  (void *) __entry->caller_ip,
6232527dd91SKent Overstreet 		  __entry->in_traverse_all,
624a301dc38SKent Overstreet 		  __entry->reason,
625a301dc38SKent Overstreet 		  __entry->have_btree_id,
626a301dc38SKent Overstreet 		  __entry->have_iter_type,
6272527dd91SKent Overstreet 		  __entry->have_pos_inode,
6282527dd91SKent Overstreet 		  __entry->have_pos_offset,
6292527dd91SKent Overstreet 		  __entry->have_pos_snapshot,
630a301dc38SKent Overstreet 		  __entry->want_btree_id,
6312527dd91SKent Overstreet 		  __entry->want_iter_type,
6322527dd91SKent Overstreet 		  __entry->want_pos_inode,
6332527dd91SKent Overstreet 		  __entry->want_pos_offset,
6342527dd91SKent Overstreet 		  __entry->want_pos_snapshot)
635ba5c6557SKent Overstreet );
636ba5c6557SKent Overstreet 
63720bceecbSKent Overstreet TRACE_EVENT(trans_restart_mem_realloced,
63873a117d2SKent Overstreet 	TP_PROTO(unsigned long trans_ip, unsigned long caller_ip,
63973a117d2SKent Overstreet 		 unsigned long bytes),
64073a117d2SKent Overstreet 	TP_ARGS(trans_ip, caller_ip, bytes),
64120bceecbSKent Overstreet 
64220bceecbSKent Overstreet 	TP_STRUCT__entry(
64373a117d2SKent Overstreet 		__field(unsigned long,		trans_ip	)
64473a117d2SKent Overstreet 		__field(unsigned long,		caller_ip	)
64520bceecbSKent Overstreet 		__field(unsigned long,		bytes		)
64620bceecbSKent Overstreet 	),
64720bceecbSKent Overstreet 
64820bceecbSKent Overstreet 	TP_fast_assign(
64973a117d2SKent Overstreet 		__entry->trans_ip	= trans_ip;
65073a117d2SKent Overstreet 		__entry->caller_ip	= caller_ip;
65120bceecbSKent Overstreet 		__entry->bytes		= bytes;
65220bceecbSKent Overstreet 	),
65320bceecbSKent Overstreet 
65473a117d2SKent Overstreet 	TP_printk("%pS %pS bytes %lu",
65573a117d2SKent Overstreet 		  (void *) __entry->trans_ip,
65673a117d2SKent Overstreet 		  (void *) __entry->caller_ip,
65773a117d2SKent Overstreet 		  __entry->bytes)
658ba5c6557SKent Overstreet );
659ba5c6557SKent Overstreet 
660ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_journal_res_get,
66120bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
66220bceecbSKent Overstreet 	TP_ARGS(ip)
663ba5c6557SKent Overstreet );
664ba5c6557SKent Overstreet 
665ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_journal_preres_get,
66620bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
66720bceecbSKent Overstreet 	TP_ARGS(ip)
668ba5c6557SKent Overstreet );
669ba5c6557SKent Overstreet 
670d5425a3bSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_journal_reclaim,
671d5425a3bSKent Overstreet 	TP_PROTO(unsigned long ip),
672d5425a3bSKent Overstreet 	TP_ARGS(ip)
673d5425a3bSKent Overstreet );
674d5425a3bSKent Overstreet 
675ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_mark_replicas,
67620bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
67720bceecbSKent Overstreet 	TP_ARGS(ip)
678ba5c6557SKent Overstreet );
679ba5c6557SKent Overstreet 
680ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_fault_inject,
68120bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
68220bceecbSKent Overstreet 	TP_ARGS(ip)
683ba5c6557SKent Overstreet );
684ba5c6557SKent Overstreet 
685ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_btree_node_split,
68620bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
68720bceecbSKent Overstreet 	TP_ARGS(ip)
688ba5c6557SKent Overstreet );
689ba5c6557SKent Overstreet 
690ed8413fdSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_mark,
69120bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
69220bceecbSKent Overstreet 	TP_ARGS(ip)
693ed8413fdSKent Overstreet );
694ed8413fdSKent Overstreet 
695ed8413fdSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_upgrade,
69620bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
69720bceecbSKent Overstreet 	TP_ARGS(ip)
698ed8413fdSKent Overstreet );
699ed8413fdSKent Overstreet 
700ed8413fdSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_iter_upgrade,
70120bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
70220bceecbSKent Overstreet 	TP_ARGS(ip)
703ed8413fdSKent Overstreet );
704ed8413fdSKent Overstreet 
705241e2636SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_relock,
706241e2636SKent Overstreet 	TP_PROTO(unsigned long ip),
707241e2636SKent Overstreet 	TP_ARGS(ip)
708241e2636SKent Overstreet );
709241e2636SKent Overstreet 
710ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_traverse,
71120bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
71220bceecbSKent Overstreet 	TP_ARGS(ip)
713ba5c6557SKent Overstreet );
714ba5c6557SKent Overstreet 
7152527dd91SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_traverse_all,
7162527dd91SKent Overstreet 	TP_PROTO(unsigned long ip),
7172527dd91SKent Overstreet 	TP_ARGS(ip)
7182527dd91SKent Overstreet );
7192527dd91SKent Overstreet 
720ed8413fdSKent Overstreet DECLARE_EVENT_CLASS(node_lock_fail,
721ed8413fdSKent Overstreet 	TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
722ed8413fdSKent Overstreet 	TP_ARGS(level, iter_seq, node, node_seq),
723ed8413fdSKent Overstreet 
724ed8413fdSKent Overstreet 	TP_STRUCT__entry(
725ed8413fdSKent Overstreet 		__field(u32,		level)
726ed8413fdSKent Overstreet 		__field(u32,		iter_seq)
727ed8413fdSKent Overstreet 		__field(u32,		node)
728ed8413fdSKent Overstreet 		__field(u32,		node_seq)
729ed8413fdSKent Overstreet 	),
730ed8413fdSKent Overstreet 
731ed8413fdSKent Overstreet 	TP_fast_assign(
732ed8413fdSKent Overstreet 		__entry->level		= level;
733ed8413fdSKent Overstreet 		__entry->iter_seq	= iter_seq;
734ed8413fdSKent Overstreet 		__entry->node		= node;
735ed8413fdSKent Overstreet 		__entry->node_seq	= node_seq;
736ed8413fdSKent Overstreet 	),
737ed8413fdSKent Overstreet 
738ed8413fdSKent Overstreet 	TP_printk("level %u iter seq %u node %u node seq %u",
739ed8413fdSKent Overstreet 		  __entry->level, __entry->iter_seq,
740ed8413fdSKent Overstreet 		  __entry->node, __entry->node_seq)
741ed8413fdSKent Overstreet );
742ed8413fdSKent Overstreet 
743ed8413fdSKent Overstreet DEFINE_EVENT(node_lock_fail, node_upgrade_fail,
744ed8413fdSKent Overstreet 	TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
745ed8413fdSKent Overstreet 	TP_ARGS(level, iter_seq, node, node_seq)
746ed8413fdSKent Overstreet );
747ed8413fdSKent Overstreet 
748ed8413fdSKent Overstreet DEFINE_EVENT(node_lock_fail, node_relock_fail,
749ed8413fdSKent Overstreet 	TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
750ed8413fdSKent Overstreet 	TP_ARGS(level, iter_seq, node, node_seq)
751ed8413fdSKent Overstreet );
752ed8413fdSKent Overstreet 
7531c6fdbd8SKent Overstreet #endif /* _TRACE_BCACHEFS_H */
7541c6fdbd8SKent Overstreet 
7551c6fdbd8SKent Overstreet /* This part must be outside protection */
7561c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_PATH
7571c6fdbd8SKent Overstreet #define TRACE_INCLUDE_PATH ../../fs/bcachefs
7581c6fdbd8SKent Overstreet 
7591c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_FILE
7601c6fdbd8SKent Overstreet #define TRACE_INCLUDE_FILE trace
7611c6fdbd8SKent Overstreet 
7621c6fdbd8SKent Overstreet #include <trace/define_trace.h>
763