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 ...@@ -128,12 +128,12 @@ struct bkey_i *bch2_journal_keys_peek_upto(struct bch_fs *c, enum btree_id btree
if (!*idx) if (!*idx)
*idx = __bch2_journal_key_search(keys, btree_id, level, pos); *idx = __bch2_journal_key_search(keys, btree_id, level, pos);
while (*idx < keys->nr && while ((k = *idx < keys->nr ? idx_to_key(keys, *idx) : NULL)) {
(k = idx_to_key(keys, *idx), if (__journal_key_cmp(btree_id, level, end_pos, k) < 0)
k->btree_id == btree_id && return NULL;
k->level == level &&
bpos_le(k->k->k.p, end_pos))) { if (__journal_key_cmp(btree_id, level, pos, k) <= 0 &&
if (bpos_ge(k->k->k.p, pos) && !k->overwritten) !k->overwritten)
return k->k; return k->k;
(*idx)++; (*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