summaryrefslogtreecommitdiffstats
path: root/module/zfs/spa.c
diff options
context:
space:
mode:
authorAlek P <[email protected]>2017-07-06 22:16:13 -0700
committerBrian Behlendorf <[email protected]>2017-07-06 22:16:13 -0700
commit0ea05c64f8d08c20439dd2a06e949a2aa4115101 (patch)
tree28c543bbb096dfdb9809c754722445fa699d6ec4 /module/zfs/spa.c
parent94b25662c51696ec081494e69efb5896566dede2 (diff)
Implemented zpool scrub pause/resume
Currently, there is no way to pause a scrub. Pausing may be useful when the pool is busy with other I/O to preserve bandwidth. This patch adds the ability to pause and resume scrubbing. This is achieved by maintaining a persistent on-disk scrub state. While the state is 'paused' we do not scrub any more blocks. We do however perform regular scan housekeeping such as freeing async destroyed and deadlist blocks while paused. Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Thomas Caputi <[email protected]> Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alek Pinchuk <[email protected]> Closes #6167
Diffstat (limited to 'module/zfs/spa.c')
-rw-r--r--module/zfs/spa.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 031535321..d759ce718 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -29,6 +29,7 @@
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Toomas Soome <[email protected]>
* Copyright (c) 2016 Actifio, Inc. All rights reserved.
+ * Copyright (c) 2017 Datto Inc.
*/
/*
@@ -5726,6 +5727,16 @@ spa_vdev_setfru(spa_t *spa, uint64_t guid, const char *newfru)
* SPA Scanning
* ==========================================================================
*/
+int
+spa_scrub_pause_resume(spa_t *spa, pool_scrub_cmd_t cmd)
+{
+ ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == 0);
+
+ if (dsl_scan_resilvering(spa->spa_dsl_pool))
+ return (SET_ERROR(EBUSY));
+
+ return (dsl_scrub_set_pause_resume(spa->spa_dsl_pool, cmd));
+}
int
spa_scan_stop(spa_t *spa)