summaryrefslogtreecommitdiff
path: root/libbcachefs/super-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/super-io.c')
-rw-r--r--libbcachefs/super-io.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libbcachefs/super-io.c b/libbcachefs/super-io.c
index 912c3696..dbc09e30 100644
--- a/libbcachefs/super-io.c
+++ b/libbcachefs/super-io.c
@@ -432,7 +432,10 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb,
bch2_version_to_text(out, BCH_SB_VERSION_INCOMPAT(sb));
prt_str(out, " > incompat_allowed ");
bch2_version_to_text(out, BCH_SB_VERSION_INCOMPAT_ALLOWED(sb));
- return -BCH_ERR_invalid_sb_version;
+ if (flags & BCH_VALIDATE_write)
+ return -BCH_ERR_invalid_sb_version;
+ else
+ SET_BCH_SB_VERSION_INCOMPAT_ALLOWED(sb, BCH_SB_VERSION_INCOMPAT(sb));
}
if (!flags) {
@@ -457,6 +460,11 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb,
SET_BCH_SB_PROMOTE_WHOLE_EXTENTS(sb, true);
}
+#ifdef __KERNEL__
+ if (!BCH_SB_SHARD_INUMS_NBITS(sb))
+ SET_BCH_SB_SHARD_INUMS_NBITS(sb, ilog2(roundup_pow_of_two(num_online_cpus())));
+#endif
+
for (opt_id = 0; opt_id < bch2_opts_nr; opt_id++) {
const struct bch_option *opt = bch2_opt_table + opt_id;