diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-15 10:20:46 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-05-21 20:14:16 -0400 |
| commit | 5022d0e18394c1c1cd41b5aae9ae6056b49ce678 (patch) | |
| tree | 2bd34fc9f7532c844d2d00af2b460565d5914415 /fs/bcachefs/super-io.c | |
| parent | bcachefs: Clean up option pre/post hooks, small fixes (diff) | |
| download | linux-5022d0e18394c1c1cd41b5aae9ae6056b49ce678.tar.gz linux-5022d0e18394c1c1cd41b5aae9ae6056b49ce678.zip | |
bcachefs: Incompatible features may now be enabled at runtime
version_upgrade is now a runtime option.
In the future we'll want to add compatible upgrades at runtime, and call
the full check_version_upgrade() when the option changes, but we don't
have compatible optional upgrades just yet.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.c')
| -rw-r--r-- | fs/bcachefs/super-io.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 2435e114cad9..8ebc5e3f3ea3 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -1274,6 +1274,31 @@ void bch2_sb_upgrade(struct bch_fs *c, unsigned new_version, bool incompat) } } +void bch2_sb_upgrade_incompat(struct bch_fs *c) +{ + mutex_lock(&c->sb_lock); + if (c->sb.version == c->sb.version_incompat_allowed) + goto unlock; + + struct printbuf buf = PRINTBUF; + + prt_str(&buf, "Now allowing incompatible features up to "); + bch2_version_to_text(&buf, c->sb.version); + prt_str(&buf, ", previously allowed up to "); + bch2_version_to_text(&buf, c->sb.version_incompat_allowed); + prt_newline(&buf); + + bch_notice(c, "%s", buf.buf); + printbuf_exit(&buf); + + c->disk_sb.sb->features[0] |= cpu_to_le64(BCH_SB_FEATURES_ALL); + SET_BCH_SB_VERSION_INCOMPAT_ALLOWED(c->disk_sb.sb, + max(BCH_SB_VERSION_INCOMPAT_ALLOWED(c->disk_sb.sb), c->sb.version)); + bch2_write_super(c); +unlock: + mutex_unlock(&c->sb_lock); +} + static int bch2_sb_ext_validate(struct bch_sb *sb, struct bch_sb_field *f, enum bch_validate_flags flags, struct printbuf *err) { |
