[CFR] Tunables for scrub and resilver
Martin Matuska
mm at FreeBSD.org
Sun Jul 1 15:48:20 UTC 2012
Hi,
I would like to hear your opinion on the attached patch to add scrub and
resilver tunables.
This way users can add more priority to scrub and resilver (make it
faster) at cost of other I/O etc.
On-line version of the patch:
http://people.freebsd.org/~mm/patches/zfs/dsl_scan.patch
The patch adds tuning for all of the dsl_scan.c tunables, as available
in illumos.
zfs_resilver_delay and zfs_scrub_delay (resulting in scan_delay) need to
be non-negative, otherwise we trigger a kernel assert in pause().
Other values are used for timer comparsions and should be safe even if
negative (resulting behavior equals a value of zero).
Thanks,
mm
--
Martin Matuska
FreeBSD committer
http://blog.vx.sk
-------------- next part --------------
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c (revision 237745)
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c (working copy)
@@ -68,6 +68,36 @@
int zfs_resilver_min_time_ms = 3000; /* min millisecs to resilver per txg */
boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */
boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */
+
+SYSCTL_DECL(_vfs_zfs);
+TUNABLE_INT("vfs.zfs.top_maxinflight", &zfs_top_maxinflight);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, top_maxinflight, CTLFLAG_RW,
+ &zfs_top_maxinflight, 0, "Maximum I/Os per top-level vdev");
+TUNABLE_INT("vfs.zfs.resilver_delay", &zfs_resilver_delay);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, resilver_delay, CTLFLAG_RW,
+ &zfs_resilver_delay, 0, "Number of ticks to delay resilver");
+TUNABLE_INT("vfs.zfs.scrub_delay", &zfs_scrub_delay);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, scrub_delay, CTLFLAG_RW,
+ &zfs_scrub_delay, 0, "Number of ticks to delay scrub");
+TUNABLE_INT("vfs.zfs.scan_idle", &zfs_scan_idle);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, scan_idle, CTLFLAG_RW,
+ &zfs_scan_idle, 0, "Idle scan window in clock ticks");
+TUNABLE_INT("vfs.zfs.scan_min_time_ms", &zfs_scan_min_time_ms);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, scan_min_time_ms, CTLFLAG_RW,
+ &zfs_scan_min_time_ms, 0, "Min millisecs to scrub per txg");
+TUNABLE_INT("vfs.zfs.free_min_time_ms", &zfs_free_min_time_ms);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, free_min_time_ms, CTLFLAG_RW,
+ &zfs_free_min_time_ms, 0, "Min millisecs to free per txg");
+TUNABLE_INT("vfs.zfs.resilver_min_time_ms", &zfs_resilver_min_time_ms);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, resilver_min_time_ms, CTLFLAG_RW,
+ &zfs_resilver_min_time_ms, 0, "Min millisecs to resilver per txg");
+TUNABLE_INT("vfs.zfs.no_scrub_io", &zfs_no_scrub_io);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_io, CTLFLAG_RW,
+ &zfs_no_scrub_io, 0, "Disable scrub I/O");
+TUNABLE_INT("vfs.zfs.no_scrub_prefetch", &zfs_no_scrub_prefetch);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, no_scrub_prefetch, CTLFLAG_RW,
+ &zfs_no_scrub_prefetch, 0, "Disable scrub prefetching");
+
enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE;
#define DSL_SCAN_IS_SCRUB_RESILVER(scn) \
@@ -1709,7 +1739,7 @@
* then throttle our workload to limit the impact of a scan.
*/
if (ddi_get_lbolt64() - spa->spa_last_io <= zfs_scan_idle)
- delay(scan_delay);
+ delay(MAX(scan_delay,0));
zio_nowait(zio_read(NULL, spa, bp, data, size,
dsl_scan_scrub_done, NULL, zio_priority,
More information about the zfs-devel
mailing list