summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_locking.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-03 16:39:49 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:42 -0400
commit13bc41a7151a6af26107240fbdd2562d95adad44 (patch)
treeaab9639284597f147b8f7198eb139db4124e284a /fs/bcachefs/btree_locking.c
parent40a44873a5ca9843532344d12583e6a3a78ea848 (diff)
downloadlinux-stable-13bc41a7151a6af26107240fbdd2562d95adad44.tar.gz
linux-stable-13bc41a7151a6af26107240fbdd2562d95adad44.tar.bz2
linux-stable-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