xref: /linux/fs/bcachefs/trace.h (revision 2527dd91580b1eb5ff1f8df1b47817ac60395830)
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 
3831c6fdbd8SKent Overstreet TRACE_EVENT(alloc_batch,
3841c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, size_t free, size_t total),
3851c6fdbd8SKent Overstreet 	TP_ARGS(ca, free, total),
3861c6fdbd8SKent Overstreet 
3871c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
3881c6fdbd8SKent Overstreet 		__array(char,		uuid,	16	)
3891c6fdbd8SKent Overstreet 		__field(size_t,		free		)
3901c6fdbd8SKent Overstreet 		__field(size_t,		total		)
3911c6fdbd8SKent Overstreet 	),
3921c6fdbd8SKent Overstreet 
3931c6fdbd8SKent Overstreet 	TP_fast_assign(
3941c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, ca->uuid.b, 16);
3951c6fdbd8SKent Overstreet 		__entry->free = free;
3961c6fdbd8SKent Overstreet 		__entry->total = total;
3971c6fdbd8SKent Overstreet 	),
3981c6fdbd8SKent Overstreet 
3991c6fdbd8SKent Overstreet 	TP_printk("%pU free %zu total %zu",
4001c6fdbd8SKent Overstreet 		__entry->uuid, __entry->free, __entry->total)
4011c6fdbd8SKent Overstreet );
4021c6fdbd8SKent Overstreet 
4031c6fdbd8SKent Overstreet TRACE_EVENT(invalidate,
4041c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, u64 offset, unsigned sectors),
4051c6fdbd8SKent Overstreet 	TP_ARGS(ca, offset, sectors),
4061c6fdbd8SKent Overstreet 
4071c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
4081c6fdbd8SKent Overstreet 		__field(unsigned,	sectors			)
4091c6fdbd8SKent Overstreet 		__field(dev_t,		dev			)
4101c6fdbd8SKent Overstreet 		__field(__u64,		offset			)
4111c6fdbd8SKent Overstreet 	),
4121c6fdbd8SKent Overstreet 
4131c6fdbd8SKent Overstreet 	TP_fast_assign(
4141c6fdbd8SKent Overstreet 		__entry->dev		= ca->disk_sb.bdev->bd_dev;
4151c6fdbd8SKent Overstreet 		__entry->offset		= offset,
4161c6fdbd8SKent Overstreet 		__entry->sectors	= sectors;
4171c6fdbd8SKent Overstreet 	),
4181c6fdbd8SKent Overstreet 
4191c6fdbd8SKent Overstreet 	TP_printk("invalidated %u sectors at %d,%d sector=%llu",
4201c6fdbd8SKent Overstreet 		  __entry->sectors, MAJOR(__entry->dev),
4211c6fdbd8SKent Overstreet 		  MINOR(__entry->dev), __entry->offset)
4221c6fdbd8SKent Overstreet );
4231c6fdbd8SKent Overstreet 
4241c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bucket_alloc,
4251c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4261c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve),
4271c6fdbd8SKent Overstreet 
4281c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
4291c6fdbd8SKent Overstreet 		__array(char,			uuid,	16)
4301c6fdbd8SKent Overstreet 		__field(enum alloc_reserve,	reserve	  )
4311c6fdbd8SKent Overstreet 	),
4321c6fdbd8SKent Overstreet 
4331c6fdbd8SKent Overstreet 	TP_fast_assign(
4341c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, ca->uuid.b, 16);
4351c6fdbd8SKent Overstreet 		__entry->reserve = reserve;
4361c6fdbd8SKent Overstreet 	),
4371c6fdbd8SKent Overstreet 
4381c6fdbd8SKent Overstreet 	TP_printk("%pU reserve %d", __entry->uuid, __entry->reserve)
4391c6fdbd8SKent Overstreet );
4401c6fdbd8SKent Overstreet 
4411c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc,
4421c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4431c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve)
4441c6fdbd8SKent Overstreet );
4451c6fdbd8SKent Overstreet 
4461c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
4471c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4481c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve)
4491c6fdbd8SKent Overstreet );
4501c6fdbd8SKent Overstreet 
4511c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, open_bucket_alloc_fail,
4521c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_dev *ca, enum alloc_reserve reserve),
4531c6fdbd8SKent Overstreet 	TP_ARGS(ca, reserve)
4541c6fdbd8SKent Overstreet );
4551c6fdbd8SKent Overstreet 
4561c6fdbd8SKent Overstreet /* Moving IO */
4571c6fdbd8SKent Overstreet 
4581c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_extent,
4591c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
4601c6fdbd8SKent Overstreet 	TP_ARGS(k)
4611c6fdbd8SKent Overstreet );
4621c6fdbd8SKent Overstreet 
4631c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_alloc_fail,
4641c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
4651c6fdbd8SKent Overstreet 	TP_ARGS(k)
4661c6fdbd8SKent Overstreet );
4671c6fdbd8SKent Overstreet 
4681c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_race,
4691c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
4701c6fdbd8SKent Overstreet 	TP_ARGS(k)
4711c6fdbd8SKent Overstreet );
4721c6fdbd8SKent Overstreet 
4731c6fdbd8SKent Overstreet TRACE_EVENT(move_data,
4741c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 sectors_moved,
4751c6fdbd8SKent Overstreet 		 u64 keys_moved),
4761c6fdbd8SKent Overstreet 	TP_ARGS(c, sectors_moved, keys_moved),
4771c6fdbd8SKent Overstreet 
4781c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
4791c6fdbd8SKent Overstreet 		__array(char,		uuid,	16	)
4801c6fdbd8SKent Overstreet 		__field(u64,		sectors_moved	)
4811c6fdbd8SKent Overstreet 		__field(u64,		keys_moved	)
4821c6fdbd8SKent Overstreet 	),
4831c6fdbd8SKent Overstreet 
4841c6fdbd8SKent Overstreet 	TP_fast_assign(
4851c6fdbd8SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
4861c6fdbd8SKent Overstreet 		__entry->sectors_moved = sectors_moved;
4871c6fdbd8SKent Overstreet 		__entry->keys_moved = keys_moved;
4881c6fdbd8SKent Overstreet 	),
4891c6fdbd8SKent Overstreet 
4901c6fdbd8SKent Overstreet 	TP_printk("%pU sectors_moved %llu keys_moved %llu",
4911c6fdbd8SKent Overstreet 		__entry->uuid, __entry->sectors_moved, __entry->keys_moved)
4921c6fdbd8SKent Overstreet );
4931c6fdbd8SKent Overstreet 
4941c6fdbd8SKent Overstreet TRACE_EVENT(copygc,
495e6d11615SKent Overstreet 	TP_PROTO(struct bch_fs *c,
4961c6fdbd8SKent Overstreet 		 u64 sectors_moved, u64 sectors_not_moved,
4971c6fdbd8SKent Overstreet 		 u64 buckets_moved, u64 buckets_not_moved),
498e6d11615SKent Overstreet 	TP_ARGS(c,
4991c6fdbd8SKent Overstreet 		sectors_moved, sectors_not_moved,
5001c6fdbd8SKent Overstreet 		buckets_moved, buckets_not_moved),
5011c6fdbd8SKent Overstreet 
5021c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
5031c6fdbd8SKent Overstreet 		__array(char,		uuid,	16		)
5041c6fdbd8SKent Overstreet 		__field(u64,		sectors_moved		)
5051c6fdbd8SKent Overstreet 		__field(u64,		sectors_not_moved	)
5061c6fdbd8SKent Overstreet 		__field(u64,		buckets_moved		)
5071c6fdbd8SKent Overstreet 		__field(u64,		buckets_not_moved	)
5081c6fdbd8SKent Overstreet 	),
5091c6fdbd8SKent Overstreet 
5101c6fdbd8SKent Overstreet 	TP_fast_assign(
511e6d11615SKent Overstreet 		memcpy(__entry->uuid, c->sb.user_uuid.b, 16);
5121c6fdbd8SKent Overstreet 		__entry->sectors_moved		= sectors_moved;
5131c6fdbd8SKent Overstreet 		__entry->sectors_not_moved	= sectors_not_moved;
5141c6fdbd8SKent Overstreet 		__entry->buckets_moved		= buckets_moved;
5151c6fdbd8SKent Overstreet 		__entry->buckets_not_moved = buckets_moved;
5161c6fdbd8SKent Overstreet 	),
5171c6fdbd8SKent Overstreet 
5181c6fdbd8SKent Overstreet 	TP_printk("%pU sectors moved %llu remain %llu buckets moved %llu remain %llu",
5191c6fdbd8SKent Overstreet 		__entry->uuid,
5201c6fdbd8SKent Overstreet 		__entry->sectors_moved, __entry->sectors_not_moved,
5211c6fdbd8SKent Overstreet 		__entry->buckets_moved, __entry->buckets_not_moved)
5221c6fdbd8SKent Overstreet );
5231c6fdbd8SKent Overstreet 
524297604c9SKent Overstreet TRACE_EVENT(transaction_restart_ip,
525297604c9SKent Overstreet 	TP_PROTO(unsigned long caller, unsigned long ip),
526297604c9SKent Overstreet 	TP_ARGS(caller, ip),
527297604c9SKent Overstreet 
528297604c9SKent Overstreet 	TP_STRUCT__entry(
529297604c9SKent Overstreet 		__field(unsigned long,		caller	)
530297604c9SKent Overstreet 		__field(unsigned long,		ip	)
531297604c9SKent Overstreet 	),
532297604c9SKent Overstreet 
533297604c9SKent Overstreet 	TP_fast_assign(
534297604c9SKent Overstreet 		__entry->caller	= caller;
535297604c9SKent Overstreet 		__entry->ip	= ip;
536297604c9SKent Overstreet 	),
537297604c9SKent Overstreet 
5383dc5fcfcSKent Overstreet 	TP_printk("%pS %pS", (void *) __entry->caller, (void *) __entry->ip)
539297604c9SKent Overstreet );
540297604c9SKent Overstreet 
541ba5c6557SKent Overstreet DECLARE_EVENT_CLASS(transaction_restart,
54220bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
54320bceecbSKent Overstreet 	TP_ARGS(ip),
544ba5c6557SKent Overstreet 
545ba5c6557SKent Overstreet 	TP_STRUCT__entry(
546ba5c6557SKent Overstreet 		__field(unsigned long,		ip	)
547ba5c6557SKent Overstreet 	),
548ba5c6557SKent Overstreet 
549ba5c6557SKent Overstreet 	TP_fast_assign(
550ba5c6557SKent Overstreet 		__entry->ip = ip;
551ba5c6557SKent Overstreet 	),
552ba5c6557SKent Overstreet 
553ba5c6557SKent Overstreet 	TP_printk("%pS", (void *) __entry->ip)
554ba5c6557SKent Overstreet );
555ba5c6557SKent Overstreet 
556ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_btree_node_reused,
55720bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
55820bceecbSKent Overstreet 	TP_ARGS(ip)
559ba5c6557SKent Overstreet );
560ba5c6557SKent Overstreet 
561a301dc38SKent Overstreet TRACE_EVENT(trans_restart_would_deadlock,
562a301dc38SKent Overstreet 	TP_PROTO(unsigned long	trans_ip,
563a301dc38SKent Overstreet 		 unsigned long	caller_ip,
564*2527dd91SKent Overstreet 		 bool		in_traverse_all,
565a301dc38SKent Overstreet 		 unsigned	reason,
566a301dc38SKent Overstreet 		 enum btree_id	have_btree_id,
567a301dc38SKent Overstreet 		 unsigned	have_iter_type,
568*2527dd91SKent Overstreet 		 struct bpos	*have_pos,
569a301dc38SKent Overstreet 		 enum btree_id	want_btree_id,
570*2527dd91SKent Overstreet 		 unsigned	want_iter_type,
571*2527dd91SKent Overstreet 		 struct bpos	*want_pos),
572*2527dd91SKent Overstreet 	TP_ARGS(trans_ip, caller_ip, in_traverse_all, reason,
573*2527dd91SKent Overstreet 		have_btree_id, have_iter_type, have_pos,
574*2527dd91SKent Overstreet 		want_btree_id, want_iter_type, want_pos),
575a301dc38SKent Overstreet 
576a301dc38SKent Overstreet 	TP_STRUCT__entry(
577a301dc38SKent Overstreet 		__field(unsigned long,		trans_ip	)
578a301dc38SKent Overstreet 		__field(unsigned long,		caller_ip	)
579*2527dd91SKent Overstreet 		__field(u8,			in_traverse_all	)
580a301dc38SKent Overstreet 		__field(u8,			reason		)
581a301dc38SKent Overstreet 		__field(u8,			have_btree_id	)
582a301dc38SKent Overstreet 		__field(u8,			have_iter_type	)
583a301dc38SKent Overstreet 		__field(u8,			want_btree_id	)
584a301dc38SKent Overstreet 		__field(u8,			want_iter_type	)
585*2527dd91SKent Overstreet 
586*2527dd91SKent Overstreet 		__field(u64,			have_pos_inode	)
587*2527dd91SKent Overstreet 		__field(u64,			have_pos_offset	)
588*2527dd91SKent Overstreet 		__field(u32,			have_pos_snapshot)
589*2527dd91SKent Overstreet 		__field(u32,			want_pos_snapshot)
590*2527dd91SKent Overstreet 		__field(u64,			want_pos_inode	)
591*2527dd91SKent Overstreet 		__field(u64,			want_pos_offset	)
592a301dc38SKent Overstreet 	),
593a301dc38SKent Overstreet 
594a301dc38SKent Overstreet 	TP_fast_assign(
595a301dc38SKent Overstreet 		__entry->trans_ip		= trans_ip;
596a301dc38SKent Overstreet 		__entry->caller_ip		= caller_ip;
597*2527dd91SKent Overstreet 		__entry->in_traverse_all	= in_traverse_all;
598a301dc38SKent Overstreet 		__entry->reason			= reason;
599a301dc38SKent Overstreet 		__entry->have_btree_id		= have_btree_id;
600a301dc38SKent Overstreet 		__entry->have_iter_type		= have_iter_type;
601a301dc38SKent Overstreet 		__entry->want_btree_id		= want_btree_id;
602a301dc38SKent Overstreet 		__entry->want_iter_type		= want_iter_type;
603*2527dd91SKent Overstreet 
604*2527dd91SKent Overstreet 		__entry->have_pos_inode		= have_pos->inode;
605*2527dd91SKent Overstreet 		__entry->have_pos_offset	= have_pos->offset;
606*2527dd91SKent Overstreet 		__entry->have_pos_snapshot	= have_pos->snapshot;
607*2527dd91SKent Overstreet 
608*2527dd91SKent Overstreet 		__entry->want_pos_inode		= want_pos->inode;
609*2527dd91SKent Overstreet 		__entry->want_pos_offset	= want_pos->offset;
610*2527dd91SKent Overstreet 		__entry->want_pos_snapshot	= want_pos->snapshot;
611a301dc38SKent Overstreet 	),
612a301dc38SKent Overstreet 
613*2527dd91SKent Overstreet 	TP_printk("%pS %pS traverse_all %u because %u have %u:%u %llu:%llu:%u want %u:%u %llu:%llu:%u",
614a301dc38SKent Overstreet 		  (void *) __entry->trans_ip,
615a301dc38SKent Overstreet 		  (void *) __entry->caller_ip,
616*2527dd91SKent Overstreet 		  __entry->in_traverse_all,
617a301dc38SKent Overstreet 		  __entry->reason,
618a301dc38SKent Overstreet 		  __entry->have_btree_id,
619a301dc38SKent Overstreet 		  __entry->have_iter_type,
620*2527dd91SKent Overstreet 		  __entry->have_pos_inode,
621*2527dd91SKent Overstreet 		  __entry->have_pos_offset,
622*2527dd91SKent Overstreet 		  __entry->have_pos_snapshot,
623a301dc38SKent Overstreet 		  __entry->want_btree_id,
624*2527dd91SKent Overstreet 		  __entry->want_iter_type,
625*2527dd91SKent Overstreet 		  __entry->want_pos_inode,
626*2527dd91SKent Overstreet 		  __entry->want_pos_offset,
627*2527dd91SKent Overstreet 		  __entry->want_pos_snapshot)
628ba5c6557SKent Overstreet );
629ba5c6557SKent Overstreet 
63020bceecbSKent Overstreet TRACE_EVENT(trans_restart_iters_realloced,
63120bceecbSKent Overstreet 	TP_PROTO(unsigned long ip, unsigned nr),
63220bceecbSKent Overstreet 	TP_ARGS(ip, nr),
63320bceecbSKent Overstreet 
63420bceecbSKent Overstreet 	TP_STRUCT__entry(
63520bceecbSKent Overstreet 		__field(unsigned long,		ip	)
63620bceecbSKent Overstreet 		__field(unsigned,		nr	)
63720bceecbSKent Overstreet 	),
63820bceecbSKent Overstreet 
63920bceecbSKent Overstreet 	TP_fast_assign(
64020bceecbSKent Overstreet 		__entry->ip	= ip;
64120bceecbSKent Overstreet 		__entry->nr	= nr;
64220bceecbSKent Overstreet 	),
64320bceecbSKent Overstreet 
64420bceecbSKent Overstreet 	TP_printk("%pS nr %u", (void *) __entry->ip, __entry->nr)
645ba5c6557SKent Overstreet );
646ba5c6557SKent Overstreet 
64720bceecbSKent Overstreet TRACE_EVENT(trans_restart_mem_realloced,
64820bceecbSKent Overstreet 	TP_PROTO(unsigned long ip, unsigned long bytes),
64920bceecbSKent Overstreet 	TP_ARGS(ip, bytes),
65020bceecbSKent Overstreet 
65120bceecbSKent Overstreet 	TP_STRUCT__entry(
65220bceecbSKent Overstreet 		__field(unsigned long,		ip	)
65320bceecbSKent Overstreet 		__field(unsigned long,		bytes	)
65420bceecbSKent Overstreet 	),
65520bceecbSKent Overstreet 
65620bceecbSKent Overstreet 	TP_fast_assign(
65720bceecbSKent Overstreet 		__entry->ip	= ip;
65820bceecbSKent Overstreet 		__entry->bytes	= bytes;
65920bceecbSKent Overstreet 	),
66020bceecbSKent Overstreet 
66120bceecbSKent Overstreet 	TP_printk("%pS bytes %lu", (void *) __entry->ip, __entry->bytes)
662ba5c6557SKent Overstreet );
663ba5c6557SKent Overstreet 
664ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_journal_res_get,
66520bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
66620bceecbSKent Overstreet 	TP_ARGS(ip)
667ba5c6557SKent Overstreet );
668ba5c6557SKent Overstreet 
669ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_journal_preres_get,
67020bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
67120bceecbSKent Overstreet 	TP_ARGS(ip)
672ba5c6557SKent Overstreet );
673ba5c6557SKent Overstreet 
674d5425a3bSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_journal_reclaim,
675d5425a3bSKent Overstreet 	TP_PROTO(unsigned long ip),
676d5425a3bSKent Overstreet 	TP_ARGS(ip)
677d5425a3bSKent Overstreet );
678d5425a3bSKent Overstreet 
679ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_mark_replicas,
68020bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
68120bceecbSKent Overstreet 	TP_ARGS(ip)
682ba5c6557SKent Overstreet );
683ba5c6557SKent Overstreet 
684ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_fault_inject,
68520bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
68620bceecbSKent Overstreet 	TP_ARGS(ip)
687ba5c6557SKent Overstreet );
688ba5c6557SKent Overstreet 
689ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_btree_node_split,
69020bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
69120bceecbSKent Overstreet 	TP_ARGS(ip)
692ba5c6557SKent Overstreet );
693ba5c6557SKent Overstreet 
694ed8413fdSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_mark,
69520bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
69620bceecbSKent Overstreet 	TP_ARGS(ip)
697ed8413fdSKent Overstreet );
698ed8413fdSKent Overstreet 
699ed8413fdSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_upgrade,
70020bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
70120bceecbSKent Overstreet 	TP_ARGS(ip)
702ed8413fdSKent Overstreet );
703ed8413fdSKent Overstreet 
704ed8413fdSKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_iter_upgrade,
70520bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
70620bceecbSKent Overstreet 	TP_ARGS(ip)
707ed8413fdSKent Overstreet );
708ed8413fdSKent Overstreet 
709241e2636SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_relock,
710241e2636SKent Overstreet 	TP_PROTO(unsigned long ip),
711241e2636SKent Overstreet 	TP_ARGS(ip)
712241e2636SKent Overstreet );
713241e2636SKent Overstreet 
714ba5c6557SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_restart_traverse,
71520bceecbSKent Overstreet 	TP_PROTO(unsigned long ip),
71620bceecbSKent Overstreet 	TP_ARGS(ip)
717ba5c6557SKent Overstreet );
718ba5c6557SKent Overstreet 
719*2527dd91SKent Overstreet DEFINE_EVENT(transaction_restart,	trans_traverse_all,
720*2527dd91SKent Overstreet 	TP_PROTO(unsigned long ip),
721*2527dd91SKent Overstreet 	TP_ARGS(ip)
722*2527dd91SKent Overstreet );
723*2527dd91SKent Overstreet 
724ed8413fdSKent Overstreet DECLARE_EVENT_CLASS(node_lock_fail,
725ed8413fdSKent Overstreet 	TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
726ed8413fdSKent Overstreet 	TP_ARGS(level, iter_seq, node, node_seq),
727ed8413fdSKent Overstreet 
728ed8413fdSKent Overstreet 	TP_STRUCT__entry(
729ed8413fdSKent Overstreet 		__field(u32,		level)
730ed8413fdSKent Overstreet 		__field(u32,		iter_seq)
731ed8413fdSKent Overstreet 		__field(u32,		node)
732ed8413fdSKent Overstreet 		__field(u32,		node_seq)
733ed8413fdSKent Overstreet 	),
734ed8413fdSKent Overstreet 
735ed8413fdSKent Overstreet 	TP_fast_assign(
736ed8413fdSKent Overstreet 		__entry->level		= level;
737ed8413fdSKent Overstreet 		__entry->iter_seq	= iter_seq;
738ed8413fdSKent Overstreet 		__entry->node		= node;
739ed8413fdSKent Overstreet 		__entry->node_seq	= node_seq;
740ed8413fdSKent Overstreet 	),
741ed8413fdSKent Overstreet 
742ed8413fdSKent Overstreet 	TP_printk("level %u iter seq %u node %u node seq %u",
743ed8413fdSKent Overstreet 		  __entry->level, __entry->iter_seq,
744ed8413fdSKent Overstreet 		  __entry->node, __entry->node_seq)
745ed8413fdSKent Overstreet );
746ed8413fdSKent Overstreet 
747ed8413fdSKent Overstreet DEFINE_EVENT(node_lock_fail, node_upgrade_fail,
748ed8413fdSKent Overstreet 	TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
749ed8413fdSKent Overstreet 	TP_ARGS(level, iter_seq, node, node_seq)
750ed8413fdSKent Overstreet );
751ed8413fdSKent Overstreet 
752ed8413fdSKent Overstreet DEFINE_EVENT(node_lock_fail, node_relock_fail,
753ed8413fdSKent Overstreet 	TP_PROTO(unsigned level, u32 iter_seq, unsigned node, u32 node_seq),
754ed8413fdSKent Overstreet 	TP_ARGS(level, iter_seq, node, node_seq)
755ed8413fdSKent Overstreet );
756ed8413fdSKent Overstreet 
7571c6fdbd8SKent Overstreet #endif /* _TRACE_BCACHEFS_H */
7581c6fdbd8SKent Overstreet 
7591c6fdbd8SKent Overstreet /* This part must be outside protection */
7601c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_PATH
7611c6fdbd8SKent Overstreet #define TRACE_INCLUDE_PATH ../../fs/bcachefs
7621c6fdbd8SKent Overstreet 
7631c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_FILE
7641c6fdbd8SKent Overstreet #define TRACE_INCLUDE_FILE trace
7651c6fdbd8SKent Overstreet 
7661c6fdbd8SKent Overstreet #include <trace/define_trace.h>
767