summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-08-27 19:28:09 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:39 +0300
commit8a9c1b1cb0edacdf4ac9c378c4ec4fc376fc8bac (patch)
treed1c29fc0686dbd1dd19f04240455c36e37747ef1 /fs/bcachefs/btree_locking.h
parentce56bf7fc23b6c2cf6edfbdfba1805c1842641ca (diff)
downloadlinux-8a9c1b1cb0edacdf4ac9c378c4ec4fc376fc8bac.tar.xz
bcachefs: Improve bch2_btree_node_relock()
This moves the IS_ERR_OR_NULL() check to the inline part, since that's a fast path event. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.h')
-rw-r--r--fs/bcachefs/btree_locking.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index a221c4fd1bf9..3bc5df4263f8 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -325,7 +325,8 @@ static inline bool bch2_btree_node_relock(struct btree_trans *trans,
btree_node_locked_type(path, level) != __btree_lock_want(path, level));
return likely(btree_node_locked(path, level)) ||
- __bch2_btree_node_relock(trans, path, level);
+ (!IS_ERR_OR_NULL(path->l[level].b) &&
+ __bch2_btree_node_relock(trans, path, level));
}
/* upgrade */