mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Use dsl_scan_setup_check() to setup a scrub
When a rebuild completes it will automatically schedule a follow up scrub to verify all of the block checksums. Before setting up the scrub execute the counterpart dsl_scan_setup_check() function to confirm the scrub can be started. Prior to this change we'd only check vdev_rebuild_active() which isn't as comprehensive, and using the check function keeps all of this logic in one place. Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #11849
This commit is contained in:
parent
9c3b926b0e
commit
600a1dc54c
@ -163,6 +163,7 @@ typedef struct dsl_scan_io_queue dsl_scan_io_queue_t;
|
|||||||
void scan_init(void);
|
void scan_init(void);
|
||||||
void scan_fini(void);
|
void scan_fini(void);
|
||||||
int dsl_scan_init(struct dsl_pool *dp, uint64_t txg);
|
int dsl_scan_init(struct dsl_pool *dp, uint64_t txg);
|
||||||
|
int dsl_scan_setup_check(void *, dmu_tx_t *);
|
||||||
void dsl_scan_setup_sync(void *, dmu_tx_t *);
|
void dsl_scan_setup_sync(void *, dmu_tx_t *);
|
||||||
void dsl_scan_fini(struct dsl_pool *dp);
|
void dsl_scan_fini(struct dsl_pool *dp);
|
||||||
void dsl_scan_sync(struct dsl_pool *, dmu_tx_t *);
|
void dsl_scan_sync(struct dsl_pool *, dmu_tx_t *);
|
||||||
|
@ -701,7 +701,7 @@ dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx, state_sync_type_t sync_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
static int
|
int
|
||||||
dsl_scan_setup_check(void *arg, dmu_tx_t *tx)
|
dsl_scan_setup_check(void *arg, dmu_tx_t *tx)
|
||||||
{
|
{
|
||||||
dsl_scan_t *scn = dmu_tx_pool(tx)->dp_scan;
|
dsl_scan_t *scn = dmu_tx_pool(tx)->dp_scan;
|
||||||
|
@ -331,9 +331,9 @@ vdev_rebuild_complete_sync(void *arg, dmu_tx_t *tx)
|
|||||||
* While we're in syncing context take the opportunity to
|
* While we're in syncing context take the opportunity to
|
||||||
* setup the scrub when there are no more active rebuilds.
|
* setup the scrub when there are no more active rebuilds.
|
||||||
*/
|
*/
|
||||||
if (!vdev_rebuild_active(spa->spa_root_vdev) &&
|
pool_scan_func_t func = POOL_SCAN_SCRUB;
|
||||||
|
if (dsl_scan_setup_check(&func, tx) == 0 &&
|
||||||
zfs_rebuild_scrub_enabled) {
|
zfs_rebuild_scrub_enabled) {
|
||||||
pool_scan_func_t func = POOL_SCAN_SCRUB;
|
|
||||||
dsl_scan_setup_sync(&func, tx);
|
dsl_scan_setup_sync(&func, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user