From c807ca95a6e20bedbbb84287bc7087c2b2b775de Mon Sep 17 00:00:00 2001 From: Daniel Hill Date: Thu, 14 Jul 2022 20:33:09 +1200 Subject: bcachefs: added lock held time stats We now record the length of time btree locks are held and expose this in debugfs. Enabled via CONFIG_BCACHEFS_LOCK_TIME_STATS. Signed-off-by: Daniel Hill Signed-off-by: Kent Overstreet --- fs/bcachefs/bcachefs.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'fs/bcachefs/bcachefs.h') diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 7020eee5de21..9cd6f840b71a 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -319,6 +319,8 @@ BCH_DEBUG_PARAMS_DEBUG() #undef BCH_DEBUG_PARAM #endif +#define BCH_LOCK_TIME_NR 128 + #define BCH_TIME_STATS() \ x(btree_node_mem_alloc) \ x(btree_node_split) \ @@ -527,6 +529,11 @@ struct btree_debug { unsigned id; }; +struct lock_held_stats { + struct bch2_time_stats times[BCH_LOCK_TIME_NR]; + const char *names[BCH_LOCK_TIME_NR]; +}; + struct bch_fs_pcpu { u64 sectors_available; }; @@ -920,6 +927,8 @@ mempool_t bio_bounce_pages; bool promote_whole_extents; struct bch2_time_stats times[BCH_TIME_STAT_NR]; + + struct lock_held_stats lock_held_stats; }; static inline void bch2_set_ra_pages(struct bch_fs *c, unsigned ra_pages) -- cgit v1.2.3