Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c
Show First 20 Lines • Show All 1,106 Lines • ▼ Show 20 Lines | ddt_sync_table(ddt_t *ddt, dmu_tx_t *tx, uint64_t txg) | ||||
bcopy(ddt->ddt_histogram, &ddt->ddt_histogram_cache, | bcopy(ddt->ddt_histogram, &ddt->ddt_histogram_cache, | ||||
sizeof (ddt->ddt_histogram)); | sizeof (ddt->ddt_histogram)); | ||||
} | } | ||||
void | void | ||||
ddt_sync(spa_t *spa, uint64_t txg) | ddt_sync(spa_t *spa, uint64_t txg) | ||||
{ | { | ||||
dsl_scan_t *scn = spa->spa_dsl_pool->dp_scan; | |||||
dmu_tx_t *tx; | dmu_tx_t *tx; | ||||
zio_t *rio = zio_root(spa, NULL, NULL, | zio_t *rio; | ||||
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_SELF_HEAL); | |||||
ASSERT(spa_syncing_txg(spa) == txg); | ASSERT(spa_syncing_txg(spa) == txg); | ||||
tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg); | tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg); | ||||
rio = zio_root(spa, NULL, NULL, | |||||
ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_SELF_HEAL); | |||||
/* | |||||
* This function may cause an immediate scan of ddt blocks (see | |||||
* the comment above dsl_scan_ddt() for details). We set the | |||||
* scan's root zio here so that we can wait for any scan IOs in | |||||
* addition to the regular ddt IOs. | |||||
*/ | |||||
ASSERT3P(scn->scn_zio_root, ==, NULL); | |||||
scn->scn_zio_root = rio; | |||||
for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { | for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { | ||||
ddt_t *ddt = spa->spa_ddt[c]; | ddt_t *ddt = spa->spa_ddt[c]; | ||||
if (ddt == NULL) | if (ddt == NULL) | ||||
continue; | continue; | ||||
ddt_sync_table(ddt, tx, txg); | ddt_sync_table(ddt, tx, txg); | ||||
ddt_repair_table(ddt, rio); | ddt_repair_table(ddt, rio); | ||||
} | } | ||||
(void) zio_wait(rio); | (void) zio_wait(rio); | ||||
scn->scn_zio_root = NULL; | |||||
dmu_tx_commit(tx); | dmu_tx_commit(tx); | ||||
} | } | ||||
int | int | ||||
ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde) | ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde) | ||||
{ | { | ||||
do { | do { | ||||
Show All 25 Lines |