From b1021e7b3996b7f0d532e58bb576c1766a95bcb9 Mon Sep 17 00:00:00 2001 From: Nikita Ofitserov Date: Sun, 7 Sep 2025 00:12:41 +0300 Subject: 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 Signed-off-by: Kent Overstreet --- c_src/cmd_migrate.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'c_src/cmd_migrate.c') 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; } -- cgit v1.2.3