mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 23:00:21 +00:00
bcachefs: Run scan_old_btree_nodes after version upgrade
In the recovery path, we scan for old btree nodes if we don't have certain compat bits set. If we do this, we should be doing it after we upgraded to the newest on disk format. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
862bfd5062
commit
d93cf6858f
@ -1298,33 +1298,14 @@ use_clean:
|
||||
bch_verbose(c, "quotas done");
|
||||
}
|
||||
|
||||
if (!(c->sb.compat & (1ULL << BCH_COMPAT_extents_above_btree_updates_done)) ||
|
||||
!(c->sb.compat & (1ULL << BCH_COMPAT_bformat_overflow_done)) ||
|
||||
le16_to_cpu(c->sb.version_min) < bcachefs_metadata_version_btree_ptr_sectors_written) {
|
||||
struct bch_move_stats stats;
|
||||
|
||||
bch_move_stats_init(&stats, "recovery");
|
||||
|
||||
bch_info(c, "scanning for old btree nodes");
|
||||
ret = bch2_fs_read_write(c);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = bch2_scan_old_btree_nodes(c, &stats);
|
||||
if (ret)
|
||||
goto err;
|
||||
bch_info(c, "scanning for old btree nodes done");
|
||||
}
|
||||
|
||||
mutex_lock(&c->sb_lock);
|
||||
/*
|
||||
* With journal replay done, we can clear the journal seq blacklist
|
||||
* table:
|
||||
*/
|
||||
BUG_ON(!test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags));
|
||||
BUG_ON(le16_to_cpu(c->sb.version_min) < bcachefs_metadata_version_btree_ptr_sectors_written);
|
||||
|
||||
bch2_sb_resize_journal_seq_blacklist(&c->disk_sb, 0);
|
||||
if (le16_to_cpu(c->sb.version_min) >= bcachefs_metadata_version_btree_ptr_sectors_written)
|
||||
bch2_sb_resize_journal_seq_blacklist(&c->disk_sb, 0);
|
||||
|
||||
if (c->opts.version_upgrade) {
|
||||
c->disk_sb.sb->version = cpu_to_le16(bcachefs_metadata_version_current);
|
||||
@ -1349,6 +1330,24 @@ use_clean:
|
||||
bch2_write_super(c);
|
||||
mutex_unlock(&c->sb_lock);
|
||||
|
||||
if (!(c->sb.compat & (1ULL << BCH_COMPAT_extents_above_btree_updates_done)) ||
|
||||
!(c->sb.compat & (1ULL << BCH_COMPAT_bformat_overflow_done)) ||
|
||||
le16_to_cpu(c->sb.version_min) < bcachefs_metadata_version_btree_ptr_sectors_written) {
|
||||
struct bch_move_stats stats;
|
||||
|
||||
bch_move_stats_init(&stats, "recovery");
|
||||
|
||||
bch_info(c, "scanning for old btree nodes");
|
||||
ret = bch2_fs_read_write(c);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = bch2_scan_old_btree_nodes(c, &stats);
|
||||
if (ret)
|
||||
goto err;
|
||||
bch_info(c, "scanning for old btree nodes done");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
set_bit(BCH_FS_FSCK_DONE, &c->flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user