Commit 099989c1 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix journal_iters_fix()

journal_iters_fix() was incorrectly rewinding iterators past keys they
had already returned, leading to those keys being double counted in the
bch2_gc() path - oops.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 1cab5a82
...@@ -147,7 +147,7 @@ static void journal_iters_fix(struct bch_fs *c) ...@@ -147,7 +147,7 @@ static void journal_iters_fix(struct bch_fs *c)
/* /*
* If an iterator points one after the key we just inserted, * If an iterator points one after the key we just inserted,
* and the key we just inserted compares >= the iterator's position, * and the key we just inserted compares > the iterator's position,
* decrement the iterator so it points at the key we just inserted: * decrement the iterator so it points at the key we just inserted:
*/ */
list_for_each_entry(iter, &c->journal_iters, journal.list) list_for_each_entry(iter, &c->journal_iters, journal.list)
...@@ -155,7 +155,7 @@ static void journal_iters_fix(struct bch_fs *c) ...@@ -155,7 +155,7 @@ static void journal_iters_fix(struct bch_fs *c)
iter->last && iter->last &&
iter->b->c.btree_id == n->btree_id && iter->b->c.btree_id == n->btree_id &&
iter->b->c.level == n->level && iter->b->c.level == n->level &&
bpos_cmp(n->k->k.p, iter->unpacked.p) >= 0) bpos_cmp(n->k->k.p, iter->unpacked.p) > 0)
iter->journal.idx = keys->gap - 1; iter->journal.idx = keys->gap - 1;
} }
......
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