MFV r328247: 8959 Add notifications when a scrub is paused or resumed

illumos/illumos-gate@301fd1d6f2

Reviewed by: Alek Pinchuk <pinchuk.alek@gmail.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Sean Eric Fagan <sef@ixsystems.com>
This commit is contained in:
Alexander Motin 2018-01-22 04:31:48 +00:00
commit b5eb78f824
2 changed files with 8 additions and 1 deletions

View File

@ -387,6 +387,7 @@ dsl_scan_cancel_sync(void *arg, dmu_tx_t *tx)
dsl_scan_done(scn, B_FALSE, tx);
dsl_scan_sync_state(scn, tx);
spa_event_notify(scn->scn_dp->dp_spa, NULL, ESC_ZFS_SCRUB_ABORT);
}
int
@ -441,6 +442,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx)
spa->spa_scan_pass_scrub_pause = gethrestime_sec();
scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED;
dsl_scan_sync_state(scn, tx);
spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_PAUSED);
} else {
ASSERT3U(*cmd, ==, POOL_SCRUB_NORMAL);
if (dsl_scan_is_paused_scrub(scn)) {
@ -2012,8 +2014,10 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func)
/* got scrub start cmd, resume paused scrub */
int err = dsl_scrub_set_pause_resume(scn->scn_dp,
POOL_SCRUB_NORMAL);
if (err == 0)
if (err == 0) {
spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_RESUME);
return (ECANCELED);
}
return (SET_ERROR(err));
}

View File

@ -262,6 +262,9 @@ extern "C" {
#define ESC_ZFS_CONFIG_SYNC "ESC_ZFS_config_sync"
#define ESC_ZFS_SCRUB_START "ESC_ZFS_scrub_start"
#define ESC_ZFS_SCRUB_FINISH "ESC_ZFS_scrub_finish"
#define ESC_ZFS_SCRUB_ABORT "ESC_ZFS_scrub_abort"
#define ESC_ZFS_SCRUB_RESUME "ESC_ZFS_scrub_resume"
#define ESC_ZFS_SCRUB_PAUSED "ESC_ZFS_scrub_paused"
#define ESC_ZFS_VDEV_SPARE "ESC_ZFS_vdev_spare"
#define ESC_ZFS_BOOTFS_VDEV_ATTACH "ESC_ZFS_bootfs_vdev_attach"
#define ESC_ZFS_POOL_REGUID "ESC_ZFS_pool_reguid"