Commit b1d87f52 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_btree_iter_peek_slot() now saves initial position when searching

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 1d214eb1
......@@ -1869,10 +1869,22 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter)
}
} else {
struct bpos next;
struct bpos pos = iter->pos;
k = bch2_btree_iter_peek(iter);
iter->pos = pos;
if (iter->flags & BTREE_ITER_INTENT) {
struct btree_iter *child =
btree_iter_child_alloc(iter, _THIS_IP_);
btree_iter_copy(child, iter);
k = bch2_btree_iter_peek(child);
if (k.k && !bkey_err(k))
iter->k = child->k;
} else {
struct bpos pos = iter->pos;
k = bch2_btree_iter_peek(iter);
iter->pos = pos;
}
if (unlikely(bkey_err(k)))
return k;
......
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