summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-08-16 01:55:20 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:38 +0300
commit223b560e02098502b4e1c87aa9767620852d1bfd (patch)
treeac8bcfdc305401e8643acc3cfe7909e87b30bf86
parentbbf4288401519a7554201caf9b945c79f29753b3 (diff)
downloadlinux-223b560e02098502b4e1c87aa9767620852d1bfd.tar.xz
bcachefs: btree_path_down() optimization
We should be calling btree_node_mem_ptr_set() before path_level_init(), since we already touched the key that btree_node_mem_ptr_set() will modify and path_level_init() will be doing the lookup in the child btree node we're recursing to. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/btree_iter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 08f39687e964..a464327d7024 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1410,9 +1410,6 @@ static __always_inline int btree_path_down(struct btree_trans *trans,
if (unlikely(ret))
goto err;
- mark_btree_node_locked(trans, path, level, lock_type);
- btree_path_level_init(trans, path, b);
-
if (likely(!trans->journal_replay_not_finished &&
tmp.k->k.type == KEY_TYPE_btree_ptr_v2) &&
unlikely(b != btree_node_mem_ptr(tmp.k)))
@@ -1420,7 +1417,10 @@ static __always_inline int btree_path_down(struct btree_trans *trans,
if (btree_node_read_locked(path, level + 1))
btree_node_unlock(trans, path, level + 1);
+
+ mark_btree_node_locked(trans, path, level, lock_type);
path->level = level;
+ btree_path_level_init(trans, path, b);
bch2_btree_path_verify_locks(path);
err: