xref: /linux/fs/bcachefs/trace.h (revision 0990efaeeab14de1e3e3bf2791808afebadd1cc4)
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(
52ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
531c6fdbd8SKent Overstreet 	),
541c6fdbd8SKent Overstreet 
551c6fdbd8SKent Overstreet 	TP_fast_assign(
56ddc7dd62SKent Overstreet 		__entry->dev		= c->dev;
571c6fdbd8SKent Overstreet 	),
581c6fdbd8SKent Overstreet 
59ddc7dd62SKent Overstreet 	TP_printk("%d,%d", MAJOR(__entry->dev), MINOR(__entry->dev))
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 
854254f5bfSKent Overstreet /* super-io.c: */
864254f5bfSKent Overstreet TRACE_EVENT(write_super,
874254f5bfSKent Overstreet 	TP_PROTO(struct bch_fs *c, unsigned long ip),
884254f5bfSKent Overstreet 	TP_ARGS(c, ip),
894254f5bfSKent Overstreet 
904254f5bfSKent Overstreet 	TP_STRUCT__entry(
914254f5bfSKent Overstreet 		__field(dev_t,		dev	)
924254f5bfSKent Overstreet 		__field(unsigned long,	ip	)
934254f5bfSKent Overstreet 	),
944254f5bfSKent Overstreet 
954254f5bfSKent Overstreet 	TP_fast_assign(
964254f5bfSKent Overstreet 		__entry->dev		= c->dev;
974254f5bfSKent Overstreet 		__entry->ip		= ip;
984254f5bfSKent Overstreet 	),
994254f5bfSKent Overstreet 
1004254f5bfSKent Overstreet 	TP_printk("%d,%d for %pS",
1014254f5bfSKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1024254f5bfSKent Overstreet 		  (void *) __entry->ip)
1034254f5bfSKent Overstreet );
1044254f5bfSKent Overstreet 
1051c6fdbd8SKent Overstreet /* io.c: */
1061c6fdbd8SKent Overstreet 
1071c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_split,
1081c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1091c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1101c6fdbd8SKent Overstreet );
1111c6fdbd8SKent Overstreet 
1121c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_bounce,
1131c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1141c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1151c6fdbd8SKent Overstreet );
1161c6fdbd8SKent Overstreet 
1171c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_retry,
1181c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1191c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1201c6fdbd8SKent Overstreet );
1211c6fdbd8SKent Overstreet 
1221c6fdbd8SKent Overstreet DEFINE_EVENT(bio, promote,
1231c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1241c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1251c6fdbd8SKent Overstreet );
1261c6fdbd8SKent Overstreet 
1271c6fdbd8SKent Overstreet /* Journal */
1281c6fdbd8SKent Overstreet 
1291c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, journal_full,
1301c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
1311c6fdbd8SKent Overstreet 	TP_ARGS(c)
1321c6fdbd8SKent Overstreet );
1331c6fdbd8SKent Overstreet 
1341c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, journal_entry_full,
1351c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
1361c6fdbd8SKent Overstreet 	TP_ARGS(c)
1371c6fdbd8SKent Overstreet );
1381c6fdbd8SKent Overstreet 
1391c6fdbd8SKent Overstreet DEFINE_EVENT(bio, journal_write,
1401c6fdbd8SKent Overstreet 	TP_PROTO(struct bio *bio),
1411c6fdbd8SKent Overstreet 	TP_ARGS(bio)
1421c6fdbd8SKent Overstreet );
1431c6fdbd8SKent Overstreet 
1448a92e545SKent Overstreet TRACE_EVENT(journal_reclaim_start,
1451f93726eSKent Overstreet 	TP_PROTO(struct bch_fs *c, bool direct, bool kicked,
1461f93726eSKent Overstreet 		 u64 min_nr, u64 min_key_cache,
1478a92e545SKent Overstreet 		 u64 prereserved, u64 prereserved_total,
1488a92e545SKent Overstreet 		 u64 btree_cache_dirty, u64 btree_cache_total,
1498a92e545SKent Overstreet 		 u64 btree_key_cache_dirty, u64 btree_key_cache_total),
1501f93726eSKent Overstreet 	TP_ARGS(c, direct, kicked, min_nr, min_key_cache, prereserved, prereserved_total,
1518a92e545SKent Overstreet 		btree_cache_dirty, btree_cache_total,
1528a92e545SKent Overstreet 		btree_key_cache_dirty, btree_key_cache_total),
1538a92e545SKent Overstreet 
1548a92e545SKent Overstreet 	TP_STRUCT__entry(
155ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
1561f93726eSKent Overstreet 		__field(bool,		direct			)
1571f93726eSKent Overstreet 		__field(bool,		kicked			)
1588a92e545SKent Overstreet 		__field(u64,		min_nr			)
1591f93726eSKent Overstreet 		__field(u64,		min_key_cache		)
1608a92e545SKent Overstreet 		__field(u64,		prereserved		)
1618a92e545SKent Overstreet 		__field(u64,		prereserved_total	)
1628a92e545SKent Overstreet 		__field(u64,		btree_cache_dirty	)
1638a92e545SKent Overstreet 		__field(u64,		btree_cache_total	)
1648a92e545SKent Overstreet 		__field(u64,		btree_key_cache_dirty	)
1658a92e545SKent Overstreet 		__field(u64,		btree_key_cache_total	)
1668a92e545SKent Overstreet 	),
1678a92e545SKent Overstreet 
1688a92e545SKent Overstreet 	TP_fast_assign(
169ddc7dd62SKent Overstreet 		__entry->dev			= c->dev;
1701f93726eSKent Overstreet 		__entry->direct			= direct;
1711f93726eSKent Overstreet 		__entry->kicked			= kicked;
1728a92e545SKent Overstreet 		__entry->min_nr			= min_nr;
1731f93726eSKent Overstreet 		__entry->min_key_cache		= min_key_cache;
1748a92e545SKent Overstreet 		__entry->prereserved		= prereserved;
1758a92e545SKent Overstreet 		__entry->prereserved_total	= prereserved_total;
1768a92e545SKent Overstreet 		__entry->btree_cache_dirty	= btree_cache_dirty;
1778a92e545SKent Overstreet 		__entry->btree_cache_total	= btree_cache_total;
1788a92e545SKent Overstreet 		__entry->btree_key_cache_dirty	= btree_key_cache_dirty;
1798a92e545SKent Overstreet 		__entry->btree_key_cache_total	= btree_key_cache_total;
1808a92e545SKent Overstreet 	),
1818a92e545SKent Overstreet 
1821f93726eSKent Overstreet 	TP_printk("%d,%d direct %u kicked %u min %llu key cache %llu prereserved %llu/%llu btree cache %llu/%llu key cache %llu/%llu",
183ddc7dd62SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1841f93726eSKent Overstreet 		  __entry->direct,
1851f93726eSKent Overstreet 		  __entry->kicked,
1868a92e545SKent Overstreet 		  __entry->min_nr,
1871f93726eSKent Overstreet 		  __entry->min_key_cache,
1888a92e545SKent Overstreet 		  __entry->prereserved,
1898a92e545SKent Overstreet 		  __entry->prereserved_total,
1908a92e545SKent Overstreet 		  __entry->btree_cache_dirty,
1918a92e545SKent Overstreet 		  __entry->btree_cache_total,
1928a92e545SKent Overstreet 		  __entry->btree_key_cache_dirty,
1938a92e545SKent Overstreet 		  __entry->btree_key_cache_total)
1948a92e545SKent Overstreet );
1958a92e545SKent Overstreet 
1968a92e545SKent Overstreet TRACE_EVENT(journal_reclaim_finish,
1978a92e545SKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 nr_flushed),
1988a92e545SKent Overstreet 	TP_ARGS(c, nr_flushed),
1998a92e545SKent Overstreet 
2008a92e545SKent Overstreet 	TP_STRUCT__entry(
201ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
2028a92e545SKent Overstreet 		__field(u64,		nr_flushed		)
2038a92e545SKent Overstreet 	),
2048a92e545SKent Overstreet 
2058a92e545SKent Overstreet 	TP_fast_assign(
206ddc7dd62SKent Overstreet 		__entry->dev		= c->dev;
2078a92e545SKent Overstreet 		__entry->nr_flushed	= nr_flushed;
2088a92e545SKent Overstreet 	),
2098a92e545SKent Overstreet 
2101f93726eSKent Overstreet 	TP_printk("%d,%d flushed %llu",
211ddc7dd62SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
212ddc7dd62SKent Overstreet 		  __entry->nr_flushed)
2138a92e545SKent Overstreet );
2148a92e545SKent Overstreet 
21559cc38b8SKent Overstreet /* allocator: */
21659cc38b8SKent Overstreet 
2171c6fdbd8SKent Overstreet /* bset.c: */
2181c6fdbd8SKent Overstreet 
2191c6fdbd8SKent Overstreet DEFINE_EVENT(bpos, bkey_pack_pos_fail,
2201c6fdbd8SKent Overstreet 	TP_PROTO(struct bpos *p),
2211c6fdbd8SKent Overstreet 	TP_ARGS(p)
2221c6fdbd8SKent Overstreet );
2231c6fdbd8SKent Overstreet 
2241c6fdbd8SKent Overstreet /* Btree */
2251c6fdbd8SKent Overstreet 
2261c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(btree_node,
2271c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2281c6fdbd8SKent Overstreet 	TP_ARGS(c, b),
2291c6fdbd8SKent Overstreet 
2301c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
231ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
2321c6fdbd8SKent Overstreet 		__field(u8,		level			)
2331c6fdbd8SKent Overstreet 		__field(u8,		id			)
2341c6fdbd8SKent Overstreet 		__field(u64,		inode			)
2351c6fdbd8SKent Overstreet 		__field(u64,		offset			)
2361c6fdbd8SKent Overstreet 	),
2371c6fdbd8SKent Overstreet 
2381c6fdbd8SKent Overstreet 	TP_fast_assign(
239ddc7dd62SKent Overstreet 		__entry->dev		= c->dev;
240c43a6ef9SKent Overstreet 		__entry->level		= b->c.level;
241c43a6ef9SKent Overstreet 		__entry->id		= b->c.btree_id;
2421c6fdbd8SKent Overstreet 		__entry->inode		= b->key.k.p.inode;
2431c6fdbd8SKent Overstreet 		__entry->offset		= b->key.k.p.offset;
2441c6fdbd8SKent Overstreet 	),
2451c6fdbd8SKent Overstreet 
246ddc7dd62SKent Overstreet 	TP_printk("%d,%d  %u id %u %llu:%llu",
247ddc7dd62SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
248ddc7dd62SKent Overstreet 		  __entry->level, __entry->id,
2491c6fdbd8SKent Overstreet 		  __entry->inode, __entry->offset)
2501c6fdbd8SKent Overstreet );
2511c6fdbd8SKent Overstreet 
2521c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_read,
2531c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2541c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2551c6fdbd8SKent Overstreet );
2561c6fdbd8SKent Overstreet 
2571c6fdbd8SKent Overstreet TRACE_EVENT(btree_write,
2581c6fdbd8SKent Overstreet 	TP_PROTO(struct btree *b, unsigned bytes, unsigned sectors),
2591c6fdbd8SKent Overstreet 	TP_ARGS(b, bytes, sectors),
2601c6fdbd8SKent Overstreet 
2611c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
26226609b61SKent Overstreet 		__field(enum btree_node_type,	type)
2631c6fdbd8SKent Overstreet 		__field(unsigned,	bytes			)
2641c6fdbd8SKent Overstreet 		__field(unsigned,	sectors			)
2651c6fdbd8SKent Overstreet 	),
2661c6fdbd8SKent Overstreet 
2671c6fdbd8SKent Overstreet 	TP_fast_assign(
2681c6fdbd8SKent Overstreet 		__entry->type	= btree_node_type(b);
2691c6fdbd8SKent Overstreet 		__entry->bytes	= bytes;
2701c6fdbd8SKent Overstreet 		__entry->sectors = sectors;
2711c6fdbd8SKent Overstreet 	),
2721c6fdbd8SKent Overstreet 
2731c6fdbd8SKent Overstreet 	TP_printk("bkey type %u bytes %u sectors %u",
2741c6fdbd8SKent Overstreet 		  __entry->type , __entry->bytes, __entry->sectors)
2751c6fdbd8SKent Overstreet );
2761c6fdbd8SKent Overstreet 
2771c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_alloc,
2781c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2791c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2801c6fdbd8SKent Overstreet );
2811c6fdbd8SKent Overstreet 
2821c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_free,
2831c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2841c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2851c6fdbd8SKent Overstreet );
2861c6fdbd8SKent Overstreet 
2871c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_reap,
2881c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
2891c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
2901c6fdbd8SKent Overstreet );
2911c6fdbd8SKent Overstreet 
292ddc7dd62SKent Overstreet DEFINE_EVENT(bch_fs, btree_node_cannibalize_lock_fail,
2931c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2941c6fdbd8SKent Overstreet 	TP_ARGS(c)
2951c6fdbd8SKent Overstreet );
2961c6fdbd8SKent Overstreet 
297ddc7dd62SKent Overstreet DEFINE_EVENT(bch_fs, btree_node_cannibalize_lock,
2981c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
2991c6fdbd8SKent Overstreet 	TP_ARGS(c)
3001c6fdbd8SKent Overstreet );
3011c6fdbd8SKent Overstreet 
302ddc7dd62SKent Overstreet DEFINE_EVENT(bch_fs, btree_node_cannibalize,
3031c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
3041c6fdbd8SKent Overstreet 	TP_ARGS(c)
3051c6fdbd8SKent Overstreet );
3061c6fdbd8SKent Overstreet 
3071c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, btree_node_cannibalize_unlock,
3081c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
3091c6fdbd8SKent Overstreet 	TP_ARGS(c)
3101c6fdbd8SKent Overstreet );
3111c6fdbd8SKent Overstreet 
3121c6fdbd8SKent Overstreet TRACE_EVENT(btree_reserve_get_fail,
3135f417394SKent Overstreet 	TP_PROTO(const char *trans_fn,
3145f417394SKent Overstreet 		 unsigned long caller_ip,
3155f417394SKent Overstreet 		 size_t required),
3165f417394SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, required),
3171c6fdbd8SKent Overstreet 
3181c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
3195f417394SKent Overstreet 		__array(char,			trans_fn, 24	)
3205f417394SKent Overstreet 		__field(unsigned long,		caller_ip	)
3211c6fdbd8SKent Overstreet 		__field(size_t,			required	)
3221c6fdbd8SKent Overstreet 	),
3231c6fdbd8SKent Overstreet 
3241c6fdbd8SKent Overstreet 	TP_fast_assign(
3255f417394SKent Overstreet 		strlcpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
3265f417394SKent Overstreet 		__entry->caller_ip	= caller_ip;
3271c6fdbd8SKent Overstreet 		__entry->required	= required;
3281c6fdbd8SKent Overstreet 	),
3291c6fdbd8SKent Overstreet 
3305f417394SKent Overstreet 	TP_printk("%s %pS required %zu",
3315f417394SKent Overstreet 		  __entry->trans_fn,
3325f417394SKent Overstreet 		  (void *) __entry->caller_ip,
3335f417394SKent Overstreet 		  __entry->required)
3341c6fdbd8SKent Overstreet );
3351c6fdbd8SKent Overstreet 
3361c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_split,
3371c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3381c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3391c6fdbd8SKent Overstreet );
3401c6fdbd8SKent Overstreet 
3411c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_compact,
3421c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3431c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3441c6fdbd8SKent Overstreet );
3451c6fdbd8SKent Overstreet 
3461c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_merge,
3471c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3481c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3491c6fdbd8SKent Overstreet );
3501c6fdbd8SKent Overstreet 
3511f93726eSKent Overstreet DEFINE_EVENT(btree_node, btree_rewrite,
3521f93726eSKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3531f93726eSKent Overstreet 	TP_ARGS(c, b)
3541f93726eSKent Overstreet );
3551f93726eSKent Overstreet 
3561c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_set_root,
3571c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, struct btree *b),
3581c6fdbd8SKent Overstreet 	TP_ARGS(c, b)
3591c6fdbd8SKent Overstreet );
3601c6fdbd8SKent Overstreet 
361c7ce813fSKent Overstreet TRACE_EVENT(btree_cache_scan,
3627c7e071dSKent Overstreet 	TP_PROTO(long nr_to_scan, long can_free, long ret),
3637c7e071dSKent Overstreet 	TP_ARGS(nr_to_scan, can_free, ret),
364c7ce813fSKent Overstreet 
365c7ce813fSKent Overstreet 	TP_STRUCT__entry(
3667c7e071dSKent Overstreet 		__field(long,	nr_to_scan		)
3677c7e071dSKent Overstreet 		__field(long,	can_free		)
368c7ce813fSKent Overstreet 		__field(long,	ret			)
369c7ce813fSKent Overstreet 	),
370c7ce813fSKent Overstreet 
371c7ce813fSKent Overstreet 	TP_fast_assign(
3727c7e071dSKent Overstreet 		__entry->nr_to_scan	= nr_to_scan;
3737c7e071dSKent Overstreet 		__entry->can_free	= can_free;
374c7ce813fSKent Overstreet 		__entry->ret		= ret;
375c7ce813fSKent Overstreet 	),
376c7ce813fSKent Overstreet 
3777c7e071dSKent Overstreet 	TP_printk("scanned for %li nodes, can free %li, ret %li",
3787c7e071dSKent Overstreet 		  __entry->nr_to_scan, __entry->can_free, __entry->ret)
379c7ce813fSKent Overstreet );
380c7ce813fSKent Overstreet 
381bc82d08bSKent Overstreet TRACE_EVENT(btree_node_relock_fail,
382bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
383bc82d08bSKent Overstreet 		 unsigned long caller_ip,
384bc82d08bSKent Overstreet 		 enum btree_id btree_id,
385bc82d08bSKent Overstreet 		 struct bpos *pos,
386bc82d08bSKent Overstreet 		 unsigned long node,
387bc82d08bSKent Overstreet 		 u32 iter_lock_seq,
388bc82d08bSKent Overstreet 		 u32 node_lock_seq),
389bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos, node, iter_lock_seq, node_lock_seq),
390bc82d08bSKent Overstreet 
391bc82d08bSKent Overstreet 	TP_STRUCT__entry(
392bc82d08bSKent Overstreet 		__array(char,			trans_fn, 24	)
3934b59a319SKent Overstreet 		__field(unsigned long,		caller_ip	)
394bc82d08bSKent Overstreet 		__field(u8,			btree_id	)
395bc82d08bSKent Overstreet 		__field(u64,			pos_inode	)
396bc82d08bSKent Overstreet 		__field(u64,			pos_offset	)
397bc82d08bSKent Overstreet 		__field(u32,			pos_snapshot	)
398bc82d08bSKent Overstreet 		__field(unsigned long,		node		)
399bc82d08bSKent Overstreet 		__field(u32,			iter_lock_seq	)
400bc82d08bSKent Overstreet 		__field(u32,			node_lock_seq	)
401bc82d08bSKent Overstreet 	),
402bc82d08bSKent Overstreet 
403bc82d08bSKent Overstreet 	TP_fast_assign(
404bc82d08bSKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
4054b59a319SKent Overstreet 		__entry->caller_ip		= caller_ip;
406bc82d08bSKent Overstreet 		__entry->btree_id		= btree_id;
407bc82d08bSKent Overstreet 		__entry->pos_inode		= pos->inode;
408bc82d08bSKent Overstreet 		__entry->pos_offset		= pos->offset;
409bc82d08bSKent Overstreet 		__entry->pos_snapshot		= pos->snapshot;
410bc82d08bSKent Overstreet 		__entry->node			= node;
411bc82d08bSKent Overstreet 		__entry->iter_lock_seq		= iter_lock_seq;
412bc82d08bSKent Overstreet 		__entry->node_lock_seq		= node_lock_seq;
413bc82d08bSKent Overstreet 	),
414bc82d08bSKent Overstreet 
4154b59a319SKent Overstreet 	TP_printk("%s %pS btree %u pos %llu:%llu:%u, node %lu iter seq %u lock seq %u",
416bc82d08bSKent Overstreet 		  __entry->trans_fn,
4174b59a319SKent Overstreet 		  (void *) __entry->caller_ip,
418bc82d08bSKent Overstreet 		  __entry->btree_id,
419bc82d08bSKent Overstreet 		  __entry->pos_inode,
420bc82d08bSKent Overstreet 		  __entry->pos_offset,
421bc82d08bSKent Overstreet 		  __entry->pos_snapshot,
422bc82d08bSKent Overstreet 		  __entry->node,
423bc82d08bSKent Overstreet 		  __entry->iter_lock_seq,
424bc82d08bSKent Overstreet 		  __entry->node_lock_seq)
425bc82d08bSKent Overstreet );
426bc82d08bSKent Overstreet 
4271c6fdbd8SKent Overstreet /* Garbage collection */
4281c6fdbd8SKent Overstreet 
4291f93726eSKent Overstreet DEFINE_EVENT(bch_fs, gc_gens_start,
4301c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
4311c6fdbd8SKent Overstreet 	TP_ARGS(c)
4321c6fdbd8SKent Overstreet );
4331c6fdbd8SKent Overstreet 
4341f93726eSKent Overstreet DEFINE_EVENT(bch_fs, gc_gens_end,
4351c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c),
4361c6fdbd8SKent Overstreet 	TP_ARGS(c)
4371c6fdbd8SKent Overstreet );
4381c6fdbd8SKent Overstreet 
4391c6fdbd8SKent Overstreet /* Allocator */
4401c6fdbd8SKent Overstreet 
4411c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bucket_alloc,
442f25d8215SKent Overstreet 	TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
4438ef98313SKent Overstreet 		 u64 free,
444f25d8215SKent Overstreet 		 u64 avail,
4458ef98313SKent Overstreet 		 u64 copygc_wait_amount,
4468ef98313SKent Overstreet 		 s64 copygc_waiting_for,
447f25d8215SKent Overstreet 		 u64 seen,
448f25d8215SKent Overstreet 		 u64 open,
449f25d8215SKent Overstreet 		 u64 need_journal_commit,
450f25d8215SKent Overstreet 		 u64 nouse,
451f25d8215SKent Overstreet 		 bool nonblocking,
452615f867cSKent Overstreet 		 const char *err),
4538ef98313SKent Overstreet 	TP_ARGS(ca, alloc_reserve, free, avail, copygc_wait_amount, copygc_waiting_for,
454615f867cSKent Overstreet 		seen, open, need_journal_commit, nouse, nonblocking, err),
4551c6fdbd8SKent Overstreet 
4561c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
45789baec78SKent Overstreet 		__field(dev_t,			dev			)
4583e154711SKent Overstreet 		__array(char,	reserve,	16			)
4598ef98313SKent Overstreet 		__field(u64,			free			)
460f25d8215SKent Overstreet 		__field(u64,			avail			)
4618ef98313SKent Overstreet 		__field(u64,			copygc_wait_amount	)
4628ef98313SKent Overstreet 		__field(s64,			copygc_waiting_for	)
463f25d8215SKent Overstreet 		__field(u64,			seen			)
464f25d8215SKent Overstreet 		__field(u64,			open			)
465f25d8215SKent Overstreet 		__field(u64,			need_journal_commit	)
466f25d8215SKent Overstreet 		__field(u64,			nouse			)
467f25d8215SKent Overstreet 		__field(bool,			nonblocking		)
468615f867cSKent Overstreet 		__array(char,			err,	16		)
4691c6fdbd8SKent Overstreet 	),
4701c6fdbd8SKent Overstreet 
4711c6fdbd8SKent Overstreet 	TP_fast_assign(
472eacb2574SKent Overstreet 		__entry->dev		= ca->dev;
4733e154711SKent Overstreet 		strlcpy(__entry->reserve, alloc_reserve, sizeof(__entry->reserve));
4748ef98313SKent Overstreet 		__entry->free		= free;
475f25d8215SKent Overstreet 		__entry->avail		= avail;
4768ef98313SKent Overstreet 		__entry->copygc_wait_amount	= copygc_wait_amount;
4778ef98313SKent Overstreet 		__entry->copygc_waiting_for	= copygc_waiting_for;
478f25d8215SKent Overstreet 		__entry->seen		= seen;
479f25d8215SKent Overstreet 		__entry->open		= open;
480f25d8215SKent Overstreet 		__entry->need_journal_commit = need_journal_commit;
481f25d8215SKent Overstreet 		__entry->nouse		= nouse;
482f25d8215SKent Overstreet 		__entry->nonblocking	= nonblocking;
483615f867cSKent Overstreet 		strlcpy(__entry->err, err, sizeof(__entry->err));
4841c6fdbd8SKent Overstreet 	),
4851c6fdbd8SKent Overstreet 
486615f867cSKent Overstreet 	TP_printk("%d,%d reserve %s free %llu avail %llu copygc_wait %llu/%lli seen %llu open %llu need_journal_commit %llu nouse %llu nonblocking %u err %s",
48789baec78SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
488f25d8215SKent Overstreet 		  __entry->reserve,
4898ef98313SKent Overstreet 		  __entry->free,
490f25d8215SKent Overstreet 		  __entry->avail,
4918ef98313SKent Overstreet 		  __entry->copygc_wait_amount,
4928ef98313SKent Overstreet 		  __entry->copygc_waiting_for,
493f25d8215SKent Overstreet 		  __entry->seen,
494f25d8215SKent Overstreet 		  __entry->open,
495f25d8215SKent Overstreet 		  __entry->need_journal_commit,
496f25d8215SKent Overstreet 		  __entry->nouse,
497f25d8215SKent Overstreet 		  __entry->nonblocking,
498615f867cSKent Overstreet 		  __entry->err)
4991c6fdbd8SKent Overstreet );
5001c6fdbd8SKent Overstreet 
5011c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc,
502f25d8215SKent Overstreet 	TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
5038ef98313SKent Overstreet 		 u64 free,
504f25d8215SKent Overstreet 		 u64 avail,
5058ef98313SKent Overstreet 		 u64 copygc_wait_amount,
5068ef98313SKent Overstreet 		 s64 copygc_waiting_for,
507f25d8215SKent Overstreet 		 u64 seen,
508f25d8215SKent Overstreet 		 u64 open,
509f25d8215SKent Overstreet 		 u64 need_journal_commit,
510f25d8215SKent Overstreet 		 u64 nouse,
511f25d8215SKent Overstreet 		 bool nonblocking,
512615f867cSKent Overstreet 		 const char *err),
5138ef98313SKent Overstreet 	TP_ARGS(ca, alloc_reserve, free, avail, copygc_wait_amount, copygc_waiting_for,
514615f867cSKent Overstreet 		seen, open, need_journal_commit, nouse, nonblocking, err)
5151c6fdbd8SKent Overstreet );
5161c6fdbd8SKent Overstreet 
5171c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc_fail,
518f25d8215SKent Overstreet 	TP_PROTO(struct bch_dev *ca, const char *alloc_reserve,
5198ef98313SKent Overstreet 		 u64 free,
520f25d8215SKent Overstreet 		 u64 avail,
5218ef98313SKent Overstreet 		 u64 copygc_wait_amount,
5228ef98313SKent Overstreet 		 s64 copygc_waiting_for,
523f25d8215SKent Overstreet 		 u64 seen,
524f25d8215SKent Overstreet 		 u64 open,
525f25d8215SKent Overstreet 		 u64 need_journal_commit,
526f25d8215SKent Overstreet 		 u64 nouse,
527f25d8215SKent Overstreet 		 bool nonblocking,
528615f867cSKent Overstreet 		 const char *err),
5298ef98313SKent Overstreet 	TP_ARGS(ca, alloc_reserve, free, avail, copygc_wait_amount, copygc_waiting_for,
530615f867cSKent Overstreet 		seen, open, need_journal_commit, nouse, nonblocking, err)
5311c6fdbd8SKent Overstreet );
5321c6fdbd8SKent Overstreet 
5331f93726eSKent Overstreet TRACE_EVENT(discard_buckets,
5341f93726eSKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 seen, u64 open,
535615f867cSKent Overstreet 		 u64 need_journal_commit, u64 discarded, const char *err),
536615f867cSKent Overstreet 	TP_ARGS(c, seen, open, need_journal_commit, discarded, err),
5371f93726eSKent Overstreet 
5381f93726eSKent Overstreet 	TP_STRUCT__entry(
5391f93726eSKent Overstreet 		__field(dev_t,		dev			)
5401f93726eSKent Overstreet 		__field(u64,		seen			)
5411f93726eSKent Overstreet 		__field(u64,		open			)
5421f93726eSKent Overstreet 		__field(u64,		need_journal_commit	)
5431f93726eSKent Overstreet 		__field(u64,		discarded		)
544615f867cSKent Overstreet 		__array(char,		err,	16		)
5451f93726eSKent Overstreet 	),
5461f93726eSKent Overstreet 
5471f93726eSKent Overstreet 	TP_fast_assign(
5481f93726eSKent Overstreet 		__entry->dev			= c->dev;
5491f93726eSKent Overstreet 		__entry->seen			= seen;
5501f93726eSKent Overstreet 		__entry->open			= open;
5511f93726eSKent Overstreet 		__entry->need_journal_commit	= need_journal_commit;
5521f93726eSKent Overstreet 		__entry->discarded		= discarded;
553615f867cSKent Overstreet 		strlcpy(__entry->err, err, sizeof(__entry->err));
5541f93726eSKent Overstreet 	),
5551f93726eSKent Overstreet 
556615f867cSKent Overstreet 	TP_printk("%d%d seen %llu open %llu need_journal_commit %llu discarded %llu err %s",
5571f93726eSKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
5581f93726eSKent Overstreet 		  __entry->seen,
5591f93726eSKent Overstreet 		  __entry->open,
5601f93726eSKent Overstreet 		  __entry->need_journal_commit,
5611f93726eSKent Overstreet 		  __entry->discarded,
562615f867cSKent Overstreet 		  __entry->err)
5631f93726eSKent Overstreet );
5641f93726eSKent Overstreet 
5651f93726eSKent Overstreet TRACE_EVENT(invalidate_bucket,
56638585367SKent Overstreet 	TP_PROTO(struct bch_fs *c, unsigned dev, u64 bucket, u32 sectors),
56738585367SKent Overstreet 	TP_ARGS(c, dev, bucket, sectors),
5681f93726eSKent Overstreet 
5691f93726eSKent Overstreet 	TP_STRUCT__entry(
5701f93726eSKent Overstreet 		__field(dev_t,		dev			)
5711f93726eSKent Overstreet 		__field(u32,		dev_idx			)
57238585367SKent Overstreet 		__field(u32,		sectors			)
5731f93726eSKent Overstreet 		__field(u64,		bucket			)
5741f93726eSKent Overstreet 	),
5751f93726eSKent Overstreet 
5761f93726eSKent Overstreet 	TP_fast_assign(
5771f93726eSKent Overstreet 		__entry->dev		= c->dev;
5781f93726eSKent Overstreet 		__entry->dev_idx	= dev;
57938585367SKent Overstreet 		__entry->sectors	= sectors;
5801f93726eSKent Overstreet 		__entry->bucket		= bucket;
5811f93726eSKent Overstreet 	),
5821f93726eSKent Overstreet 
58338585367SKent Overstreet 	TP_printk("%d:%d invalidated %u:%llu cached sectors %u",
5841f93726eSKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
58538585367SKent Overstreet 		  __entry->dev_idx, __entry->bucket,
58638585367SKent Overstreet 		  __entry->sectors)
5871f93726eSKent Overstreet );
5881f93726eSKent Overstreet 
5891c6fdbd8SKent Overstreet /* Moving IO */
5901c6fdbd8SKent Overstreet 
5911c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_extent,
5921c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
5931c6fdbd8SKent Overstreet 	TP_ARGS(k)
5941c6fdbd8SKent Overstreet );
5951c6fdbd8SKent Overstreet 
5961f93726eSKent Overstreet DEFINE_EVENT(bkey, move_alloc_mem_fail,
5971c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
5981c6fdbd8SKent Overstreet 	TP_ARGS(k)
5991c6fdbd8SKent Overstreet );
6001c6fdbd8SKent Overstreet 
6011c6fdbd8SKent Overstreet DEFINE_EVENT(bkey, move_race,
6021c6fdbd8SKent Overstreet 	TP_PROTO(const struct bkey *k),
6031c6fdbd8SKent Overstreet 	TP_ARGS(k)
6041c6fdbd8SKent Overstreet );
6051c6fdbd8SKent Overstreet 
6061c6fdbd8SKent Overstreet TRACE_EVENT(move_data,
6071c6fdbd8SKent Overstreet 	TP_PROTO(struct bch_fs *c, u64 sectors_moved,
6081c6fdbd8SKent Overstreet 		 u64 keys_moved),
6091c6fdbd8SKent Overstreet 	TP_ARGS(c, sectors_moved, keys_moved),
6101c6fdbd8SKent Overstreet 
6111c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
612ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
6131c6fdbd8SKent Overstreet 		__field(u64,		sectors_moved	)
6141c6fdbd8SKent Overstreet 		__field(u64,		keys_moved	)
6151c6fdbd8SKent Overstreet 	),
6161c6fdbd8SKent Overstreet 
6171c6fdbd8SKent Overstreet 	TP_fast_assign(
618ddc7dd62SKent Overstreet 		__entry->dev			= c->dev;
6191c6fdbd8SKent Overstreet 		__entry->sectors_moved = sectors_moved;
6201c6fdbd8SKent Overstreet 		__entry->keys_moved = keys_moved;
6211c6fdbd8SKent Overstreet 	),
6221c6fdbd8SKent Overstreet 
623ddc7dd62SKent Overstreet 	TP_printk("%d,%d sectors_moved %llu keys_moved %llu",
624ddc7dd62SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
625ddc7dd62SKent Overstreet 		  __entry->sectors_moved, __entry->keys_moved)
6261c6fdbd8SKent Overstreet );
6271c6fdbd8SKent Overstreet 
6281c6fdbd8SKent Overstreet TRACE_EVENT(copygc,
629e6d11615SKent Overstreet 	TP_PROTO(struct bch_fs *c,
6301c6fdbd8SKent Overstreet 		 u64 sectors_moved, u64 sectors_not_moved,
6311c6fdbd8SKent Overstreet 		 u64 buckets_moved, u64 buckets_not_moved),
632e6d11615SKent Overstreet 	TP_ARGS(c,
6331c6fdbd8SKent Overstreet 		sectors_moved, sectors_not_moved,
6341c6fdbd8SKent Overstreet 		buckets_moved, buckets_not_moved),
6351c6fdbd8SKent Overstreet 
6361c6fdbd8SKent Overstreet 	TP_STRUCT__entry(
637ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
6381c6fdbd8SKent Overstreet 		__field(u64,		sectors_moved		)
6391c6fdbd8SKent Overstreet 		__field(u64,		sectors_not_moved	)
6401c6fdbd8SKent Overstreet 		__field(u64,		buckets_moved		)
6411c6fdbd8SKent Overstreet 		__field(u64,		buckets_not_moved	)
6421c6fdbd8SKent Overstreet 	),
6431c6fdbd8SKent Overstreet 
6441c6fdbd8SKent Overstreet 	TP_fast_assign(
645ddc7dd62SKent Overstreet 		__entry->dev			= c->dev;
6461c6fdbd8SKent Overstreet 		__entry->sectors_moved		= sectors_moved;
6471c6fdbd8SKent Overstreet 		__entry->sectors_not_moved	= sectors_not_moved;
6481c6fdbd8SKent Overstreet 		__entry->buckets_moved		= buckets_moved;
6491c6fdbd8SKent Overstreet 		__entry->buckets_not_moved = buckets_moved;
6501c6fdbd8SKent Overstreet 	),
6511c6fdbd8SKent Overstreet 
652ddc7dd62SKent Overstreet 	TP_printk("%d,%d sectors moved %llu remain %llu buckets moved %llu remain %llu",
653ddc7dd62SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
6541c6fdbd8SKent Overstreet 		  __entry->sectors_moved, __entry->sectors_not_moved,
6551c6fdbd8SKent Overstreet 		  __entry->buckets_moved, __entry->buckets_not_moved)
6561c6fdbd8SKent Overstreet );
6571c6fdbd8SKent Overstreet 
65819d2819dSKent Overstreet TRACE_EVENT(copygc_wait,
65919d2819dSKent Overstreet 	TP_PROTO(struct bch_fs *c,
66019d2819dSKent Overstreet 		 u64 wait_amount, u64 until),
66119d2819dSKent Overstreet 	TP_ARGS(c, wait_amount, until),
66219d2819dSKent Overstreet 
66319d2819dSKent Overstreet 	TP_STRUCT__entry(
664ddc7dd62SKent Overstreet 		__field(dev_t,		dev			)
66519d2819dSKent Overstreet 		__field(u64,		wait_amount		)
66619d2819dSKent Overstreet 		__field(u64,		until			)
66719d2819dSKent Overstreet 	),
66819d2819dSKent Overstreet 
66919d2819dSKent Overstreet 	TP_fast_assign(
670ddc7dd62SKent Overstreet 		__entry->dev		= c->dev;
67119d2819dSKent Overstreet 		__entry->wait_amount	= wait_amount;
67219d2819dSKent Overstreet 		__entry->until		= until;
67319d2819dSKent Overstreet 	),
67419d2819dSKent Overstreet 
675ddc7dd62SKent Overstreet 	TP_printk("%d,%u waiting for %llu sectors until %llu",
676ddc7dd62SKent Overstreet 		  MAJOR(__entry->dev), MINOR(__entry->dev),
677ddc7dd62SKent Overstreet 		  __entry->wait_amount, __entry->until)
67819d2819dSKent Overstreet );
67919d2819dSKent Overstreet 
6801f93726eSKent Overstreet DECLARE_EVENT_CLASS(transaction_event,
681669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
682531a0095SKent Overstreet 		 unsigned long caller_ip),
683669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip),
684ba5c6557SKent Overstreet 
685ba5c6557SKent Overstreet 	TP_STRUCT__entry(
686669f87a5SKent Overstreet 		__array(char,			trans_fn, 24	)
687531a0095SKent Overstreet 		__field(unsigned long,		caller_ip	)
688ba5c6557SKent Overstreet 	),
689ba5c6557SKent Overstreet 
690ba5c6557SKent Overstreet 	TP_fast_assign(
691669f87a5SKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
692531a0095SKent Overstreet 		__entry->caller_ip		= caller_ip;
693ba5c6557SKent Overstreet 	),
694ba5c6557SKent Overstreet 
695669f87a5SKent Overstreet 	TP_printk("%s %pS", __entry->trans_fn, (void *) __entry->caller_ip)
696669f87a5SKent Overstreet );
697669f87a5SKent Overstreet 
6981f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	transaction_commit,
699669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
700669f87a5SKent Overstreet 		 unsigned long caller_ip),
701669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
702ba5c6557SKent Overstreet );
703ba5c6557SKent Overstreet 
7041f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	transaction_restart_ip,
705669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
706531a0095SKent Overstreet 		 unsigned long caller_ip),
707669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
708531a0095SKent Overstreet );
709531a0095SKent Overstreet 
7101f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_blocked_journal_reclaim,
711669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
712531a0095SKent Overstreet 		 unsigned long caller_ip),
713669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
714531a0095SKent Overstreet );
715531a0095SKent Overstreet 
7161f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_journal_res_get,
717669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
718531a0095SKent Overstreet 		 unsigned long caller_ip),
719669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
720531a0095SKent Overstreet );
721531a0095SKent Overstreet 
7221f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_journal_preres_get,
723669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
724531a0095SKent Overstreet 		 unsigned long caller_ip),
725669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
726531a0095SKent Overstreet );
727531a0095SKent Overstreet 
7281f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_journal_reclaim,
729669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
730531a0095SKent Overstreet 		 unsigned long caller_ip),
731669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
732531a0095SKent Overstreet );
733531a0095SKent Overstreet 
7341f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_fault_inject,
735669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
736531a0095SKent Overstreet 		 unsigned long caller_ip),
737669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
738531a0095SKent Overstreet );
739531a0095SKent Overstreet 
7401f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_traverse_all,
741669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
742531a0095SKent Overstreet 		 unsigned long caller_ip),
743669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
744531a0095SKent Overstreet );
745531a0095SKent Overstreet 
7461f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_mark_replicas,
7471f93726eSKent Overstreet 	TP_PROTO(const char *trans_fn,
7481f93726eSKent Overstreet 		 unsigned long caller_ip),
7491f93726eSKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
7501f93726eSKent Overstreet );
7511f93726eSKent Overstreet 
7521f93726eSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_key_cache_raced,
75312ce5b7dSKent Overstreet 	TP_PROTO(const char *trans_fn,
75412ce5b7dSKent Overstreet 		 unsigned long caller_ip),
75512ce5b7dSKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
75612ce5b7dSKent Overstreet );
75712ce5b7dSKent Overstreet 
758*0990efaeSKent Overstreet DEFINE_EVENT(transaction_event,	trans_restart_too_many_iters,
759*0990efaeSKent Overstreet 	TP_PROTO(const char *trans_fn,
760*0990efaeSKent Overstreet 		 unsigned long caller_ip),
761*0990efaeSKent Overstreet 	TP_ARGS(trans_fn, caller_ip)
762*0990efaeSKent Overstreet );
763*0990efaeSKent Overstreet 
764531a0095SKent Overstreet DECLARE_EVENT_CLASS(transaction_restart_iter,
765669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
766531a0095SKent Overstreet 		 unsigned long caller_ip,
767531a0095SKent Overstreet 		 enum btree_id btree_id,
768531a0095SKent Overstreet 		 struct bpos *pos),
769669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos),
770531a0095SKent Overstreet 
771531a0095SKent Overstreet 	TP_STRUCT__entry(
772669f87a5SKent Overstreet 		__array(char,			trans_fn, 24	)
7734b59a319SKent Overstreet 		__field(unsigned long,		caller_ip	)
774531a0095SKent Overstreet 		__field(u8,			btree_id	)
775531a0095SKent Overstreet 		__field(u64,			pos_inode	)
776531a0095SKent Overstreet 		__field(u64,			pos_offset	)
777531a0095SKent Overstreet 		__field(u32,			pos_snapshot	)
778531a0095SKent Overstreet 	),
779531a0095SKent Overstreet 
780531a0095SKent Overstreet 	TP_fast_assign(
781669f87a5SKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
7824b59a319SKent Overstreet 		__entry->caller_ip		= caller_ip;
783531a0095SKent Overstreet 		__entry->btree_id		= btree_id;
784531a0095SKent Overstreet 		__entry->pos_inode		= pos->inode;
785531a0095SKent Overstreet 		__entry->pos_offset		= pos->offset;
786531a0095SKent Overstreet 		__entry->pos_snapshot		= pos->snapshot;
787531a0095SKent Overstreet 	),
788531a0095SKent Overstreet 
7894b59a319SKent Overstreet 	TP_printk("%s %pS btree %u pos %llu:%llu:%u",
790669f87a5SKent Overstreet 		  __entry->trans_fn,
7914b59a319SKent Overstreet 		  (void *) __entry->caller_ip,
792531a0095SKent Overstreet 		  __entry->btree_id,
793531a0095SKent Overstreet 		  __entry->pos_inode,
794531a0095SKent Overstreet 		  __entry->pos_offset,
795531a0095SKent Overstreet 		  __entry->pos_snapshot)
796531a0095SKent Overstreet );
797531a0095SKent Overstreet 
798531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_btree_node_reused,
799669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
800531a0095SKent Overstreet 		 unsigned long caller_ip,
801531a0095SKent Overstreet 		 enum btree_id btree_id,
802531a0095SKent Overstreet 		 struct bpos *pos),
803669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
804531a0095SKent Overstreet );
805531a0095SKent Overstreet 
806531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_btree_node_split,
807669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
808531a0095SKent Overstreet 		 unsigned long caller_ip,
809531a0095SKent Overstreet 		 enum btree_id btree_id,
810531a0095SKent Overstreet 		 struct bpos *pos),
811669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
812531a0095SKent Overstreet );
813531a0095SKent Overstreet 
814531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_upgrade,
815669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
816531a0095SKent Overstreet 		 unsigned long caller_ip,
817531a0095SKent Overstreet 		 enum btree_id btree_id,
818531a0095SKent Overstreet 		 struct bpos *pos),
819669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
820531a0095SKent Overstreet );
821531a0095SKent Overstreet 
822531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_iter_upgrade,
823669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
824531a0095SKent Overstreet 		 unsigned long caller_ip,
825531a0095SKent Overstreet 		 enum btree_id btree_id,
826531a0095SKent Overstreet 		 struct bpos *pos),
827669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
828531a0095SKent Overstreet );
829531a0095SKent Overstreet 
830531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock,
831669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
832531a0095SKent Overstreet 		 unsigned long caller_ip,
833531a0095SKent Overstreet 		 enum btree_id btree_id,
834531a0095SKent Overstreet 		 struct bpos *pos),
835669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
836531a0095SKent Overstreet );
837531a0095SKent Overstreet 
838bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock_next_node,
839bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
840bc82d08bSKent Overstreet 		 unsigned long caller_ip,
841bc82d08bSKent Overstreet 		 enum btree_id btree_id,
842bc82d08bSKent Overstreet 		 struct bpos *pos),
843bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
844bc82d08bSKent Overstreet );
845bc82d08bSKent Overstreet 
846bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock_parent_for_fill,
847bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
848bc82d08bSKent Overstreet 		 unsigned long caller_ip,
849bc82d08bSKent Overstreet 		 enum btree_id btree_id,
850bc82d08bSKent Overstreet 		 struct bpos *pos),
851bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
852bc82d08bSKent Overstreet );
853bc82d08bSKent Overstreet 
854bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock_after_fill,
855bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
856bc82d08bSKent Overstreet 		 unsigned long caller_ip,
857bc82d08bSKent Overstreet 		 enum btree_id btree_id,
858bc82d08bSKent Overstreet 		 struct bpos *pos),
859bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
860bc82d08bSKent Overstreet );
861bc82d08bSKent Overstreet 
862bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock_key_cache_fill,
863bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
864bc82d08bSKent Overstreet 		 unsigned long caller_ip,
865bc82d08bSKent Overstreet 		 enum btree_id btree_id,
866bc82d08bSKent Overstreet 		 struct bpos *pos),
867bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
868bc82d08bSKent Overstreet );
869bc82d08bSKent Overstreet 
870bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock_path,
871bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
872bc82d08bSKent Overstreet 		 unsigned long caller_ip,
873bc82d08bSKent Overstreet 		 enum btree_id btree_id,
874bc82d08bSKent Overstreet 		 struct bpos *pos),
875bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
876bc82d08bSKent Overstreet );
877bc82d08bSKent Overstreet 
878bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_relock_path_intent,
879bc82d08bSKent Overstreet 	TP_PROTO(const char *trans_fn,
880bc82d08bSKent Overstreet 		 unsigned long caller_ip,
881bc82d08bSKent Overstreet 		 enum btree_id btree_id,
882bc82d08bSKent Overstreet 		 struct bpos *pos),
883bc82d08bSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
884bc82d08bSKent Overstreet );
885bc82d08bSKent Overstreet 
886531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_traverse,
887669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
888531a0095SKent Overstreet 		 unsigned long caller_ip,
889531a0095SKent Overstreet 		 enum btree_id btree_id,
890531a0095SKent Overstreet 		 struct bpos *pos),
891669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
892531a0095SKent Overstreet );
893531a0095SKent Overstreet 
8948f9ad91aSKent Overstreet DEFINE_EVENT(transaction_restart_iter,	trans_restart_memory_allocation_failure,
8958f9ad91aSKent Overstreet 	TP_PROTO(const char *trans_fn,
8968f9ad91aSKent Overstreet 		 unsigned long caller_ip,
8978f9ad91aSKent Overstreet 		 enum btree_id btree_id,
8988f9ad91aSKent Overstreet 		 struct bpos *pos),
8998f9ad91aSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos)
9008f9ad91aSKent Overstreet );
9018f9ad91aSKent Overstreet 
902a301dc38SKent Overstreet TRACE_EVENT(trans_restart_would_deadlock,
903669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
904a301dc38SKent Overstreet 		 unsigned long	caller_ip,
9052527dd91SKent Overstreet 		 bool		in_traverse_all,
906a301dc38SKent Overstreet 		 unsigned	reason,
907a301dc38SKent Overstreet 		 enum btree_id	have_btree_id,
908a301dc38SKent Overstreet 		 unsigned	have_iter_type,
9092527dd91SKent Overstreet 		 struct bpos	*have_pos,
910a301dc38SKent Overstreet 		 enum btree_id	want_btree_id,
9112527dd91SKent Overstreet 		 unsigned	want_iter_type,
9122527dd91SKent Overstreet 		 struct bpos	*want_pos),
913669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, in_traverse_all, reason,
9142527dd91SKent Overstreet 		have_btree_id, have_iter_type, have_pos,
9152527dd91SKent Overstreet 		want_btree_id, want_iter_type, want_pos),
916a301dc38SKent Overstreet 
917a301dc38SKent Overstreet 	TP_STRUCT__entry(
918669f87a5SKent Overstreet 		__array(char,			trans_fn, 24	)
919a301dc38SKent Overstreet 		__field(unsigned long,		caller_ip	)
9202527dd91SKent Overstreet 		__field(u8,			in_traverse_all	)
921a301dc38SKent Overstreet 		__field(u8,			reason		)
922a301dc38SKent Overstreet 		__field(u8,			have_btree_id	)
923a301dc38SKent Overstreet 		__field(u8,			have_iter_type	)
924a301dc38SKent Overstreet 		__field(u8,			want_btree_id	)
925a301dc38SKent Overstreet 		__field(u8,			want_iter_type	)
9262527dd91SKent Overstreet 
9272527dd91SKent Overstreet 		__field(u64,			have_pos_inode	)
9282527dd91SKent Overstreet 		__field(u64,			have_pos_offset	)
9292527dd91SKent Overstreet 		__field(u32,			have_pos_snapshot)
9302527dd91SKent Overstreet 		__field(u32,			want_pos_snapshot)
9312527dd91SKent Overstreet 		__field(u64,			want_pos_inode	)
9322527dd91SKent Overstreet 		__field(u64,			want_pos_offset	)
933a301dc38SKent Overstreet 	),
934a301dc38SKent Overstreet 
935a301dc38SKent Overstreet 	TP_fast_assign(
936669f87a5SKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
937a301dc38SKent Overstreet 		__entry->caller_ip		= caller_ip;
9382527dd91SKent Overstreet 		__entry->in_traverse_all	= in_traverse_all;
939a301dc38SKent Overstreet 		__entry->reason			= reason;
940a301dc38SKent Overstreet 		__entry->have_btree_id		= have_btree_id;
941a301dc38SKent Overstreet 		__entry->have_iter_type		= have_iter_type;
942a301dc38SKent Overstreet 		__entry->want_btree_id		= want_btree_id;
943a301dc38SKent Overstreet 		__entry->want_iter_type		= want_iter_type;
9442527dd91SKent Overstreet 
9452527dd91SKent Overstreet 		__entry->have_pos_inode		= have_pos->inode;
9462527dd91SKent Overstreet 		__entry->have_pos_offset	= have_pos->offset;
9472527dd91SKent Overstreet 		__entry->have_pos_snapshot	= have_pos->snapshot;
9482527dd91SKent Overstreet 
9492527dd91SKent Overstreet 		__entry->want_pos_inode		= want_pos->inode;
9502527dd91SKent Overstreet 		__entry->want_pos_offset	= want_pos->offset;
9512527dd91SKent Overstreet 		__entry->want_pos_snapshot	= want_pos->snapshot;
952a301dc38SKent Overstreet 	),
953a301dc38SKent Overstreet 
954669f87a5SKent Overstreet 	TP_printk("%s %pS traverse_all %u because %u have %u:%u %llu:%llu:%u want %u:%u %llu:%llu:%u",
955669f87a5SKent Overstreet 		  __entry->trans_fn,
956a301dc38SKent Overstreet 		  (void *) __entry->caller_ip,
9572527dd91SKent Overstreet 		  __entry->in_traverse_all,
958a301dc38SKent Overstreet 		  __entry->reason,
959a301dc38SKent Overstreet 		  __entry->have_btree_id,
960a301dc38SKent Overstreet 		  __entry->have_iter_type,
9612527dd91SKent Overstreet 		  __entry->have_pos_inode,
9622527dd91SKent Overstreet 		  __entry->have_pos_offset,
9632527dd91SKent Overstreet 		  __entry->have_pos_snapshot,
964a301dc38SKent Overstreet 		  __entry->want_btree_id,
9652527dd91SKent Overstreet 		  __entry->want_iter_type,
9662527dd91SKent Overstreet 		  __entry->want_pos_inode,
9672527dd91SKent Overstreet 		  __entry->want_pos_offset,
9682527dd91SKent Overstreet 		  __entry->want_pos_snapshot)
969ba5c6557SKent Overstreet );
970ba5c6557SKent Overstreet 
971caaa66aaSKent Overstreet TRACE_EVENT(trans_restart_would_deadlock_write,
972669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn),
973669f87a5SKent Overstreet 	TP_ARGS(trans_fn),
974caaa66aaSKent Overstreet 
975caaa66aaSKent Overstreet 	TP_STRUCT__entry(
976669f87a5SKent Overstreet 		__array(char,			trans_fn, 24	)
977caaa66aaSKent Overstreet 	),
978caaa66aaSKent Overstreet 
979caaa66aaSKent Overstreet 	TP_fast_assign(
980669f87a5SKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
981caaa66aaSKent Overstreet 	),
982caaa66aaSKent Overstreet 
983669f87a5SKent Overstreet 	TP_printk("%s", __entry->trans_fn)
984caaa66aaSKent Overstreet );
985caaa66aaSKent Overstreet 
98620bceecbSKent Overstreet TRACE_EVENT(trans_restart_mem_realloced,
987669f87a5SKent Overstreet 	TP_PROTO(const char *trans_fn,
988669f87a5SKent Overstreet 		 unsigned long caller_ip,
98973a117d2SKent Overstreet 		 unsigned long bytes),
990669f87a5SKent Overstreet 	TP_ARGS(trans_fn, caller_ip, bytes),
99120bceecbSKent Overstreet 
99220bceecbSKent Overstreet 	TP_STRUCT__entry(
993669f87a5SKent Overstreet 		__array(char,			trans_fn, 24	)
99473a117d2SKent Overstreet 		__field(unsigned long,		caller_ip	)
99520bceecbSKent Overstreet 		__field(unsigned long,		bytes		)
99620bceecbSKent Overstreet 	),
99720bceecbSKent Overstreet 
99820bceecbSKent Overstreet 	TP_fast_assign(
999669f87a5SKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
100073a117d2SKent Overstreet 		__entry->caller_ip	= caller_ip;
100120bceecbSKent Overstreet 		__entry->bytes		= bytes;
100220bceecbSKent Overstreet 	),
100320bceecbSKent Overstreet 
1004669f87a5SKent Overstreet 	TP_printk("%s %pS bytes %lu",
1005669f87a5SKent Overstreet 		  __entry->trans_fn,
100673a117d2SKent Overstreet 		  (void *) __entry->caller_ip,
100773a117d2SKent Overstreet 		  __entry->bytes)
1008ba5c6557SKent Overstreet );
1009ba5c6557SKent Overstreet 
10103a306f3cSKent Overstreet TRACE_EVENT(trans_restart_key_cache_key_realloced,
1011ddf11d8cSKent Overstreet 	TP_PROTO(const char *trans_fn,
1012ddf11d8cSKent Overstreet 		 unsigned long caller_ip,
1013ddf11d8cSKent Overstreet 		 enum btree_id btree_id,
10143a306f3cSKent Overstreet 		 struct bpos *pos,
10153a306f3cSKent Overstreet 		 unsigned old_u64s,
10163a306f3cSKent Overstreet 		 unsigned new_u64s),
10173a306f3cSKent Overstreet 	TP_ARGS(trans_fn, caller_ip, btree_id, pos, old_u64s, new_u64s),
10183a306f3cSKent Overstreet 
10193a306f3cSKent Overstreet 	TP_STRUCT__entry(
10203a306f3cSKent Overstreet 		__array(char,			trans_fn, 24	)
10213a306f3cSKent Overstreet 		__field(unsigned long,		caller_ip	)
10223a306f3cSKent Overstreet 		__field(enum btree_id,		btree_id	)
10233a306f3cSKent Overstreet 		__field(u64,			inode		)
10243a306f3cSKent Overstreet 		__field(u64,			offset		)
10253a306f3cSKent Overstreet 		__field(u32,			snapshot	)
10263a306f3cSKent Overstreet 		__field(u32,			old_u64s	)
10273a306f3cSKent Overstreet 		__field(u32,			new_u64s	)
10283a306f3cSKent Overstreet 	),
10293a306f3cSKent Overstreet 
10303a306f3cSKent Overstreet 	TP_fast_assign(
10313a306f3cSKent Overstreet 		strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
10323a306f3cSKent Overstreet 		__entry->caller_ip	= caller_ip;
10333a306f3cSKent Overstreet 		__entry->btree_id	= btree_id;
10343a306f3cSKent Overstreet 		__entry->inode		= pos->inode;
10353a306f3cSKent Overstreet 		__entry->offset		= pos->offset;
10363a306f3cSKent Overstreet 		__entry->snapshot	= pos->snapshot;
10373a306f3cSKent Overstreet 		__entry->old_u64s	= old_u64s;
10383a306f3cSKent Overstreet 		__entry->new_u64s	= new_u64s;
10393a306f3cSKent Overstreet 	),
10403a306f3cSKent Overstreet 
10413a306f3cSKent Overstreet 	TP_printk("%s %pS btree %s pos %llu:%llu:%u old_u64s %u new_u64s %u",
10423a306f3cSKent Overstreet 		  __entry->trans_fn,
10433a306f3cSKent Overstreet 		  (void *) __entry->caller_ip,
10443a306f3cSKent Overstreet 		  bch2_btree_ids[__entry->btree_id],
10453a306f3cSKent Overstreet 		  __entry->inode,
10463a306f3cSKent Overstreet 		  __entry->offset,
10473a306f3cSKent Overstreet 		  __entry->snapshot,
10483a306f3cSKent Overstreet 		  __entry->old_u64s,
10493a306f3cSKent Overstreet 		  __entry->new_u64s)
1050ddf11d8cSKent Overstreet );
1051ddf11d8cSKent Overstreet 
10521c6fdbd8SKent Overstreet #endif /* _TRACE_BCACHEFS_H */
10531c6fdbd8SKent Overstreet 
10541c6fdbd8SKent Overstreet /* This part must be outside protection */
10551c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_PATH
10561c6fdbd8SKent Overstreet #define TRACE_INCLUDE_PATH ../../fs/bcachefs
10571c6fdbd8SKent Overstreet 
10581c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_FILE
10591c6fdbd8SKent Overstreet #define TRACE_INCLUDE_FILE trace
10601c6fdbd8SKent Overstreet 
10611c6fdbd8SKent Overstreet #include <trace/define_trace.h>
1062