mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
bcachefs: Inline bch2_btree_path_traverse() fastpath
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
419fc65f8c
commit
4e3d18991a
@ -962,8 +962,6 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int btree_path_traverse_one(struct btree_trans *, struct btree_path *,
|
||||
unsigned, unsigned long);
|
||||
|
||||
static int bch2_btree_path_traverse_all(struct btree_trans *trans)
|
||||
{
|
||||
@ -1009,7 +1007,7 @@ retry_all:
|
||||
*/
|
||||
if (path->uptodate) {
|
||||
__btree_path_get(path, false);
|
||||
ret = btree_path_traverse_one(trans, path, 0, _THIS_IP_);
|
||||
ret = bch2_btree_path_traverse_one(trans, path, 0, _THIS_IP_);
|
||||
__btree_path_put(path, false);
|
||||
|
||||
if (bch2_err_matches(ret, BCH_ERR_transaction_restart) ||
|
||||
@ -1114,10 +1112,10 @@ static inline unsigned btree_path_up_until_good_node(struct btree_trans *trans,
|
||||
* On error, caller (peek_node()/peek_key()) must return NULL; the error is
|
||||
* stashed in the iterator and returned from bch2_trans_exit().
|
||||
*/
|
||||
static int btree_path_traverse_one(struct btree_trans *trans,
|
||||
struct btree_path *path,
|
||||
unsigned flags,
|
||||
unsigned long trace_ip)
|
||||
int bch2_btree_path_traverse_one(struct btree_trans *trans,
|
||||
struct btree_path *path,
|
||||
unsigned flags,
|
||||
unsigned long trace_ip)
|
||||
{
|
||||
unsigned depth_want = path->level;
|
||||
int ret = -((int) trans->restarted);
|
||||
@ -1181,26 +1179,6 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int __must_check bch2_btree_path_traverse(struct btree_trans *trans,
|
||||
struct btree_path *path, unsigned flags)
|
||||
{
|
||||
if (0 && IS_ENABLED(CONFIG_BCACHEFS_DEBUG)) {
|
||||
unsigned restart_probability_bits = 4 << min(trans->restart_count, 32U);
|
||||
u64 max = ~(~0ULL << restart_probability_bits);
|
||||
|
||||
if (!get_random_u32_below(max)) {
|
||||
trace_and_count(trans->c, trans_restart_injected, trans, _RET_IP_);
|
||||
return btree_trans_restart(trans, BCH_ERR_transaction_restart_fault_inject);
|
||||
}
|
||||
}
|
||||
|
||||
if (path->uptodate < BTREE_ITER_NEED_RELOCK)
|
||||
return 0;
|
||||
|
||||
return bch2_trans_cond_resched(trans) ?:
|
||||
btree_path_traverse_one(trans, path, flags, _RET_IP_);
|
||||
}
|
||||
|
||||
static inline void btree_path_copy(struct btree_trans *trans, struct btree_path *dst,
|
||||
struct btree_path *src)
|
||||
{
|
||||
|
@ -174,6 +174,18 @@ bch2_btree_path_set_pos(struct btree_trans *trans,
|
||||
: path;
|
||||
}
|
||||
|
||||
int __must_check bch2_btree_path_traverse_one(struct btree_trans *, struct btree_path *,
|
||||
unsigned, unsigned long);
|
||||
|
||||
static inline int __must_check bch2_btree_path_traverse(struct btree_trans *trans,
|
||||
struct btree_path *path, unsigned flags)
|
||||
{
|
||||
if (path->uptodate < BTREE_ITER_NEED_RELOCK)
|
||||
return 0;
|
||||
|
||||
return bch2_btree_path_traverse_one(trans, path, flags, _RET_IP_);
|
||||
}
|
||||
|
||||
int __must_check bch2_btree_path_traverse(struct btree_trans *,
|
||||
struct btree_path *, unsigned);
|
||||
struct btree_path *bch2_path_get(struct btree_trans *, enum btree_id, struct bpos,
|
||||
|
Loading…
Reference in New Issue
Block a user