summaryrefslogtreecommitdiff
path: root/c_src/cmd_migrate.c
diff options
context:
space:
mode:
authorNikita Ofitserov <himikof@gmail.com>2025-09-07 00:06:09 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2025-09-06 17:56:19 -0400
commit85184478aa90f0681bad57616a6d2a2d4dd50cee (patch)
tree69650f0b69f1b0ec891894ceda7a7f6e0a59ff2e /c_src/cmd_migrate.c
parent020763ad669681821922031097e4140cd39f7d67 (diff)
cmd_migrate: Small fixes
Ensure that the space for the future default sb layout is not used during the migration process. Signed-off-by: Nikita Ofitserov <himikof@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/cmd_migrate.c')
-rw-r--r--c_src/cmd_migrate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/c_src/cmd_migrate.c b/c_src/cmd_migrate.c
index ee6590e3..7c5f5b45 100644
--- a/c_src/cmd_migrate.c
+++ b/c_src/cmd_migrate.c
@@ -108,6 +108,10 @@ static void mark_unreserved_space(struct bch_fs *c, ranges extents)
mark_nouse_range(ca, i.start >> 9,
round_up(i.end, 1 << 9) >> 9);
}
+
+ /* Also be sure to mark the space for the default sb layout */
+ unsigned sb_size = 1U << ca->disk_sb.sb->layout.sb_max_size_bits;
+ mark_nouse_range(ca, 0, BCH_SB_SECTOR + sb_size * 2);
}
static ranges reserve_new_fs_space(const char *file_path, unsigned block_size,
@@ -283,7 +287,7 @@ static int migrate_fs(const char *fs_path,
.dev = stat.st_dev,
.extents = extents,
.type = BCH_MIGRATE_migrate,
- .reserve_start = roundup((format_opts.superblock_size * 2 + 8) << 9,
+ .reserve_start = roundup((format_opts.superblock_size * 2 + BCH_SB_SECTOR) << 9,
bucket_bytes(c->devs[0])),
};