mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-03 22:57:21 -04:00
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>
This commit is contained in:
@@ -208,9 +208,6 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
|
||||
struct btree *b = btree_path_node(path, level);
|
||||
int want = __btree_lock_want(path, level);
|
||||
|
||||
if (!is_btree_node(path, level))
|
||||
goto fail;
|
||||
|
||||
if (race_fault())
|
||||
goto fail;
|
||||
|
||||
@@ -221,10 +218,7 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user