bcachefs: Journal keys overlay fixes
- In the btree iterator code that overlays keys from the journal, we were incorrectly specifying level=0 instead of the btree_path's current level in a few places - When we didn't do journal replay, we shouldn't free the journal keys: this fixes cmd_list and cmd_dump, which run in norecovery mode Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -1834,7 +1834,7 @@ struct bkey_s_c btree_trans_peek_journal(struct btree_trans *trans,
|
|||||||
{
|
{
|
||||||
struct bkey_i *next_journal =
|
struct bkey_i *next_journal =
|
||||||
bch2_btree_journal_peek(trans, iter,
|
bch2_btree_journal_peek(trans, iter,
|
||||||
k.k ? k.k->p : iter->path->l[0].b->key.k.p);
|
k.k ? k.k->p : path_l(iter->path)->b->key.k.p);
|
||||||
|
|
||||||
if (next_journal) {
|
if (next_journal) {
|
||||||
iter->k = next_journal->k;
|
iter->k = next_journal->k;
|
||||||
|
@@ -1398,7 +1398,8 @@ out:
|
|||||||
set_bit(BCH_FS_FSCK_DONE, &c->flags);
|
set_bit(BCH_FS_FSCK_DONE, &c->flags);
|
||||||
bch2_flush_fsck_errs(c);
|
bch2_flush_fsck_errs(c);
|
||||||
|
|
||||||
if (!c->opts.keep_journal) {
|
if (!c->opts.keep_journal &&
|
||||||
|
test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags)) {
|
||||||
bch2_journal_keys_free(&c->journal_keys);
|
bch2_journal_keys_free(&c->journal_keys);
|
||||||
bch2_journal_entries_free(c);
|
bch2_journal_entries_free(c);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user