summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-06-02 16:36:11 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:40 -0400
commit495aabede3ff594c5eda98cb9f4463502cb48cad (patch)
treef40b651df22eba1f7aaa5e9596f4ceef0e9f8069 /fs/bcachefs/sysfs.c
parent61fc3c9610e4728c22e5be67a45d0520b1a388cf (diff)
bcachefs: Add debug code to print btree transactions
Intented to help debug deadlocks, since we can't use lockdep to check btree node lock ordering. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index 662c84b91323..06b59e991312 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -166,6 +166,7 @@ read_attribute(journal_debug);
read_attribute(journal_pins);
read_attribute(btree_updates);
read_attribute(dirty_btree_nodes);
+read_attribute(btree_transactions);
read_attribute(internal_uuid);
@@ -401,6 +402,12 @@ SHOW(bch2_fs)
if (attr == &sysfs_dirty_btree_nodes)
return bch2_dirty_btree_nodes_print(c, buf);
+ if (attr == &sysfs_btree_transactions) {
+ struct printbuf out = _PBUF(buf, PAGE_SIZE);
+
+ bch2_btree_trans_to_text(&out, c);
+ return out.pos - buf;
+ }
if (attr == &sysfs_compression_stats)
return bch2_compression_stats(c, buf);
@@ -571,6 +578,7 @@ struct attribute *bch2_fs_internal_files[] = {
&sysfs_journal_pins,
&sysfs_btree_updates,
&sysfs_dirty_btree_nodes,
+ &sysfs_btree_transactions,
&sysfs_read_realloc_races,
&sysfs_extent_migrate_done,