Commit 4f948723 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix bch2_journal_keys_peek_upto()

bch2_journal_keys_peek_upto() was comparing against btree_id & level
incorrectly - fix this by using __journal_key_cmp().
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ac9fa4bd
......@@ -128,12 +128,12 @@ struct bkey_i *bch2_journal_keys_peek_upto(struct bch_fs *c, enum btree_id btree
if (!*idx)
*idx = __bch2_journal_key_search(keys, btree_id, level, pos);
while (*idx < keys->nr &&
(k = idx_to_key(keys, *idx),
k->btree_id == btree_id &&
k->level == level &&
bpos_le(k->k->k.p, end_pos))) {
if (bpos_ge(k->k->k.p, pos) && !k->overwritten)
while ((k = *idx < keys->nr ? idx_to_key(keys, *idx) : NULL)) {
if (__journal_key_cmp(btree_id, level, end_pos, k) < 0)
return NULL;
if (__journal_key_cmp(btree_id, level, pos, k) <= 0 &&
!k->overwritten)
return k->k;
(*idx)++;
......
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