summaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-07-10 19:23:01 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:06 +0300
commit6619d84626ff266721f4c3c24339c60ca8cb12e0 (patch)
treebc30f126a0bc155468f49db5bcfc92d352d85e91 /fs/bcachefs/recovery.c
parent01e691e830edae9a145eeb70f8983223d606e2ca (diff)
downloadlinux-6619d84626ff266721f4c3c24339c60ca8cb12e0.tar.xz
bcachefs: bch2_sb_maybe_downgrade(), bch2_sb_upgrade()
Add some new helpers, and fix upgrade/downgrade in bch2_fs_initialize(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r--fs/bcachefs/recovery.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 17ffac089a5d..9ca6c236f508 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1166,8 +1166,7 @@ static void check_version_upgrade(struct bch_fs *c)
c->opts.fix_errors = FSCK_OPT_YES;
mutex_lock(&c->sb_lock);
- c->disk_sb.sb->version = cpu_to_le16(new_version);
- c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL);
+ bch2_sb_upgrade(c, new_version);
mutex_unlock(&c->sb_lock);
printbuf_exit(&buf);
@@ -1525,10 +1524,11 @@ int bch2_fs_initialize(struct bch_fs *c)
c->disk_sb.sb->compat[0] |= cpu_to_le64(1ULL << BCH_COMPAT_extents_above_btree_updates_done);
c->disk_sb.sb->compat[0] |= cpu_to_le64(1ULL << BCH_COMPAT_bformat_overflow_done);
+ bch2_sb_maybe_downgrade(c);
+
if (c->opts.version_upgrade != BCH_VERSION_UPGRADE_none) {
- c->disk_sb.sb->version = cpu_to_le16(bcachefs_metadata_version_current);
+ bch2_sb_upgrade(c, bcachefs_metadata_version_current);
SET_BCH_SB_VERSION_UPGRADE_COMPLETE(c->disk_sb.sb, bcachefs_metadata_version_current);
- c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL);
bch2_write_super(c);
}
mutex_unlock(&c->sb_lock);