static int scan_ds_queue_compare(const void *a, const void *b);
static int scan_prefetch_queue_compare(const void *a, const void *b);
static void scan_ds_queue_clear(dsl_scan_t *scn);
+static void scan_ds_prefetch_queue_clear(dsl_scan_t *scn);
static boolean_t scan_ds_queue_contains(dsl_scan_t *scn, uint64_t dsobj,
uint64_t *txg);
static void scan_ds_queue_insert(dsl_scan_t *scn, uint64_t dsobj, uint64_t txg);
if (scn->scn_taskq != NULL)
taskq_destroy(scn->scn_taskq);
+
scan_ds_queue_clear(scn);
avl_destroy(&scn->scn_queue);
+ scan_ds_prefetch_queue_clear(scn);
avl_destroy(&scn->scn_prefetch_queue);
kmem_free(dp->dp_scan, sizeof (dsl_scan_t));
scn->scn_phys.scn_queue_obj = 0;
}
scan_ds_queue_clear(scn);
+ scan_ds_prefetch_queue_clear(scn);
scn->scn_phys.scn_flags &= ~DSF_SCRUB_PAUSED;
zfs_refcount_add(&spc->spc_refcnt, tag);
}
+static void
+scan_ds_prefetch_queue_clear(dsl_scan_t *scn)
+{
+ spa_t *spa = scn->scn_dp->dp_spa;
+ void *cookie = NULL;
+ scan_prefetch_issue_ctx_t *spic = NULL;
+
+ mutex_enter(&spa->spa_scrub_lock);
+ while ((spic = avl_destroy_nodes(&scn->scn_prefetch_queue,
+ &cookie)) != NULL) {
+ scan_prefetch_ctx_rele(spic->spic_spc, scn);
+ kmem_free(spic, sizeof (scan_prefetch_issue_ctx_t));
+ }
+ mutex_exit(&spa->spa_scrub_lock);
+}
+
static boolean_t
dsl_scan_check_prefetch_resume(scan_prefetch_ctx_t *spc,
const zbookmark_phys_t *zb)