mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Teach zpool scrub to scrub only blocks in error log
Added a flag '-e' in zpool scrub to scrub only blocks in error log. A user can pause, resume and cancel the error scrub by passing additional command line arguments -p -s just like a regular scrub. This involves adding a new flag, creating new libzfs interfaces, a new ioctl, and the actual iteration and read-issuing logic. Error scrubbing is executed in multiple txg to make sure pool performance is not affected. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Co-authored-by: TulsiJain tulsi.jain@delphix.com Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #8995 Closes #12355
This commit is contained in:
committed by
Brian Behlendorf
parent
e34e15ed6d
commit
482eeef804
+24
-1
@@ -2579,9 +2579,18 @@ spa_scan_stat_init(spa_t *spa)
|
||||
spa->spa_scan_pass_scrub_pause = spa->spa_scan_pass_start;
|
||||
else
|
||||
spa->spa_scan_pass_scrub_pause = 0;
|
||||
|
||||
if (dsl_errorscrub_is_paused(spa->spa_dsl_pool->dp_scan))
|
||||
spa->spa_scan_pass_errorscrub_pause = spa->spa_scan_pass_start;
|
||||
else
|
||||
spa->spa_scan_pass_errorscrub_pause = 0;
|
||||
|
||||
spa->spa_scan_pass_scrub_spent_paused = 0;
|
||||
spa->spa_scan_pass_exam = 0;
|
||||
spa->spa_scan_pass_issued = 0;
|
||||
|
||||
// error scrub stats
|
||||
spa->spa_scan_pass_errorscrub_spent_paused = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2592,8 +2601,10 @@ spa_scan_get_stats(spa_t *spa, pool_scan_stat_t *ps)
|
||||
{
|
||||
dsl_scan_t *scn = spa->spa_dsl_pool ? spa->spa_dsl_pool->dp_scan : NULL;
|
||||
|
||||
if (scn == NULL || scn->scn_phys.scn_func == POOL_SCAN_NONE)
|
||||
if (scn == NULL || (scn->scn_phys.scn_func == POOL_SCAN_NONE &&
|
||||
scn->errorscrub_phys.dep_func == POOL_SCAN_NONE))
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
memset(ps, 0, sizeof (pool_scan_stat_t));
|
||||
|
||||
/* data stored on disk */
|
||||
@@ -2616,6 +2627,18 @@ spa_scan_get_stats(spa_t *spa, pool_scan_stat_t *ps)
|
||||
ps->pss_issued =
|
||||
scn->scn_issued_before_pass + spa->spa_scan_pass_issued;
|
||||
|
||||
/* error scrub data stored on disk */
|
||||
ps->pss_error_scrub_func = scn->errorscrub_phys.dep_func;
|
||||
ps->pss_error_scrub_state = scn->errorscrub_phys.dep_state;
|
||||
ps->pss_error_scrub_start = scn->errorscrub_phys.dep_start_time;
|
||||
ps->pss_error_scrub_end = scn->errorscrub_phys.dep_end_time;
|
||||
ps->pss_error_scrub_examined = scn->errorscrub_phys.dep_examined;
|
||||
ps->pss_error_scrub_to_be_examined =
|
||||
scn->errorscrub_phys.dep_to_examine;
|
||||
|
||||
/* error scrub data not stored on disk */
|
||||
ps->pss_pass_error_scrub_pause = spa->spa_scan_pass_errorscrub_pause;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user