@@ -56,7 +56,8 @@ typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *,
56
56
57
57
static scan_cb_t dsl_scan_scrub_cb ;
58
58
static void dsl_scan_cancel_sync (void * , dmu_tx_t * );
59
- static void dsl_scan_sync_state (dsl_scan_t * , dmu_tx_t * tx );
59
+ static void dsl_scan_sync_state (dsl_scan_t * , dmu_tx_t * );
60
+ static boolean_t dsl_scan_restarting (dsl_scan_t * , dmu_tx_t * );
60
61
61
62
int zfs_top_maxinflight = 32 ; /* maximum I/Os per top-level */
62
63
int zfs_resilver_delay = 2 ; /* number of ticks to delay resilver */
@@ -329,8 +330,15 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
329
330
else
330
331
scn -> scn_phys .scn_state = DSS_CANCELED ;
331
332
332
- spa_history_log_internal (spa , "scan done" , tx ,
333
- "complete=%u" , complete );
333
+ if (dsl_scan_restarting (scn , tx ))
334
+ spa_history_log_internal (spa , "scan aborted, restarting" , tx ,
335
+ "errors=%llu" , spa_get_errlog_size (spa ));
336
+ else if (!complete )
337
+ spa_history_log_internal (spa , "scan cancelled" , tx ,
338
+ "errors=%llu" , spa_get_errlog_size (spa ));
339
+ else
340
+ spa_history_log_internal (spa , "scan done" , tx ,
341
+ "errors=%llu" , spa_get_errlog_size (spa ));
334
342
335
343
if (DSL_SCAN_IS_SCRUB_RESILVER (scn )) {
336
344
mutex_enter (& spa -> spa_scrub_lock );
@@ -1511,8 +1519,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
1511
1519
* that we can restart an old-style scan while the pool is being
1512
1520
* imported (see dsl_scan_init).
1513
1521
*/
1514
- if (scn -> scn_restart_txg != 0 &&
1515
- scn -> scn_restart_txg <= tx -> tx_txg ) {
1522
+ if (dsl_scan_restarting (scn , tx )) {
1516
1523
pool_scan_func_t func = POOL_SCAN_SCRUB ;
1517
1524
dsl_scan_done (scn , B_FALSE , tx );
1518
1525
if (vdev_resilver_needed (spa -> spa_root_vdev , NULL , NULL ))
@@ -1942,6 +1949,13 @@ dsl_scan(dsl_pool_t *dp, pool_scan_func_t func)
1942
1949
dsl_scan_setup_sync , & func , 0 , ZFS_SPACE_CHECK_NONE ));
1943
1950
}
1944
1951
1952
+ static boolean_t
1953
+ dsl_scan_restarting (dsl_scan_t * scn , dmu_tx_t * tx )
1954
+ {
1955
+ return (scn -> scn_restart_txg != 0 &&
1956
+ scn -> scn_restart_txg <= tx -> tx_txg );
1957
+ }
1958
+
1945
1959
#if defined(_KERNEL ) && defined(HAVE_SPL )
1946
1960
module_param (zfs_top_maxinflight , int , 0644 );
1947
1961
MODULE_PARM_DESC (zfs_top_maxinflight , "Max I/Os per top-level" );
0 commit comments