summaryrefslogtreecommitdiff
path: root/libbcachefs/super-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-12-06 20:48:25 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-12-08 16:00:44 -0500
commit8b31dfb3500fc642ccd36f0aaa0c3ab1b54abb1c (patch)
tree6144105d041efc511d5797a106feff718e1fba55 /libbcachefs/super-io.c
parent2aeeac7785d647c02ef5612795025f3c9ce436ec (diff)
Update bcachefs sources to 55a65a994ed5 bcachefs: bcachefs_metadata_version_persistent_inode_cursors
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
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;