summaryrefslogtreecommitdiff
path: root/fs/bcachefs/bcachefs.h
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2022-07-14 20:33:09 +1200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:35 -0400
commitc807ca95a6e20bedbbb84287bc7087c2b2b775de (patch)
tree0add067029709ede728fd48ca3761325fe1cd8fc /fs/bcachefs/bcachefs.h
parent25055c690f9ab3d4fb72b8a07323bf952c2682dc (diff)
downloadlwn-c807ca95a6e20bedbbb84287bc7087c2b2b775de.tar.gz
lwn-c807ca95a6e20bedbbb84287bc7087c2b2b775de.zip
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 <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs.h')
-rw-r--r--fs/bcachefs/bcachefs.h9
1 files changed, 9 insertions, 0 deletions
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)