diff options
Diffstat (limited to 'libbcachefs/btree_locking.h')
-rw-r--r-- | libbcachefs/btree_locking.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libbcachefs/btree_locking.h b/libbcachefs/btree_locking.h index 9081d3fc..7aa11c00 100644 --- a/libbcachefs/btree_locking.h +++ b/libbcachefs/btree_locking.h @@ -182,11 +182,21 @@ static inline bool btree_node_lock(struct btree *b, struct bpos pos, struct btree_iter *iter, enum six_lock_type type) { + bool ret; + EBUG_ON(level >= BTREE_MAX_DEPTH); +#ifdef CONFIG_BCACHEFS_DEBUG + iter->trans->locking = b; +#endif - return likely(six_trylock_type(&b->lock, type)) || + ret = likely(six_trylock_type(&b->lock, type)) || btree_node_lock_increment(iter, b, level, type) || __bch2_btree_node_lock(b, pos, level, iter, type); + +#ifdef CONFIG_BCACHEFS_DEBUG + iter->trans->locking = NULL; +#endif + return ret; } bool __bch2_btree_node_relock(struct btree_iter *, unsigned); |