]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - scrub/phase1.c
xfs_scrub: use datadev parallelization estimates for thread count
[thirdparty/xfsprogs-dev.git] / scrub / phase1.c
index 2113014be6ed9dd87034dd483aacda91f9790a56..6b472147f866386f17acb039ff4f25d6bae0d9eb 100644 (file)
@@ -109,13 +109,6 @@ _("Must be root to run scrub."));
                return false;
        }
 
-       ctx->nr_io_threads = nproc;
-       if (verbose) {
-               fprintf(stdout, _("%s: using %d threads to scrub.\n"),
-                               ctx->mntpoint, scrub_nproc(ctx));
-               fflush(stdout);
-       }
-
        if (!platform_test_xfs_fd(ctx->mnt_fd)) {
                str_info(ctx, ctx->mntpoint,
 _("Does not appear to be an XFS filesystem!"));
@@ -193,6 +186,13 @@ _("Unable to find realtime device path."));
                return false;
        }
 
+       ctx->nr_io_threads = disk_heads(ctx->datadev);
+       if (verbose) {
+               fprintf(stdout, _("%s: using %d threads to scrub.\n"),
+                               ctx->mntpoint, scrub_nproc(ctx));
+               fflush(stdout);
+       }
+
        if (ctx->fsinfo.fs_log) {
                ctx->logdev = disk_open(ctx->fsinfo.fs_log);
                if (error) {