summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_locking.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-03 22:39:49 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:09:42 +0200
commit13bc41a7151a6af26107240fbdd2562d95adad44 (patch)
treeaab9639284597f147b8f7198eb139db4124e284a /fs/bcachefs/btree_locking.c
parentbcachefs: Improve btree_deadlock debugfs output (diff)
downloadlinux-13bc41a7151a6af26107240fbdd2562d95adad44.tar.xz
linux-13bc41a7151a6af26107240fbdd2562d95adad44.zip
bcachefs: bch2_trans_locked()
Useful debugging function. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
-rw-r--r--fs/bcachefs/btree_locking.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c
index b79543ae5eeb..ad6e364980f3 100644
--- a/fs/bcachefs/btree_locking.c
+++ b/fs/bcachefs/btree_locking.c
@@ -666,6 +666,16 @@ void bch2_trans_unlock(struct btree_trans *trans)
__bch2_btree_path_unlock(trans, path);
}
+bool bch2_trans_locked(struct btree_trans *trans)
+{
+ struct btree_path *path;
+
+ trans_for_each_path(trans, path)
+ if (path->nodes_locked)
+ return true;
+ return false;
+}
+
/* Debug */
#ifdef CONFIG_BCACHEFS_DEBUG