summaryrefslogtreecommitdiff
path: root/c_src/cmd_migrate.c
diff options
context:
space:
mode:
authorNikita Ofitserov <himikof@gmail.com>2025-09-07 00:12:41 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2025-09-06 17:56:19 -0400
commitb1021e7b3996b7f0d532e58bb576c1766a95bcb9 (patch)
tree7be9949f56c2e4c3fe43c06694c337ca05f731fc /c_src/cmd_migrate.c
parent805319c0ef475aad240c5e6557a5f512a139c05e (diff)
cmd_migrate: Make fsck after migrate-superblock debug-only
There is no reason to run a fsck there for common use, as the FS is now modified only by calling consistency-preserving APIs. Also switch the debug-only fsck to nochanges mode for easier debugging. 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.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/c_src/cmd_migrate.c b/c_src/cmd_migrate.c
index 057cf018..f211a0f2 100644
--- a/c_src/cmd_migrate.c
+++ b/c_src/cmd_migrate.c
@@ -495,20 +495,23 @@ int cmd_migrate_superblock(int argc, char *argv[])
bch2_fs_stop(c);
+#if CONFIG_BCACHEFS_DEBUG
+ /* Verify that filesystem is clean and consistent */
+
opts = bch2_opts_empty();
opt_set(opts, fsck, true);
opt_set(opts, fix_errors, true);
-
- /*
- * Hack: the free space counters are coming out wrong after marking the
- * new superblock, but it's just the device counters so it's
- * inconsequential:
- */
+ opt_set(opts, nochanges, true);
c = bch2_fs_open(&devs, &opts);
ret = PTR_ERR_OR_ZERO(c);
if (ret)
- die("error opening filesystem: %s", bch2_err_str(ret));
+ die("error checking filesystem: %s", bch2_err_str(ret));
+
+ if (test_bit(BCH_FS_errors, &c->flags) || test_bit(BCH_FS_errors_fixed, &c->flags))
+ die("Filesystem has errors after migration");
+
bch2_fs_stop(c);
+#endif
return 0;
}