Rebase master to b108
[zfs.git] / module / zfs / dsl_scrub.c
index dbdfe8c..7836041 100644 (file)
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -95,6 +95,9 @@ dsl_pool_scrub_setup_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
                            ESC_ZFS_RESILVER_START);
                        dp->dp_scrub_max_txg = MIN(dp->dp_scrub_max_txg,
                            tx->tx_txg);
+               } else {
+                       spa_event_notify(dp->dp_spa, NULL,
+                           ESC_ZFS_SCRUB_START);
                }
 
                /* zero out the scrub stats in all vdev_stat_t's */
@@ -212,8 +215,9 @@ dsl_pool_scrub_cancel_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
         */
        vdev_dtl_reassess(dp->dp_spa->spa_root_vdev, tx->tx_txg,
            *completep ? dp->dp_scrub_max_txg : 0, B_TRUE);
-       if (dp->dp_scrub_min_txg && *completep)
-               spa_event_notify(dp->dp_spa, NULL, ESC_ZFS_RESILVER_FINISH);
+       if (*completep)
+               spa_event_notify(dp->dp_spa, NULL, dp->dp_scrub_min_txg ?
+                   ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH);
        spa_errlog_rotate(dp->dp_spa);
 
        /*