diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-04 20:40:29 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:50 -0400 |
commit | 4e3d18991a7d1138604f0975e7849d9a2d82c524 (patch) | |
tree | f16311b7e933cfe77a59dcaf72ad725c53f30967 /fs/bcachefs/btree_iter.c | |
parent | 419fc65f8cfbadb29b2024457bf914787af8db91 (diff) |
bcachefs: Inline bch2_btree_path_traverse() fastpath
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_iter.c')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 5034f8ebfb04..3774ee8577a9 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -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) { |