Commit 8a9c1b1c authored by Kent Overstreet's avatar Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ce56bf7f
...@@ -208,9 +208,6 @@ bool __bch2_btree_node_relock(struct btree_trans *trans, ...@@ -208,9 +208,6 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
struct btree *b = btree_path_node(path, level); struct btree *b = btree_path_node(path, level);
int want = __btree_lock_want(path, level); int want = __btree_lock_want(path, level);
if (!is_btree_node(path, level))
goto fail;
if (race_fault()) if (race_fault())
goto fail; goto fail;
...@@ -221,9 +218,6 @@ bool __bch2_btree_node_relock(struct btree_trans *trans, ...@@ -221,9 +218,6 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
return true; return true;
} }
fail: fail:
if (b != ERR_PTR(-BCH_ERR_no_btree_node_cached) &&
b != ERR_PTR(-BCH_ERR_no_btree_node_init) &&
b != ERR_PTR(-BCH_ERR_no_btree_node_up))
trace_btree_node_relock_fail(trans, _RET_IP_, path, level); trace_btree_node_relock_fail(trans, _RET_IP_, path, level);
return false; return false;
} }
......
...@@ -325,7 +325,8 @@ static inline bool bch2_btree_node_relock(struct btree_trans *trans, ...@@ -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)); btree_node_locked_type(path, level) != __btree_lock_want(path, level));
return likely(btree_node_locked(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 */ /* upgrade */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment