bcachefs: bch2_trans_locked()
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 3 Oct 2022 20:39:49 +0000 (16:39 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:42 +0000 (17:09 -0400)
Useful debugging function.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.h
fs/bcachefs/btree_locking.c

index 1be7c8883101f9ac0c0f8b0221df8f47017d31e6..2e94cd2657e9c27be95ede9087c61446df9fbee2 100644 (file)
@@ -207,6 +207,7 @@ void bch2_path_put(struct btree_trans *, struct btree_path *, bool);
 
 int bch2_trans_relock(struct btree_trans *);
 void bch2_trans_unlock(struct btree_trans *);
+bool bch2_trans_locked(struct btree_trans *);
 
 static inline bool trans_was_restarted(struct btree_trans *trans, u32 restart_count)
 {
index b79543ae5eebc9a165828a008c3a3ff1ccb33de7..ad6e364980f3637e1e68450640c22e34b537c3a0 100644 (file)
@@ -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