* can contribute to the progress counter. Hence we need to set
* nr_threads appropriately to handle that many threads.
*/
- *nr_threads = disk_heads(ctx->verify_disks[XFS_DEV_DATA]);
- if (ctx->verify_disks[XFS_DEV_RT])
- *nr_threads += disk_heads(ctx->verify_disks[XFS_DEV_RT]);
- if (ctx->verify_disks[XFS_DEV_LOG])
- *nr_threads += disk_heads(ctx->verify_disks[XFS_DEV_LOG]);
+ *nr_threads = read_verify_nproc(ctx);
+ if (ctx->fsinfo.fs_rt)
+ *nr_threads += read_verify_nproc(ctx);
+ if (ctx->fsinfo.fs_log)
+ *nr_threads += read_verify_nproc(ctx);
*rshift = 20;
return 0;
}
int runtime_error;
};
+unsigned int
+read_verify_nproc(
+ struct scrub_ctx *ctx)
+{
+ if (force_nr_threads)
+ return force_nr_threads;
+
+ /*
+ * Throwing all CPUs at verifying seems like a bad idea for foreground
+ * scrub, as does abusing I/O opt/min as that says absolutely nothing
+ * about parallelism. The authors observed diminishing returns on
+ * verification speed past 8 IO threads, so that's the default.
+ */
+ return 8;
+}
+
/*
* Create a thread pool to run read verifiers.
*
struct read_verify_pool **prvp)
{
struct read_verify_pool *rvp;
- unsigned int verifier_threads =
- disk_heads(ctx->verify_disks[XFS_DEV_DATA]);
+ const unsigned int verifier_threads =
+ read_verify_nproc(ctx);
int ret;
if (rvp_io_max_size() % ctx->mnt.fsgeom.blocksize)
int read_verify_bytes(struct read_verify_pool *rvp, uint64_t *bytes);
+unsigned int read_verify_nproc(struct scrub_ctx *ctx);
+
#endif /* XFS_SCRUB_READ_VERIFY_H_ */