| 1115 | } |
| 1116 | |
| 1117 | void |
| 1118 | ddt_sync(spa_t *spa, uint64_t txg) |
| 1119 | { |
| 1120 | dsl_scan_t *scn = spa->spa_dsl_pool->dp_scan; |
| 1121 | dmu_tx_t *tx; |
| 1122 | zio_t *rio; |
| 1123 | |
| 1124 | ASSERT(spa_syncing_txg(spa) == txg); |
| 1125 | |
| 1126 | tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg); |
| 1127 | |
| 1128 | rio = zio_root(spa, NULL, NULL, |
| 1129 | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_SELF_HEAL); |
| 1130 | |
| 1131 | /* |
| 1132 | * This function may cause an immediate scan of ddt blocks (see |
| 1133 | * the comment above dsl_scan_ddt() for details). We set the |
| 1134 | * scan's root zio here so that we can wait for any scan IOs in |
| 1135 | * addition to the regular ddt IOs. |
| 1136 | */ |
| 1137 | ASSERT3P(scn->scn_zio_root, ==, NULL); |
| 1138 | scn->scn_zio_root = rio; |
| 1139 | |
| 1140 | for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { |
| 1141 | ddt_t *ddt = spa->spa_ddt[c]; |
| 1142 | if (ddt == NULL) |
| 1143 | continue; |
| 1144 | ddt_sync_table(ddt, tx, txg); |
| 1145 | ddt_repair_table(ddt, rio); |
| 1146 | } |
| 1147 | |
| 1148 | (void) zio_wait(rio); |
| 1149 | scn->scn_zio_root = NULL; |
| 1150 | |
| 1151 | dmu_tx_commit(tx); |
| 1152 | } |
| 1153 | |
| 1154 | int |
| 1155 | ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde) |
no test coverage detected