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 109f96568cSKent Overstreet #define TRACE_BPOS_entries(name) \ 119f96568cSKent Overstreet __field(u64, name##_inode ) \ 129f96568cSKent Overstreet __field(u64, name##_offset ) \ 139f96568cSKent Overstreet __field(u32, name##_snapshot ) 149f96568cSKent Overstreet 159f96568cSKent Overstreet #define TRACE_BPOS_assign(dst, src) \ 169f96568cSKent Overstreet __entry->dst##_inode = (src).inode; \ 179f96568cSKent Overstreet __entry->dst##_offset = (src).offset; \ 189f96568cSKent Overstreet __entry->dst##_snapshot = (src).snapshot 199f96568cSKent Overstreet 201c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bpos, 2112043cf1SKent Overstreet TP_PROTO(const struct bpos *p), 221c6fdbd8SKent Overstreet TP_ARGS(p), 231c6fdbd8SKent Overstreet 241c6fdbd8SKent Overstreet TP_STRUCT__entry( 259f96568cSKent Overstreet TRACE_BPOS_entries(p) 261c6fdbd8SKent Overstreet ), 271c6fdbd8SKent Overstreet 281c6fdbd8SKent Overstreet TP_fast_assign( 299f96568cSKent Overstreet TRACE_BPOS_assign(p, *p); 301c6fdbd8SKent Overstreet ), 311c6fdbd8SKent Overstreet 329f96568cSKent Overstreet TP_printk("%llu:%llu:%u", __entry->p_inode, __entry->p_offset, __entry->p_snapshot) 331c6fdbd8SKent Overstreet ); 341c6fdbd8SKent Overstreet 351c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bkey, 361c6fdbd8SKent Overstreet TP_PROTO(const struct bkey *k), 371c6fdbd8SKent Overstreet TP_ARGS(k), 381c6fdbd8SKent Overstreet 391c6fdbd8SKent Overstreet TP_STRUCT__entry( 401c6fdbd8SKent Overstreet __field(u64, inode ) 411c6fdbd8SKent Overstreet __field(u64, offset ) 421c6fdbd8SKent Overstreet __field(u32, size ) 431c6fdbd8SKent Overstreet ), 441c6fdbd8SKent Overstreet 451c6fdbd8SKent Overstreet TP_fast_assign( 461c6fdbd8SKent Overstreet __entry->inode = k->p.inode; 471c6fdbd8SKent Overstreet __entry->offset = k->p.offset; 481c6fdbd8SKent Overstreet __entry->size = k->size; 491c6fdbd8SKent Overstreet ), 501c6fdbd8SKent Overstreet 511c6fdbd8SKent Overstreet TP_printk("%llu:%llu len %u", __entry->inode, 521c6fdbd8SKent Overstreet __entry->offset, __entry->size) 531c6fdbd8SKent Overstreet ); 541c6fdbd8SKent Overstreet 55674cfc26SKent Overstreet DECLARE_EVENT_CLASS(btree_node, 56674cfc26SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 57674cfc26SKent Overstreet TP_ARGS(c, b), 58674cfc26SKent Overstreet 59674cfc26SKent Overstreet TP_STRUCT__entry( 60674cfc26SKent Overstreet __field(dev_t, dev ) 61674cfc26SKent Overstreet __field(u8, level ) 62674cfc26SKent Overstreet __field(u8, btree_id ) 63674cfc26SKent Overstreet TRACE_BPOS_entries(pos) 64674cfc26SKent Overstreet ), 65674cfc26SKent Overstreet 66674cfc26SKent Overstreet TP_fast_assign( 67674cfc26SKent Overstreet __entry->dev = c->dev; 68674cfc26SKent Overstreet __entry->level = b->c.level; 69674cfc26SKent Overstreet __entry->btree_id = b->c.btree_id; 70674cfc26SKent Overstreet TRACE_BPOS_assign(pos, b->key.k.p); 71674cfc26SKent Overstreet ), 72674cfc26SKent Overstreet 73674cfc26SKent Overstreet TP_printk("%d,%d %u %s %llu:%llu:%u", 74674cfc26SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 75674cfc26SKent Overstreet __entry->level, 76674cfc26SKent Overstreet bch2_btree_ids[__entry->btree_id], 77674cfc26SKent Overstreet __entry->pos_inode, __entry->pos_offset, __entry->pos_snapshot) 78674cfc26SKent Overstreet ); 79674cfc26SKent Overstreet 801c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bch_fs, 811c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c), 821c6fdbd8SKent Overstreet TP_ARGS(c), 831c6fdbd8SKent Overstreet 841c6fdbd8SKent Overstreet TP_STRUCT__entry( 85ddc7dd62SKent Overstreet __field(dev_t, dev ) 861c6fdbd8SKent Overstreet ), 871c6fdbd8SKent Overstreet 881c6fdbd8SKent Overstreet TP_fast_assign( 89ddc7dd62SKent Overstreet __entry->dev = c->dev; 901c6fdbd8SKent Overstreet ), 911c6fdbd8SKent Overstreet 92ddc7dd62SKent Overstreet TP_printk("%d,%d", MAJOR(__entry->dev), MINOR(__entry->dev)) 931c6fdbd8SKent Overstreet ); 941c6fdbd8SKent Overstreet 951c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bio, 961c6fdbd8SKent Overstreet TP_PROTO(struct bio *bio), 971c6fdbd8SKent Overstreet TP_ARGS(bio), 981c6fdbd8SKent Overstreet 991c6fdbd8SKent Overstreet TP_STRUCT__entry( 1001c6fdbd8SKent Overstreet __field(dev_t, dev ) 1011c6fdbd8SKent Overstreet __field(sector_t, sector ) 1021c6fdbd8SKent Overstreet __field(unsigned int, nr_sector ) 1031c6fdbd8SKent Overstreet __array(char, rwbs, 6 ) 1041c6fdbd8SKent Overstreet ), 1051c6fdbd8SKent Overstreet 1061c6fdbd8SKent Overstreet TP_fast_assign( 1071c6fdbd8SKent Overstreet __entry->dev = bio->bi_bdev ? bio_dev(bio) : 0; 1081c6fdbd8SKent Overstreet __entry->sector = bio->bi_iter.bi_sector; 1091c6fdbd8SKent Overstreet __entry->nr_sector = bio->bi_iter.bi_size >> 9; 1101c6fdbd8SKent Overstreet blk_fill_rwbs(__entry->rwbs, bio->bi_opf); 1111c6fdbd8SKent Overstreet ), 1121c6fdbd8SKent Overstreet 1131c6fdbd8SKent Overstreet TP_printk("%d,%d %s %llu + %u", 1141c6fdbd8SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs, 1151c6fdbd8SKent Overstreet (unsigned long long)__entry->sector, __entry->nr_sector) 1161c6fdbd8SKent Overstreet ); 1171c6fdbd8SKent Overstreet 1184254f5bfSKent Overstreet /* super-io.c: */ 1194254f5bfSKent Overstreet TRACE_EVENT(write_super, 1204254f5bfSKent Overstreet TP_PROTO(struct bch_fs *c, unsigned long ip), 1214254f5bfSKent Overstreet TP_ARGS(c, ip), 1224254f5bfSKent Overstreet 1234254f5bfSKent Overstreet TP_STRUCT__entry( 1244254f5bfSKent Overstreet __field(dev_t, dev ) 1254254f5bfSKent Overstreet __field(unsigned long, ip ) 1264254f5bfSKent Overstreet ), 1274254f5bfSKent Overstreet 1284254f5bfSKent Overstreet TP_fast_assign( 1294254f5bfSKent Overstreet __entry->dev = c->dev; 1304254f5bfSKent Overstreet __entry->ip = ip; 1314254f5bfSKent Overstreet ), 1324254f5bfSKent Overstreet 1334254f5bfSKent Overstreet TP_printk("%d,%d for %pS", 1344254f5bfSKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 1354254f5bfSKent Overstreet (void *) __entry->ip) 1364254f5bfSKent Overstreet ); 1374254f5bfSKent Overstreet 1381c6fdbd8SKent Overstreet /* io.c: */ 1391c6fdbd8SKent Overstreet 140674cfc26SKent Overstreet DEFINE_EVENT(bio, read_promote, 1411c6fdbd8SKent Overstreet TP_PROTO(struct bio *bio), 1421c6fdbd8SKent Overstreet TP_ARGS(bio) 1431c6fdbd8SKent Overstreet ); 1441c6fdbd8SKent Overstreet 1451c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_bounce, 1461c6fdbd8SKent Overstreet TP_PROTO(struct bio *bio), 1471c6fdbd8SKent Overstreet TP_ARGS(bio) 1481c6fdbd8SKent Overstreet ); 1491c6fdbd8SKent Overstreet 150674cfc26SKent Overstreet DEFINE_EVENT(bio, read_split, 151674cfc26SKent Overstreet TP_PROTO(struct bio *bio), 152674cfc26SKent Overstreet TP_ARGS(bio) 153674cfc26SKent Overstreet ); 154674cfc26SKent Overstreet 1551c6fdbd8SKent Overstreet DEFINE_EVENT(bio, read_retry, 1561c6fdbd8SKent Overstreet TP_PROTO(struct bio *bio), 1571c6fdbd8SKent Overstreet TP_ARGS(bio) 1581c6fdbd8SKent Overstreet ); 1591c6fdbd8SKent Overstreet 160674cfc26SKent Overstreet DEFINE_EVENT(bio, read_reuse_race, 1611c6fdbd8SKent Overstreet TP_PROTO(struct bio *bio), 1621c6fdbd8SKent Overstreet TP_ARGS(bio) 1631c6fdbd8SKent Overstreet ); 1641c6fdbd8SKent Overstreet 1651c6fdbd8SKent Overstreet /* Journal */ 1661c6fdbd8SKent Overstreet 1671c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, journal_full, 1681c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c), 1691c6fdbd8SKent Overstreet TP_ARGS(c) 1701c6fdbd8SKent Overstreet ); 1711c6fdbd8SKent Overstreet 1721c6fdbd8SKent Overstreet DEFINE_EVENT(bch_fs, journal_entry_full, 1731c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c), 1741c6fdbd8SKent Overstreet TP_ARGS(c) 1751c6fdbd8SKent Overstreet ); 1761c6fdbd8SKent Overstreet 1771c6fdbd8SKent Overstreet DEFINE_EVENT(bio, journal_write, 1781c6fdbd8SKent Overstreet TP_PROTO(struct bio *bio), 1791c6fdbd8SKent Overstreet TP_ARGS(bio) 1801c6fdbd8SKent Overstreet ); 1811c6fdbd8SKent Overstreet 1828a92e545SKent Overstreet TRACE_EVENT(journal_reclaim_start, 1831f93726eSKent Overstreet TP_PROTO(struct bch_fs *c, bool direct, bool kicked, 1841f93726eSKent Overstreet u64 min_nr, u64 min_key_cache, 1858a92e545SKent Overstreet u64 prereserved, u64 prereserved_total, 1868a92e545SKent Overstreet u64 btree_cache_dirty, u64 btree_cache_total, 1878a92e545SKent Overstreet u64 btree_key_cache_dirty, u64 btree_key_cache_total), 1881f93726eSKent Overstreet TP_ARGS(c, direct, kicked, min_nr, min_key_cache, prereserved, prereserved_total, 1898a92e545SKent Overstreet btree_cache_dirty, btree_cache_total, 1908a92e545SKent Overstreet btree_key_cache_dirty, btree_key_cache_total), 1918a92e545SKent Overstreet 1928a92e545SKent Overstreet TP_STRUCT__entry( 193ddc7dd62SKent Overstreet __field(dev_t, dev ) 1941f93726eSKent Overstreet __field(bool, direct ) 1951f93726eSKent Overstreet __field(bool, kicked ) 1968a92e545SKent Overstreet __field(u64, min_nr ) 1971f93726eSKent Overstreet __field(u64, min_key_cache ) 1988a92e545SKent Overstreet __field(u64, prereserved ) 1998a92e545SKent Overstreet __field(u64, prereserved_total ) 2008a92e545SKent Overstreet __field(u64, btree_cache_dirty ) 2018a92e545SKent Overstreet __field(u64, btree_cache_total ) 2028a92e545SKent Overstreet __field(u64, btree_key_cache_dirty ) 2038a92e545SKent Overstreet __field(u64, btree_key_cache_total ) 2048a92e545SKent Overstreet ), 2058a92e545SKent Overstreet 2068a92e545SKent Overstreet TP_fast_assign( 207ddc7dd62SKent Overstreet __entry->dev = c->dev; 2081f93726eSKent Overstreet __entry->direct = direct; 2091f93726eSKent Overstreet __entry->kicked = kicked; 2108a92e545SKent Overstreet __entry->min_nr = min_nr; 2111f93726eSKent Overstreet __entry->min_key_cache = min_key_cache; 2128a92e545SKent Overstreet __entry->prereserved = prereserved; 2138a92e545SKent Overstreet __entry->prereserved_total = prereserved_total; 2148a92e545SKent Overstreet __entry->btree_cache_dirty = btree_cache_dirty; 2158a92e545SKent Overstreet __entry->btree_cache_total = btree_cache_total; 2168a92e545SKent Overstreet __entry->btree_key_cache_dirty = btree_key_cache_dirty; 2178a92e545SKent Overstreet __entry->btree_key_cache_total = btree_key_cache_total; 2188a92e545SKent Overstreet ), 2198a92e545SKent Overstreet 2201f93726eSKent 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", 221ddc7dd62SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 2221f93726eSKent Overstreet __entry->direct, 2231f93726eSKent Overstreet __entry->kicked, 2248a92e545SKent Overstreet __entry->min_nr, 2251f93726eSKent Overstreet __entry->min_key_cache, 2268a92e545SKent Overstreet __entry->prereserved, 2278a92e545SKent Overstreet __entry->prereserved_total, 2288a92e545SKent Overstreet __entry->btree_cache_dirty, 2298a92e545SKent Overstreet __entry->btree_cache_total, 2308a92e545SKent Overstreet __entry->btree_key_cache_dirty, 2318a92e545SKent Overstreet __entry->btree_key_cache_total) 2328a92e545SKent Overstreet ); 2338a92e545SKent Overstreet 2348a92e545SKent Overstreet TRACE_EVENT(journal_reclaim_finish, 2358a92e545SKent Overstreet TP_PROTO(struct bch_fs *c, u64 nr_flushed), 2368a92e545SKent Overstreet TP_ARGS(c, nr_flushed), 2378a92e545SKent Overstreet 2388a92e545SKent Overstreet TP_STRUCT__entry( 239ddc7dd62SKent Overstreet __field(dev_t, dev ) 2408a92e545SKent Overstreet __field(u64, nr_flushed ) 2418a92e545SKent Overstreet ), 2428a92e545SKent Overstreet 2438a92e545SKent Overstreet TP_fast_assign( 244ddc7dd62SKent Overstreet __entry->dev = c->dev; 2458a92e545SKent Overstreet __entry->nr_flushed = nr_flushed; 2468a92e545SKent Overstreet ), 2478a92e545SKent Overstreet 2481f93726eSKent Overstreet TP_printk("%d,%d flushed %llu", 249ddc7dd62SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 250ddc7dd62SKent Overstreet __entry->nr_flushed) 2518a92e545SKent Overstreet ); 2528a92e545SKent Overstreet 2531c6fdbd8SKent Overstreet /* bset.c: */ 2541c6fdbd8SKent Overstreet 2551c6fdbd8SKent Overstreet DEFINE_EVENT(bpos, bkey_pack_pos_fail, 25612043cf1SKent Overstreet TP_PROTO(const struct bpos *p), 2571c6fdbd8SKent Overstreet TP_ARGS(p) 2581c6fdbd8SKent Overstreet ); 2591c6fdbd8SKent Overstreet 260674cfc26SKent Overstreet /* Btree cache: */ 2611c6fdbd8SKent Overstreet 262674cfc26SKent Overstreet TRACE_EVENT(btree_cache_scan, 263674cfc26SKent Overstreet TP_PROTO(long nr_to_scan, long can_free, long ret), 264674cfc26SKent Overstreet TP_ARGS(nr_to_scan, can_free, ret), 2651c6fdbd8SKent Overstreet 2661c6fdbd8SKent Overstreet TP_STRUCT__entry( 267674cfc26SKent Overstreet __field(long, nr_to_scan ) 268674cfc26SKent Overstreet __field(long, can_free ) 269674cfc26SKent Overstreet __field(long, ret ) 2701c6fdbd8SKent Overstreet ), 2711c6fdbd8SKent Overstreet 2721c6fdbd8SKent Overstreet TP_fast_assign( 273674cfc26SKent Overstreet __entry->nr_to_scan = nr_to_scan; 274674cfc26SKent Overstreet __entry->can_free = can_free; 275674cfc26SKent Overstreet __entry->ret = ret; 2761c6fdbd8SKent Overstreet ), 2771c6fdbd8SKent Overstreet 278674cfc26SKent Overstreet TP_printk("scanned for %li nodes, can free %li, ret %li", 279674cfc26SKent Overstreet __entry->nr_to_scan, __entry->can_free, __entry->ret) 2801c6fdbd8SKent Overstreet ); 2811c6fdbd8SKent Overstreet 282674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_cache_reap, 2831c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 2841c6fdbd8SKent Overstreet TP_ARGS(c, b) 2851c6fdbd8SKent Overstreet ); 2861c6fdbd8SKent Overstreet 287674cfc26SKent Overstreet DEFINE_EVENT(bch_fs, btree_cache_cannibalize_lock_fail, 288674cfc26SKent Overstreet TP_PROTO(struct bch_fs *c), 289674cfc26SKent Overstreet TP_ARGS(c) 290674cfc26SKent Overstreet ); 291674cfc26SKent Overstreet 292674cfc26SKent Overstreet DEFINE_EVENT(bch_fs, btree_cache_cannibalize_lock, 293674cfc26SKent Overstreet TP_PROTO(struct bch_fs *c), 294674cfc26SKent Overstreet TP_ARGS(c) 295674cfc26SKent Overstreet ); 296674cfc26SKent Overstreet 297674cfc26SKent Overstreet DEFINE_EVENT(bch_fs, btree_cache_cannibalize, 298674cfc26SKent Overstreet TP_PROTO(struct bch_fs *c), 299674cfc26SKent Overstreet TP_ARGS(c) 300674cfc26SKent Overstreet ); 301674cfc26SKent Overstreet 302674cfc26SKent Overstreet DEFINE_EVENT(bch_fs, btree_cache_cannibalize_unlock, 303674cfc26SKent Overstreet TP_PROTO(struct bch_fs *c), 304674cfc26SKent Overstreet TP_ARGS(c) 305674cfc26SKent Overstreet ); 306674cfc26SKent Overstreet 307674cfc26SKent Overstreet /* Btree */ 308674cfc26SKent Overstreet 309674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_node_read, 310674cfc26SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 311674cfc26SKent Overstreet TP_ARGS(c, b) 312674cfc26SKent Overstreet ); 313674cfc26SKent Overstreet 314674cfc26SKent Overstreet TRACE_EVENT(btree_node_write, 3151c6fdbd8SKent Overstreet TP_PROTO(struct btree *b, unsigned bytes, unsigned sectors), 3161c6fdbd8SKent Overstreet TP_ARGS(b, bytes, sectors), 3171c6fdbd8SKent Overstreet 3181c6fdbd8SKent Overstreet TP_STRUCT__entry( 31926609b61SKent Overstreet __field(enum btree_node_type, type) 3201c6fdbd8SKent Overstreet __field(unsigned, bytes ) 3211c6fdbd8SKent Overstreet __field(unsigned, sectors ) 3221c6fdbd8SKent Overstreet ), 3231c6fdbd8SKent Overstreet 3241c6fdbd8SKent Overstreet TP_fast_assign( 3251c6fdbd8SKent Overstreet __entry->type = btree_node_type(b); 3261c6fdbd8SKent Overstreet __entry->bytes = bytes; 3271c6fdbd8SKent Overstreet __entry->sectors = sectors; 3281c6fdbd8SKent Overstreet ), 3291c6fdbd8SKent Overstreet 3301c6fdbd8SKent Overstreet TP_printk("bkey type %u bytes %u sectors %u", 3311c6fdbd8SKent Overstreet __entry->type , __entry->bytes, __entry->sectors) 3321c6fdbd8SKent Overstreet ); 3331c6fdbd8SKent Overstreet 3341c6fdbd8SKent Overstreet DEFINE_EVENT(btree_node, btree_node_alloc, 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_node_free, 3401c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 3411c6fdbd8SKent Overstreet TP_ARGS(c, b) 3421c6fdbd8SKent Overstreet ); 3431c6fdbd8SKent Overstreet 3441c6fdbd8SKent Overstreet TRACE_EVENT(btree_reserve_get_fail, 3455f417394SKent Overstreet TP_PROTO(const char *trans_fn, 3465f417394SKent Overstreet unsigned long caller_ip, 347adf6360bSKent Overstreet size_t required, 348adf6360bSKent Overstreet int ret), 349adf6360bSKent Overstreet TP_ARGS(trans_fn, caller_ip, required, ret), 3501c6fdbd8SKent Overstreet 3511c6fdbd8SKent Overstreet TP_STRUCT__entry( 3525f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 3535f417394SKent Overstreet __field(unsigned long, caller_ip ) 3541c6fdbd8SKent Overstreet __field(size_t, required ) 355adf6360bSKent Overstreet __array(char, ret, 32 ) 3561c6fdbd8SKent Overstreet ), 3571c6fdbd8SKent Overstreet 3581c6fdbd8SKent Overstreet TP_fast_assign( 359a1019576SKent Overstreet strscpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn)); 3605f417394SKent Overstreet __entry->caller_ip = caller_ip; 3611c6fdbd8SKent Overstreet __entry->required = required; 362adf6360bSKent Overstreet strscpy(__entry->ret, bch2_err_str(ret), sizeof(__entry->ret)); 3631c6fdbd8SKent Overstreet ), 3641c6fdbd8SKent Overstreet 365adf6360bSKent Overstreet TP_printk("%s %pS required %zu ret %s", 3665f417394SKent Overstreet __entry->trans_fn, 3675f417394SKent Overstreet (void *) __entry->caller_ip, 368adf6360bSKent Overstreet __entry->required, 369adf6360bSKent Overstreet __entry->ret) 3701c6fdbd8SKent Overstreet ); 3711c6fdbd8SKent Overstreet 372674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_node_compact, 3731c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 3741c6fdbd8SKent Overstreet TP_ARGS(c, b) 3751c6fdbd8SKent Overstreet ); 3761c6fdbd8SKent Overstreet 377674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_node_merge, 3781c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 3791c6fdbd8SKent Overstreet TP_ARGS(c, b) 3801c6fdbd8SKent Overstreet ); 3811c6fdbd8SKent Overstreet 382674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_node_split, 3831c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 3841c6fdbd8SKent Overstreet TP_ARGS(c, b) 3851c6fdbd8SKent Overstreet ); 3861c6fdbd8SKent Overstreet 387674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_node_rewrite, 3881f93726eSKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 3891f93726eSKent Overstreet TP_ARGS(c, b) 3901f93726eSKent Overstreet ); 3911f93726eSKent Overstreet 392674cfc26SKent Overstreet DEFINE_EVENT(btree_node, btree_node_set_root, 3931c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, struct btree *b), 3941c6fdbd8SKent Overstreet TP_ARGS(c, b) 3951c6fdbd8SKent Overstreet ); 3961c6fdbd8SKent Overstreet 397674cfc26SKent Overstreet TRACE_EVENT(btree_path_relock_fail, 3989f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 399bc82d08bSKent Overstreet unsigned long caller_ip, 4009f96568cSKent Overstreet struct btree_path *path, 4019f96568cSKent Overstreet unsigned level), 4029f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path, level), 403bc82d08bSKent Overstreet 404bc82d08bSKent Overstreet TP_STRUCT__entry( 4055f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 4064b59a319SKent Overstreet __field(unsigned long, caller_ip ) 407bc82d08bSKent Overstreet __field(u8, btree_id ) 408367d72ddSKent Overstreet __field(u8, level ) 4099f96568cSKent Overstreet TRACE_BPOS_entries(pos) 4105f1dd9a6SKent Overstreet __array(char, node, 24 ) 411bc82d08bSKent Overstreet __field(u32, iter_lock_seq ) 412bc82d08bSKent Overstreet __field(u32, node_lock_seq ) 413bc82d08bSKent Overstreet ), 414bc82d08bSKent Overstreet 415bc82d08bSKent Overstreet TP_fast_assign( 4165f1dd9a6SKent Overstreet struct btree *b = btree_path_node(path, level); 4175f1dd9a6SKent Overstreet 418a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 4194b59a319SKent Overstreet __entry->caller_ip = caller_ip; 4209f96568cSKent Overstreet __entry->btree_id = path->btree_id; 421367d72ddSKent Overstreet __entry->level = path->level; 4229f96568cSKent Overstreet TRACE_BPOS_assign(pos, path->pos); 4235f1dd9a6SKent Overstreet if (IS_ERR(b)) 4245f1dd9a6SKent Overstreet strscpy(__entry->node, bch2_err_str(PTR_ERR(b)), sizeof(__entry->node)); 4255f1dd9a6SKent Overstreet else 4265f1dd9a6SKent Overstreet scnprintf(__entry->node, sizeof(__entry->node), "%px", b); 4279f96568cSKent Overstreet __entry->iter_lock_seq = path->l[level].lock_seq; 4289f96568cSKent Overstreet __entry->node_lock_seq = is_btree_node(path, level) ? path->l[level].b->c.lock.state.seq : 0; 429bc82d08bSKent Overstreet ), 430bc82d08bSKent Overstreet 431367d72ddSKent Overstreet TP_printk("%s %pS btree %s pos %llu:%llu:%u level %u node %s iter seq %u lock seq %u", 432bc82d08bSKent Overstreet __entry->trans_fn, 4334b59a319SKent Overstreet (void *) __entry->caller_ip, 4349f96568cSKent Overstreet bch2_btree_ids[__entry->btree_id], 435bc82d08bSKent Overstreet __entry->pos_inode, 436bc82d08bSKent Overstreet __entry->pos_offset, 437bc82d08bSKent Overstreet __entry->pos_snapshot, 438367d72ddSKent Overstreet __entry->level, 439bc82d08bSKent Overstreet __entry->node, 440bc82d08bSKent Overstreet __entry->iter_lock_seq, 441bc82d08bSKent Overstreet __entry->node_lock_seq) 442bc82d08bSKent Overstreet ); 443bc82d08bSKent Overstreet 444674cfc26SKent Overstreet TRACE_EVENT(btree_path_upgrade_fail, 4459f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 44649e401faSKent Overstreet unsigned long caller_ip, 4479f96568cSKent Overstreet struct btree_path *path, 4489f96568cSKent Overstreet unsigned level), 4499f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path, level), 45049e401faSKent Overstreet 45149e401faSKent Overstreet TP_STRUCT__entry( 4525f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 45349e401faSKent Overstreet __field(unsigned long, caller_ip ) 45449e401faSKent Overstreet __field(u8, btree_id ) 455367d72ddSKent Overstreet __field(u8, level ) 4569f96568cSKent Overstreet TRACE_BPOS_entries(pos) 45749e401faSKent Overstreet __field(u8, locked ) 45849e401faSKent Overstreet __field(u8, self_read_count ) 45949e401faSKent Overstreet __field(u8, self_intent_count) 4609f96568cSKent Overstreet __field(u8, read_count ) 46149e401faSKent Overstreet __field(u8, intent_count ) 462367d72ddSKent Overstreet __field(u32, iter_lock_seq ) 463367d72ddSKent Overstreet __field(u32, node_lock_seq ) 46449e401faSKent Overstreet ), 46549e401faSKent Overstreet 46649e401faSKent Overstreet TP_fast_assign( 4679f96568cSKent Overstreet struct six_lock_count c; 4689f96568cSKent Overstreet 469a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 47049e401faSKent Overstreet __entry->caller_ip = caller_ip; 4719f96568cSKent Overstreet __entry->btree_id = path->btree_id; 472367d72ddSKent Overstreet __entry->level = level; 4739f96568cSKent Overstreet TRACE_BPOS_assign(pos, path->pos); 4749f96568cSKent Overstreet __entry->locked = btree_node_locked(path, level); 4759f96568cSKent Overstreet 47614599cceSKent Overstreet c = bch2_btree_node_lock_counts(trans, NULL, &path->l[level].b->c, level), 477e3738c69SKent Overstreet __entry->self_read_count = c.n[SIX_LOCK_read]; 478e3738c69SKent Overstreet __entry->self_intent_count = c.n[SIX_LOCK_intent]; 4799f96568cSKent Overstreet c = six_lock_counts(&path->l[level].b->c.lock); 480e3738c69SKent Overstreet __entry->read_count = c.n[SIX_LOCK_read]; 481e3738c69SKent Overstreet __entry->intent_count = c.n[SIX_LOCK_read]; 482367d72ddSKent Overstreet __entry->iter_lock_seq = path->l[level].lock_seq; 483367d72ddSKent Overstreet __entry->node_lock_seq = is_btree_node(path, level) ? path->l[level].b->c.lock.state.seq : 0; 48449e401faSKent Overstreet ), 48549e401faSKent Overstreet 486367d72ddSKent Overstreet TP_printk("%s %pS btree %s pos %llu:%llu:%u level %u locked %u held %u:%u lock count %u:%u iter seq %u lock seq %u", 48749e401faSKent Overstreet __entry->trans_fn, 48849e401faSKent Overstreet (void *) __entry->caller_ip, 4899f96568cSKent Overstreet bch2_btree_ids[__entry->btree_id], 49049e401faSKent Overstreet __entry->pos_inode, 49149e401faSKent Overstreet __entry->pos_offset, 49249e401faSKent Overstreet __entry->pos_snapshot, 493367d72ddSKent Overstreet __entry->level, 49449e401faSKent Overstreet __entry->locked, 49549e401faSKent Overstreet __entry->self_read_count, 49649e401faSKent Overstreet __entry->self_intent_count, 49749e401faSKent Overstreet __entry->read_count, 498367d72ddSKent Overstreet __entry->intent_count, 499367d72ddSKent Overstreet __entry->iter_lock_seq, 500367d72ddSKent Overstreet __entry->node_lock_seq) 50149e401faSKent Overstreet ); 50249e401faSKent Overstreet 5031c6fdbd8SKent Overstreet /* Garbage collection */ 5041c6fdbd8SKent Overstreet 5051f93726eSKent Overstreet DEFINE_EVENT(bch_fs, gc_gens_start, 5061c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c), 5071c6fdbd8SKent Overstreet TP_ARGS(c) 5081c6fdbd8SKent Overstreet ); 5091c6fdbd8SKent Overstreet 5101f93726eSKent Overstreet DEFINE_EVENT(bch_fs, gc_gens_end, 5111c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c), 5121c6fdbd8SKent Overstreet TP_ARGS(c) 5131c6fdbd8SKent Overstreet ); 5141c6fdbd8SKent Overstreet 5151c6fdbd8SKent Overstreet /* Allocator */ 5161c6fdbd8SKent Overstreet 5171c6fdbd8SKent Overstreet DECLARE_EVENT_CLASS(bucket_alloc, 518f25d8215SKent Overstreet TP_PROTO(struct bch_dev *ca, const char *alloc_reserve, 51968b6cd19SKent Overstreet bool user, 52068b6cd19SKent Overstreet u64 bucket, 5218ef98313SKent Overstreet u64 free, 522f25d8215SKent Overstreet u64 avail, 5238ef98313SKent Overstreet u64 copygc_wait_amount, 5248ef98313SKent Overstreet s64 copygc_waiting_for, 525ae10fe01SKent Overstreet struct bucket_alloc_state *s, 526f25d8215SKent Overstreet bool nonblocking, 527615f867cSKent Overstreet const char *err), 52868b6cd19SKent Overstreet TP_ARGS(ca, alloc_reserve, user, bucket, free, avail, 52968b6cd19SKent Overstreet copygc_wait_amount, copygc_waiting_for, 530ae10fe01SKent Overstreet s, nonblocking, err), 5311c6fdbd8SKent Overstreet 5321c6fdbd8SKent Overstreet TP_STRUCT__entry( 533*1a14e255SKent Overstreet __field(u8, dev ) 5343e154711SKent Overstreet __array(char, reserve, 16 ) 53568b6cd19SKent Overstreet __field(bool, user ) 53668b6cd19SKent Overstreet __field(u64, bucket ) 5378ef98313SKent Overstreet __field(u64, free ) 538f25d8215SKent Overstreet __field(u64, avail ) 5398ef98313SKent Overstreet __field(u64, copygc_wait_amount ) 5408ef98313SKent Overstreet __field(s64, copygc_waiting_for ) 541f25d8215SKent Overstreet __field(u64, seen ) 542f25d8215SKent Overstreet __field(u64, open ) 543f25d8215SKent Overstreet __field(u64, need_journal_commit ) 544f25d8215SKent Overstreet __field(u64, nouse ) 545f25d8215SKent Overstreet __field(bool, nonblocking ) 546a8b3a677SKent Overstreet __field(u64, nocow ) 54768b6cd19SKent Overstreet __array(char, err, 32 ) 5481c6fdbd8SKent Overstreet ), 5491c6fdbd8SKent Overstreet 5501c6fdbd8SKent Overstreet TP_fast_assign( 551*1a14e255SKent Overstreet __entry->dev = ca->dev_idx; 552a1019576SKent Overstreet strscpy(__entry->reserve, alloc_reserve, sizeof(__entry->reserve)); 55368b6cd19SKent Overstreet __entry->user = user; 55468b6cd19SKent Overstreet __entry->bucket = bucket; 5558ef98313SKent Overstreet __entry->free = free; 556f25d8215SKent Overstreet __entry->avail = avail; 5578ef98313SKent Overstreet __entry->copygc_wait_amount = copygc_wait_amount; 5588ef98313SKent Overstreet __entry->copygc_waiting_for = copygc_waiting_for; 559ae10fe01SKent Overstreet __entry->seen = s->buckets_seen; 560ae10fe01SKent Overstreet __entry->open = s->skipped_open; 561ae10fe01SKent Overstreet __entry->need_journal_commit = s->skipped_need_journal_commit; 562ae10fe01SKent Overstreet __entry->nouse = s->skipped_nouse; 563f25d8215SKent Overstreet __entry->nonblocking = nonblocking; 564a8b3a677SKent Overstreet __entry->nocow = s->skipped_nocow; 565a1019576SKent Overstreet strscpy(__entry->err, err, sizeof(__entry->err)); 5661c6fdbd8SKent Overstreet ), 5671c6fdbd8SKent Overstreet 568*1a14e255SKent Overstreet TP_printk("reserve %s user %u bucket %u:%llu free %llu avail %llu copygc_wait %llu/%lli seen %llu open %llu need_journal_commit %llu nouse %llu nocow %llu nonblocking %u err %s", 569f25d8215SKent Overstreet __entry->reserve, 57068b6cd19SKent Overstreet __entry->user, 571*1a14e255SKent Overstreet __entry->dev, 57268b6cd19SKent Overstreet __entry->bucket, 5738ef98313SKent Overstreet __entry->free, 574f25d8215SKent Overstreet __entry->avail, 5758ef98313SKent Overstreet __entry->copygc_wait_amount, 5768ef98313SKent Overstreet __entry->copygc_waiting_for, 577f25d8215SKent Overstreet __entry->seen, 578f25d8215SKent Overstreet __entry->open, 579f25d8215SKent Overstreet __entry->need_journal_commit, 580f25d8215SKent Overstreet __entry->nouse, 581a8b3a677SKent Overstreet __entry->nocow, 582f25d8215SKent Overstreet __entry->nonblocking, 583615f867cSKent Overstreet __entry->err) 5841c6fdbd8SKent Overstreet ); 5851c6fdbd8SKent Overstreet 5861c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc, 587f25d8215SKent Overstreet TP_PROTO(struct bch_dev *ca, const char *alloc_reserve, 58868b6cd19SKent Overstreet bool user, 58968b6cd19SKent Overstreet u64 bucket, 5908ef98313SKent Overstreet u64 free, 591f25d8215SKent Overstreet u64 avail, 5928ef98313SKent Overstreet u64 copygc_wait_amount, 5938ef98313SKent Overstreet s64 copygc_waiting_for, 594ae10fe01SKent Overstreet struct bucket_alloc_state *s, 595f25d8215SKent Overstreet bool nonblocking, 596615f867cSKent Overstreet const char *err), 59768b6cd19SKent Overstreet TP_ARGS(ca, alloc_reserve, user, bucket, free, avail, 59868b6cd19SKent Overstreet copygc_wait_amount, copygc_waiting_for, 599ae10fe01SKent Overstreet s, nonblocking, err) 6001c6fdbd8SKent Overstreet ); 6011c6fdbd8SKent Overstreet 6021c6fdbd8SKent Overstreet DEFINE_EVENT(bucket_alloc, bucket_alloc_fail, 603f25d8215SKent Overstreet TP_PROTO(struct bch_dev *ca, const char *alloc_reserve, 60468b6cd19SKent Overstreet bool user, 60568b6cd19SKent Overstreet u64 bucket, 6068ef98313SKent Overstreet u64 free, 607f25d8215SKent Overstreet u64 avail, 6088ef98313SKent Overstreet u64 copygc_wait_amount, 6098ef98313SKent Overstreet s64 copygc_waiting_for, 610ae10fe01SKent Overstreet struct bucket_alloc_state *s, 611f25d8215SKent Overstreet bool nonblocking, 612615f867cSKent Overstreet const char *err), 61368b6cd19SKent Overstreet TP_ARGS(ca, alloc_reserve, user, bucket, free, avail, 61468b6cd19SKent Overstreet copygc_wait_amount, copygc_waiting_for, 615ae10fe01SKent Overstreet s, nonblocking, err) 6161c6fdbd8SKent Overstreet ); 6171c6fdbd8SKent Overstreet 6181f93726eSKent Overstreet TRACE_EVENT(discard_buckets, 6191f93726eSKent Overstreet TP_PROTO(struct bch_fs *c, u64 seen, u64 open, 620615f867cSKent Overstreet u64 need_journal_commit, u64 discarded, const char *err), 621615f867cSKent Overstreet TP_ARGS(c, seen, open, need_journal_commit, discarded, err), 6221f93726eSKent Overstreet 6231f93726eSKent Overstreet TP_STRUCT__entry( 6241f93726eSKent Overstreet __field(dev_t, dev ) 6251f93726eSKent Overstreet __field(u64, seen ) 6261f93726eSKent Overstreet __field(u64, open ) 6271f93726eSKent Overstreet __field(u64, need_journal_commit ) 6281f93726eSKent Overstreet __field(u64, discarded ) 629615f867cSKent Overstreet __array(char, err, 16 ) 6301f93726eSKent Overstreet ), 6311f93726eSKent Overstreet 6321f93726eSKent Overstreet TP_fast_assign( 6331f93726eSKent Overstreet __entry->dev = c->dev; 6341f93726eSKent Overstreet __entry->seen = seen; 6351f93726eSKent Overstreet __entry->open = open; 6361f93726eSKent Overstreet __entry->need_journal_commit = need_journal_commit; 6371f93726eSKent Overstreet __entry->discarded = discarded; 638a1019576SKent Overstreet strscpy(__entry->err, err, sizeof(__entry->err)); 6391f93726eSKent Overstreet ), 6401f93726eSKent Overstreet 641615f867cSKent Overstreet TP_printk("%d%d seen %llu open %llu need_journal_commit %llu discarded %llu err %s", 6421f93726eSKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 6431f93726eSKent Overstreet __entry->seen, 6441f93726eSKent Overstreet __entry->open, 6451f93726eSKent Overstreet __entry->need_journal_commit, 6461f93726eSKent Overstreet __entry->discarded, 647615f867cSKent Overstreet __entry->err) 6481f93726eSKent Overstreet ); 6491f93726eSKent Overstreet 650674cfc26SKent Overstreet TRACE_EVENT(bucket_invalidate, 65138585367SKent Overstreet TP_PROTO(struct bch_fs *c, unsigned dev, u64 bucket, u32 sectors), 65238585367SKent Overstreet TP_ARGS(c, dev, bucket, sectors), 6531f93726eSKent Overstreet 6541f93726eSKent Overstreet TP_STRUCT__entry( 6551f93726eSKent Overstreet __field(dev_t, dev ) 6561f93726eSKent Overstreet __field(u32, dev_idx ) 65738585367SKent Overstreet __field(u32, sectors ) 6581f93726eSKent Overstreet __field(u64, bucket ) 6591f93726eSKent Overstreet ), 6601f93726eSKent Overstreet 6611f93726eSKent Overstreet TP_fast_assign( 6621f93726eSKent Overstreet __entry->dev = c->dev; 6631f93726eSKent Overstreet __entry->dev_idx = dev; 66438585367SKent Overstreet __entry->sectors = sectors; 6651f93726eSKent Overstreet __entry->bucket = bucket; 6661f93726eSKent Overstreet ), 6671f93726eSKent Overstreet 66838585367SKent Overstreet TP_printk("%d:%d invalidated %u:%llu cached sectors %u", 6691f93726eSKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 67038585367SKent Overstreet __entry->dev_idx, __entry->bucket, 67138585367SKent Overstreet __entry->sectors) 6721f93726eSKent Overstreet ); 6731f93726eSKent Overstreet 6741c6fdbd8SKent Overstreet /* Moving IO */ 6751c6fdbd8SKent Overstreet 676674cfc26SKent Overstreet DEFINE_EVENT(bkey, move_extent_read, 6771c6fdbd8SKent Overstreet TP_PROTO(const struct bkey *k), 6781c6fdbd8SKent Overstreet TP_ARGS(k) 6791c6fdbd8SKent Overstreet ); 6801c6fdbd8SKent Overstreet 681674cfc26SKent Overstreet DEFINE_EVENT(bkey, move_extent_write, 6821c6fdbd8SKent Overstreet TP_PROTO(const struct bkey *k), 6831c6fdbd8SKent Overstreet TP_ARGS(k) 6841c6fdbd8SKent Overstreet ); 6851c6fdbd8SKent Overstreet 686674cfc26SKent Overstreet DEFINE_EVENT(bkey, move_extent_finish, 687674cfc26SKent Overstreet TP_PROTO(const struct bkey *k), 688674cfc26SKent Overstreet TP_ARGS(k) 689674cfc26SKent Overstreet ); 690674cfc26SKent Overstreet 691674cfc26SKent Overstreet DEFINE_EVENT(bkey, move_extent_fail, 692674cfc26SKent Overstreet TP_PROTO(const struct bkey *k), 693674cfc26SKent Overstreet TP_ARGS(k) 694674cfc26SKent Overstreet ); 695674cfc26SKent Overstreet 696674cfc26SKent Overstreet DEFINE_EVENT(bkey, move_extent_alloc_mem_fail, 6971c6fdbd8SKent Overstreet TP_PROTO(const struct bkey *k), 6981c6fdbd8SKent Overstreet TP_ARGS(k) 6991c6fdbd8SKent Overstreet ); 7001c6fdbd8SKent Overstreet 7011c6fdbd8SKent Overstreet TRACE_EVENT(move_data, 7021c6fdbd8SKent Overstreet TP_PROTO(struct bch_fs *c, u64 sectors_moved, 7031c6fdbd8SKent Overstreet u64 keys_moved), 7041c6fdbd8SKent Overstreet TP_ARGS(c, sectors_moved, keys_moved), 7051c6fdbd8SKent Overstreet 7061c6fdbd8SKent Overstreet TP_STRUCT__entry( 707ddc7dd62SKent Overstreet __field(dev_t, dev ) 7081c6fdbd8SKent Overstreet __field(u64, sectors_moved ) 7091c6fdbd8SKent Overstreet __field(u64, keys_moved ) 7101c6fdbd8SKent Overstreet ), 7111c6fdbd8SKent Overstreet 7121c6fdbd8SKent Overstreet TP_fast_assign( 713ddc7dd62SKent Overstreet __entry->dev = c->dev; 7141c6fdbd8SKent Overstreet __entry->sectors_moved = sectors_moved; 7151c6fdbd8SKent Overstreet __entry->keys_moved = keys_moved; 7161c6fdbd8SKent Overstreet ), 7171c6fdbd8SKent Overstreet 718ddc7dd62SKent Overstreet TP_printk("%d,%d sectors_moved %llu keys_moved %llu", 719ddc7dd62SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 720ddc7dd62SKent Overstreet __entry->sectors_moved, __entry->keys_moved) 7211c6fdbd8SKent Overstreet ); 7221c6fdbd8SKent Overstreet 7238e3f913eSKent Overstreet TRACE_EVENT(evacuate_bucket, 7248e3f913eSKent Overstreet TP_PROTO(struct bch_fs *c, struct bpos *bucket, 7258e3f913eSKent Overstreet unsigned sectors, unsigned bucket_size, 72680c33085SKent Overstreet u64 fragmentation, int ret), 72780c33085SKent Overstreet TP_ARGS(c, bucket, sectors, bucket_size, fragmentation, ret), 7288e3f913eSKent Overstreet 7298e3f913eSKent Overstreet TP_STRUCT__entry( 7308e3f913eSKent Overstreet __field(dev_t, dev ) 7318e3f913eSKent Overstreet __field(u64, member ) 7328e3f913eSKent Overstreet __field(u64, bucket ) 7338e3f913eSKent Overstreet __field(u32, sectors ) 7348e3f913eSKent Overstreet __field(u32, bucket_size ) 73580c33085SKent Overstreet __field(u64, fragmentation ) 7368e3f913eSKent Overstreet __field(int, ret ) 7378e3f913eSKent Overstreet ), 7388e3f913eSKent Overstreet 7398e3f913eSKent Overstreet TP_fast_assign( 7408e3f913eSKent Overstreet __entry->dev = c->dev; 7418e3f913eSKent Overstreet __entry->member = bucket->inode; 7428e3f913eSKent Overstreet __entry->bucket = bucket->offset; 7438e3f913eSKent Overstreet __entry->sectors = sectors; 7448e3f913eSKent Overstreet __entry->bucket_size = bucket_size; 74580c33085SKent Overstreet __entry->fragmentation = fragmentation; 7468e3f913eSKent Overstreet __entry->ret = ret; 7478e3f913eSKent Overstreet ), 7488e3f913eSKent Overstreet 74980c33085SKent Overstreet TP_printk("%d,%d %llu:%llu sectors %u/%u fragmentation %llu ret %i", 7508e3f913eSKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 7518e3f913eSKent Overstreet __entry->member, __entry->bucket, 7528e3f913eSKent Overstreet __entry->sectors, __entry->bucket_size, 75380c33085SKent Overstreet __entry->fragmentation, __entry->ret) 7548e3f913eSKent Overstreet ); 7558e3f913eSKent Overstreet 7561c6fdbd8SKent Overstreet TRACE_EVENT(copygc, 757e6d11615SKent Overstreet TP_PROTO(struct bch_fs *c, 7581c6fdbd8SKent Overstreet u64 sectors_moved, u64 sectors_not_moved, 7591c6fdbd8SKent Overstreet u64 buckets_moved, u64 buckets_not_moved), 760e6d11615SKent Overstreet TP_ARGS(c, 7611c6fdbd8SKent Overstreet sectors_moved, sectors_not_moved, 7621c6fdbd8SKent Overstreet buckets_moved, buckets_not_moved), 7631c6fdbd8SKent Overstreet 7641c6fdbd8SKent Overstreet TP_STRUCT__entry( 765ddc7dd62SKent Overstreet __field(dev_t, dev ) 7661c6fdbd8SKent Overstreet __field(u64, sectors_moved ) 7671c6fdbd8SKent Overstreet __field(u64, sectors_not_moved ) 7681c6fdbd8SKent Overstreet __field(u64, buckets_moved ) 7691c6fdbd8SKent Overstreet __field(u64, buckets_not_moved ) 7701c6fdbd8SKent Overstreet ), 7711c6fdbd8SKent Overstreet 7721c6fdbd8SKent Overstreet TP_fast_assign( 773ddc7dd62SKent Overstreet __entry->dev = c->dev; 7741c6fdbd8SKent Overstreet __entry->sectors_moved = sectors_moved; 7751c6fdbd8SKent Overstreet __entry->sectors_not_moved = sectors_not_moved; 7761c6fdbd8SKent Overstreet __entry->buckets_moved = buckets_moved; 7771c6fdbd8SKent Overstreet __entry->buckets_not_moved = buckets_moved; 7781c6fdbd8SKent Overstreet ), 7791c6fdbd8SKent Overstreet 780ddc7dd62SKent Overstreet TP_printk("%d,%d sectors moved %llu remain %llu buckets moved %llu remain %llu", 781ddc7dd62SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 7821c6fdbd8SKent Overstreet __entry->sectors_moved, __entry->sectors_not_moved, 7831c6fdbd8SKent Overstreet __entry->buckets_moved, __entry->buckets_not_moved) 7841c6fdbd8SKent Overstreet ); 7851c6fdbd8SKent Overstreet 78619d2819dSKent Overstreet TRACE_EVENT(copygc_wait, 78719d2819dSKent Overstreet TP_PROTO(struct bch_fs *c, 78819d2819dSKent Overstreet u64 wait_amount, u64 until), 78919d2819dSKent Overstreet TP_ARGS(c, wait_amount, until), 79019d2819dSKent Overstreet 79119d2819dSKent Overstreet TP_STRUCT__entry( 792ddc7dd62SKent Overstreet __field(dev_t, dev ) 79319d2819dSKent Overstreet __field(u64, wait_amount ) 79419d2819dSKent Overstreet __field(u64, until ) 79519d2819dSKent Overstreet ), 79619d2819dSKent Overstreet 79719d2819dSKent Overstreet TP_fast_assign( 798ddc7dd62SKent Overstreet __entry->dev = c->dev; 79919d2819dSKent Overstreet __entry->wait_amount = wait_amount; 80019d2819dSKent Overstreet __entry->until = until; 80119d2819dSKent Overstreet ), 80219d2819dSKent Overstreet 803ddc7dd62SKent Overstreet TP_printk("%d,%u waiting for %llu sectors until %llu", 804ddc7dd62SKent Overstreet MAJOR(__entry->dev), MINOR(__entry->dev), 805ddc7dd62SKent Overstreet __entry->wait_amount, __entry->until) 80619d2819dSKent Overstreet ); 80719d2819dSKent Overstreet 80812043cf1SKent Overstreet /* btree transactions: */ 80912043cf1SKent Overstreet 8101f93726eSKent Overstreet DECLARE_EVENT_CLASS(transaction_event, 8119f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 812531a0095SKent Overstreet unsigned long caller_ip), 8139f96568cSKent Overstreet TP_ARGS(trans, caller_ip), 814ba5c6557SKent Overstreet 815ba5c6557SKent Overstreet TP_STRUCT__entry( 8165f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 817531a0095SKent Overstreet __field(unsigned long, caller_ip ) 818ba5c6557SKent Overstreet ), 819ba5c6557SKent Overstreet 820ba5c6557SKent Overstreet TP_fast_assign( 821a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 822531a0095SKent Overstreet __entry->caller_ip = caller_ip; 823ba5c6557SKent Overstreet ), 824ba5c6557SKent Overstreet 825669f87a5SKent Overstreet TP_printk("%s %pS", __entry->trans_fn, (void *) __entry->caller_ip) 826669f87a5SKent Overstreet ); 827669f87a5SKent Overstreet 8281f93726eSKent Overstreet DEFINE_EVENT(transaction_event, transaction_commit, 8299f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 830669f87a5SKent Overstreet unsigned long caller_ip), 8319f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 832ba5c6557SKent Overstreet ); 833ba5c6557SKent Overstreet 834674cfc26SKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_injected, 8359f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 836a0cb8d78SKent Overstreet unsigned long caller_ip), 8379f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 838a0cb8d78SKent Overstreet ); 839a0cb8d78SKent Overstreet 840e151580dSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_split_race, 841e151580dSKent Overstreet TP_PROTO(struct btree_trans *trans, 842e151580dSKent Overstreet unsigned long caller_ip), 843e151580dSKent Overstreet TP_ARGS(trans, caller_ip) 844e151580dSKent Overstreet ); 845e151580dSKent Overstreet 8461f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_blocked_journal_reclaim, 8479f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 848531a0095SKent Overstreet unsigned long caller_ip), 8499f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 850531a0095SKent Overstreet ); 851531a0095SKent Overstreet 8521f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_journal_res_get, 8539f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 854531a0095SKent Overstreet unsigned long caller_ip), 8559f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 856531a0095SKent Overstreet ); 857531a0095SKent Overstreet 858ce56bf7fSKent Overstreet 859ce56bf7fSKent Overstreet TRACE_EVENT(trans_restart_journal_preres_get, 8609f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 861ce56bf7fSKent Overstreet unsigned long caller_ip, 862ce56bf7fSKent Overstreet unsigned flags), 863ce56bf7fSKent Overstreet TP_ARGS(trans, caller_ip, flags), 864ce56bf7fSKent Overstreet 865ce56bf7fSKent Overstreet TP_STRUCT__entry( 866ce56bf7fSKent Overstreet __array(char, trans_fn, 32 ) 867ce56bf7fSKent Overstreet __field(unsigned long, caller_ip ) 868ce56bf7fSKent Overstreet __field(unsigned, flags ) 869ce56bf7fSKent Overstreet ), 870ce56bf7fSKent Overstreet 871ce56bf7fSKent Overstreet TP_fast_assign( 872a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 873ce56bf7fSKent Overstreet __entry->caller_ip = caller_ip; 874ce56bf7fSKent Overstreet __entry->flags = flags; 875ce56bf7fSKent Overstreet ), 876ce56bf7fSKent Overstreet 877ce56bf7fSKent Overstreet TP_printk("%s %pS %x", __entry->trans_fn, 878ce56bf7fSKent Overstreet (void *) __entry->caller_ip, 879ce56bf7fSKent Overstreet __entry->flags) 880531a0095SKent Overstreet ); 881531a0095SKent Overstreet 8821f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_journal_reclaim, 8839f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 884531a0095SKent Overstreet unsigned long caller_ip), 8859f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 886531a0095SKent Overstreet ); 887531a0095SKent Overstreet 8881f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_fault_inject, 8899f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 890531a0095SKent Overstreet unsigned long caller_ip), 8919f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 892531a0095SKent Overstreet ); 893531a0095SKent Overstreet 8941f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_traverse_all, 8959f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 896531a0095SKent Overstreet unsigned long caller_ip), 8979f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 898531a0095SKent Overstreet ); 899531a0095SKent Overstreet 9001f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_mark_replicas, 9019f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 9021f93726eSKent Overstreet unsigned long caller_ip), 9039f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 9041f93726eSKent Overstreet ); 9051f93726eSKent Overstreet 9061f93726eSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_key_cache_raced, 9079f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 90812ce5b7dSKent Overstreet unsigned long caller_ip), 9099f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 91012ce5b7dSKent Overstreet ); 91112ce5b7dSKent Overstreet 9120990efaeSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_too_many_iters, 9139f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 9140990efaeSKent Overstreet unsigned long caller_ip), 9159f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 9160990efaeSKent Overstreet ); 9170990efaeSKent Overstreet 918531a0095SKent Overstreet DECLARE_EVENT_CLASS(transaction_restart_iter, 9199f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 920531a0095SKent Overstreet unsigned long caller_ip, 9219f96568cSKent Overstreet struct btree_path *path), 9229f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path), 923531a0095SKent Overstreet 924531a0095SKent Overstreet TP_STRUCT__entry( 9255f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 9264b59a319SKent Overstreet __field(unsigned long, caller_ip ) 927531a0095SKent Overstreet __field(u8, btree_id ) 9289f96568cSKent Overstreet TRACE_BPOS_entries(pos) 929531a0095SKent Overstreet ), 930531a0095SKent Overstreet 931531a0095SKent Overstreet TP_fast_assign( 932a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 9334b59a319SKent Overstreet __entry->caller_ip = caller_ip; 9349f96568cSKent Overstreet __entry->btree_id = path->btree_id; 9359f96568cSKent Overstreet TRACE_BPOS_assign(pos, path->pos) 936531a0095SKent Overstreet ), 937531a0095SKent Overstreet 9389f96568cSKent Overstreet TP_printk("%s %pS btree %s pos %llu:%llu:%u", 939669f87a5SKent Overstreet __entry->trans_fn, 9404b59a319SKent Overstreet (void *) __entry->caller_ip, 9419f96568cSKent Overstreet bch2_btree_ids[__entry->btree_id], 942531a0095SKent Overstreet __entry->pos_inode, 943531a0095SKent Overstreet __entry->pos_offset, 944531a0095SKent Overstreet __entry->pos_snapshot) 945531a0095SKent Overstreet ); 946531a0095SKent Overstreet 947531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_reused, 9489f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 949531a0095SKent Overstreet unsigned long caller_ip, 9509f96568cSKent Overstreet struct btree_path *path), 9519f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 952531a0095SKent Overstreet ); 953531a0095SKent Overstreet 954531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_btree_node_split, 9559f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 956531a0095SKent Overstreet unsigned long caller_ip, 9579f96568cSKent Overstreet struct btree_path *path), 9589f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 959531a0095SKent Overstreet ); 960531a0095SKent Overstreet 961367d72ddSKent Overstreet TRACE_EVENT(trans_restart_upgrade, 9629f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 963531a0095SKent Overstreet unsigned long caller_ip, 964367d72ddSKent Overstreet struct btree_path *path, 965367d72ddSKent Overstreet unsigned old_locks_want, 966367d72ddSKent Overstreet unsigned new_locks_want), 967367d72ddSKent Overstreet TP_ARGS(trans, caller_ip, path, old_locks_want, new_locks_want), 968531a0095SKent Overstreet 969367d72ddSKent Overstreet TP_STRUCT__entry( 970367d72ddSKent Overstreet __array(char, trans_fn, 32 ) 971367d72ddSKent Overstreet __field(unsigned long, caller_ip ) 972367d72ddSKent Overstreet __field(u8, btree_id ) 973367d72ddSKent Overstreet __field(u8, old_locks_want ) 974367d72ddSKent Overstreet __field(u8, new_locks_want ) 975367d72ddSKent Overstreet TRACE_BPOS_entries(pos) 976367d72ddSKent Overstreet ), 977367d72ddSKent Overstreet 978367d72ddSKent Overstreet TP_fast_assign( 979a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 980367d72ddSKent Overstreet __entry->caller_ip = caller_ip; 981367d72ddSKent Overstreet __entry->btree_id = path->btree_id; 982367d72ddSKent Overstreet __entry->old_locks_want = old_locks_want; 983367d72ddSKent Overstreet __entry->new_locks_want = new_locks_want; 984367d72ddSKent Overstreet TRACE_BPOS_assign(pos, path->pos) 985367d72ddSKent Overstreet ), 986367d72ddSKent Overstreet 987367d72ddSKent Overstreet TP_printk("%s %pS btree %s pos %llu:%llu:%u locks_want %u -> %u", 988367d72ddSKent Overstreet __entry->trans_fn, 989367d72ddSKent Overstreet (void *) __entry->caller_ip, 990367d72ddSKent Overstreet bch2_btree_ids[__entry->btree_id], 991367d72ddSKent Overstreet __entry->pos_inode, 992367d72ddSKent Overstreet __entry->pos_offset, 993367d72ddSKent Overstreet __entry->pos_snapshot, 994367d72ddSKent Overstreet __entry->old_locks_want, 995367d72ddSKent Overstreet __entry->new_locks_want) 996531a0095SKent Overstreet ); 997531a0095SKent Overstreet 998531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock, 9999f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1000531a0095SKent Overstreet unsigned long caller_ip, 10019f96568cSKent Overstreet struct btree_path *path), 10029f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1003531a0095SKent Overstreet ); 1004531a0095SKent Overstreet 1005bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_next_node, 10069f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1007bc82d08bSKent Overstreet unsigned long caller_ip, 10089f96568cSKent Overstreet struct btree_path *path), 10099f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1010bc82d08bSKent Overstreet ); 1011bc82d08bSKent Overstreet 1012bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_parent_for_fill, 10139f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1014bc82d08bSKent Overstreet unsigned long caller_ip, 10159f96568cSKent Overstreet struct btree_path *path), 10169f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1017bc82d08bSKent Overstreet ); 1018bc82d08bSKent Overstreet 1019bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_after_fill, 10209f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1021bc82d08bSKent Overstreet unsigned long caller_ip, 10229f96568cSKent Overstreet struct btree_path *path), 10239f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1024bc82d08bSKent Overstreet ); 1025bc82d08bSKent Overstreet 1026674cfc26SKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_key_cache_upgrade, 10279f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 102849e401faSKent Overstreet unsigned long caller_ip), 10299f96568cSKent Overstreet TP_ARGS(trans, caller_ip) 103049e401faSKent Overstreet ); 103149e401faSKent Overstreet 1032bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_key_cache_fill, 10339f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1034bc82d08bSKent Overstreet unsigned long caller_ip, 10359f96568cSKent Overstreet struct btree_path *path), 10369f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1037bc82d08bSKent Overstreet ); 1038bc82d08bSKent Overstreet 1039bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_path, 10409f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1041bc82d08bSKent Overstreet unsigned long caller_ip, 10429f96568cSKent Overstreet struct btree_path *path), 10439f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1044bc82d08bSKent Overstreet ); 1045bc82d08bSKent Overstreet 1046bc82d08bSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_relock_path_intent, 10479f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1048bc82d08bSKent Overstreet unsigned long caller_ip, 10499f96568cSKent Overstreet struct btree_path *path), 10509f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1051bc82d08bSKent Overstreet ); 1052bc82d08bSKent Overstreet 1053531a0095SKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_traverse, 10549f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1055531a0095SKent Overstreet unsigned long caller_ip, 10569f96568cSKent Overstreet struct btree_path *path), 10579f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 1058531a0095SKent Overstreet ); 1059531a0095SKent Overstreet 10608f9ad91aSKent Overstreet DEFINE_EVENT(transaction_restart_iter, trans_restart_memory_allocation_failure, 10619f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 10628f9ad91aSKent Overstreet unsigned long caller_ip, 10639f96568cSKent Overstreet struct btree_path *path), 10649f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path) 10658f9ad91aSKent Overstreet ); 10668f9ad91aSKent Overstreet 10670d7009d7SKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_would_deadlock, 10689f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 10690d7009d7SKent Overstreet unsigned long caller_ip), 10700d7009d7SKent Overstreet TP_ARGS(trans, caller_ip) 1071ba5c6557SKent Overstreet ); 1072ba5c6557SKent Overstreet 107333bd5d06SKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_would_deadlock_recursion_limit, 107433bd5d06SKent Overstreet TP_PROTO(struct btree_trans *trans, 107533bd5d06SKent Overstreet unsigned long caller_ip), 107633bd5d06SKent Overstreet TP_ARGS(trans, caller_ip) 107733bd5d06SKent Overstreet ); 107833bd5d06SKent Overstreet 1079caaa66aaSKent Overstreet TRACE_EVENT(trans_restart_would_deadlock_write, 10809f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans), 10819f96568cSKent Overstreet TP_ARGS(trans), 1082caaa66aaSKent Overstreet 1083caaa66aaSKent Overstreet TP_STRUCT__entry( 10845f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 1085caaa66aaSKent Overstreet ), 1086caaa66aaSKent Overstreet 1087caaa66aaSKent Overstreet TP_fast_assign( 1088a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 1089caaa66aaSKent Overstreet ), 1090caaa66aaSKent Overstreet 1091669f87a5SKent Overstreet TP_printk("%s", __entry->trans_fn) 1092caaa66aaSKent Overstreet ); 1093caaa66aaSKent Overstreet 109420bceecbSKent Overstreet TRACE_EVENT(trans_restart_mem_realloced, 10959f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1096669f87a5SKent Overstreet unsigned long caller_ip, 109773a117d2SKent Overstreet unsigned long bytes), 10989f96568cSKent Overstreet TP_ARGS(trans, caller_ip, bytes), 109920bceecbSKent Overstreet 110020bceecbSKent Overstreet TP_STRUCT__entry( 11015f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 110273a117d2SKent Overstreet __field(unsigned long, caller_ip ) 110320bceecbSKent Overstreet __field(unsigned long, bytes ) 110420bceecbSKent Overstreet ), 110520bceecbSKent Overstreet 110620bceecbSKent Overstreet TP_fast_assign( 1107a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 110873a117d2SKent Overstreet __entry->caller_ip = caller_ip; 110920bceecbSKent Overstreet __entry->bytes = bytes; 111020bceecbSKent Overstreet ), 111120bceecbSKent Overstreet 1112669f87a5SKent Overstreet TP_printk("%s %pS bytes %lu", 1113669f87a5SKent Overstreet __entry->trans_fn, 111473a117d2SKent Overstreet (void *) __entry->caller_ip, 111573a117d2SKent Overstreet __entry->bytes) 1116ba5c6557SKent Overstreet ); 1117ba5c6557SKent Overstreet 11183a306f3cSKent Overstreet TRACE_EVENT(trans_restart_key_cache_key_realloced, 11199f96568cSKent Overstreet TP_PROTO(struct btree_trans *trans, 1120ddf11d8cSKent Overstreet unsigned long caller_ip, 11219f96568cSKent Overstreet struct btree_path *path, 11223a306f3cSKent Overstreet unsigned old_u64s, 11233a306f3cSKent Overstreet unsigned new_u64s), 11249f96568cSKent Overstreet TP_ARGS(trans, caller_ip, path, old_u64s, new_u64s), 11253a306f3cSKent Overstreet 11263a306f3cSKent Overstreet TP_STRUCT__entry( 11275f1dd9a6SKent Overstreet __array(char, trans_fn, 32 ) 11283a306f3cSKent Overstreet __field(unsigned long, caller_ip ) 11293a306f3cSKent Overstreet __field(enum btree_id, btree_id ) 11309f96568cSKent Overstreet TRACE_BPOS_entries(pos) 11313a306f3cSKent Overstreet __field(u32, old_u64s ) 11323a306f3cSKent Overstreet __field(u32, new_u64s ) 11333a306f3cSKent Overstreet ), 11343a306f3cSKent Overstreet 11353a306f3cSKent Overstreet TP_fast_assign( 1136a1019576SKent Overstreet strscpy(__entry->trans_fn, trans->fn, sizeof(__entry->trans_fn)); 11373a306f3cSKent Overstreet __entry->caller_ip = caller_ip; 11389f96568cSKent Overstreet 11399f96568cSKent Overstreet __entry->btree_id = path->btree_id; 11409f96568cSKent Overstreet TRACE_BPOS_assign(pos, path->pos); 11413a306f3cSKent Overstreet __entry->old_u64s = old_u64s; 11423a306f3cSKent Overstreet __entry->new_u64s = new_u64s; 11433a306f3cSKent Overstreet ), 11443a306f3cSKent Overstreet 11453a306f3cSKent Overstreet TP_printk("%s %pS btree %s pos %llu:%llu:%u old_u64s %u new_u64s %u", 11463a306f3cSKent Overstreet __entry->trans_fn, 11473a306f3cSKent Overstreet (void *) __entry->caller_ip, 11483a306f3cSKent Overstreet bch2_btree_ids[__entry->btree_id], 114949e401faSKent Overstreet __entry->pos_inode, 115049e401faSKent Overstreet __entry->pos_offset, 11519f96568cSKent Overstreet __entry->pos_snapshot, 11529f96568cSKent Overstreet __entry->old_u64s, 11539f96568cSKent Overstreet __entry->new_u64s) 115449e401faSKent Overstreet ); 115549e401faSKent Overstreet 1156920e69bcSKent Overstreet DEFINE_EVENT(transaction_event, trans_restart_write_buffer_flush, 1157920e69bcSKent Overstreet TP_PROTO(struct btree_trans *trans, 1158920e69bcSKent Overstreet unsigned long caller_ip), 1159920e69bcSKent Overstreet TP_ARGS(trans, caller_ip) 1160920e69bcSKent Overstreet ); 1161920e69bcSKent Overstreet 1162920e69bcSKent Overstreet TRACE_EVENT(write_buffer_flush, 1163920e69bcSKent Overstreet TP_PROTO(struct btree_trans *trans, size_t nr, size_t skipped, size_t fast, size_t size), 1164920e69bcSKent Overstreet TP_ARGS(trans, nr, skipped, fast, size), 1165920e69bcSKent Overstreet 1166920e69bcSKent Overstreet TP_STRUCT__entry( 1167920e69bcSKent Overstreet __field(size_t, nr ) 1168920e69bcSKent Overstreet __field(size_t, skipped ) 1169920e69bcSKent Overstreet __field(size_t, fast ) 1170920e69bcSKent Overstreet __field(size_t, size ) 1171920e69bcSKent Overstreet ), 1172920e69bcSKent Overstreet 1173920e69bcSKent Overstreet TP_fast_assign( 1174920e69bcSKent Overstreet __entry->nr = nr; 1175920e69bcSKent Overstreet __entry->skipped = skipped; 1176920e69bcSKent Overstreet __entry->fast = fast; 1177920e69bcSKent Overstreet __entry->size = size; 1178920e69bcSKent Overstreet ), 1179920e69bcSKent Overstreet 1180920e69bcSKent Overstreet TP_printk("%zu/%zu skipped %zu fast %zu", 1181920e69bcSKent Overstreet __entry->nr, __entry->size, __entry->skipped, __entry->fast) 1182920e69bcSKent Overstreet ); 1183920e69bcSKent Overstreet 1184920e69bcSKent Overstreet TRACE_EVENT(write_buffer_flush_slowpath, 1185920e69bcSKent Overstreet TP_PROTO(struct btree_trans *trans, size_t nr, size_t size), 1186920e69bcSKent Overstreet TP_ARGS(trans, nr, size), 1187920e69bcSKent Overstreet 1188920e69bcSKent Overstreet TP_STRUCT__entry( 1189920e69bcSKent Overstreet __field(size_t, nr ) 1190920e69bcSKent Overstreet __field(size_t, size ) 1191920e69bcSKent Overstreet ), 1192920e69bcSKent Overstreet 1193920e69bcSKent Overstreet TP_fast_assign( 1194920e69bcSKent Overstreet __entry->nr = nr; 1195920e69bcSKent Overstreet __entry->size = size; 1196920e69bcSKent Overstreet ), 1197920e69bcSKent Overstreet 1198920e69bcSKent Overstreet TP_printk("%zu/%zu", __entry->nr, __entry->size) 1199920e69bcSKent Overstreet ); 1200920e69bcSKent Overstreet 12011c6fdbd8SKent Overstreet #endif /* _TRACE_BCACHEFS_H */ 12021c6fdbd8SKent Overstreet 12031c6fdbd8SKent Overstreet /* This part must be outside protection */ 12041c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_PATH 12051c6fdbd8SKent Overstreet #define TRACE_INCLUDE_PATH ../../fs/bcachefs 12061c6fdbd8SKent Overstreet 12071c6fdbd8SKent Overstreet #undef TRACE_INCLUDE_FILE 12081c6fdbd8SKent Overstreet #define TRACE_INCLUDE_FILE trace 12091c6fdbd8SKent Overstreet 12101c6fdbd8SKent Overstreet #include <trace/define_trace.h> 1211