| 1201 | } |
| 1202 | |
| 1203 | void |
| 1204 | zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp) |
| 1205 | { |
| 1206 | |
| 1207 | (void) zfs_blkptr_verify(spa, bp, B_FALSE, BLK_VERIFY_HALT); |
| 1208 | |
| 1209 | /* |
| 1210 | * The check for EMBEDDED is a performance optimization. We |
| 1211 | * process the free here (by ignoring it) rather than |
| 1212 | * putting it on the list and then processing it in zio_free_sync(). |
| 1213 | */ |
| 1214 | if (BP_IS_EMBEDDED(bp)) |
| 1215 | return; |
| 1216 | metaslab_check_free(spa, bp); |
| 1217 | |
| 1218 | /* |
| 1219 | * Frees that are for the currently-syncing txg, are not going to be |
| 1220 | * deferred, and which will not need to do a read (i.e. not GANG or |
| 1221 | * DEDUP), can be processed immediately. Otherwise, put them on the |
| 1222 | * in-memory list for later processing. |
| 1223 | * |
| 1224 | * Note that we only defer frees after zfs_sync_pass_deferred_free |
| 1225 | * when the log space map feature is disabled. [see relevant comment |
| 1226 | * in spa_sync_iterate_to_convergence()] |
| 1227 | */ |
| 1228 | if (BP_IS_GANG(bp) || |
| 1229 | BP_GET_DEDUP(bp) || |
| 1230 | txg != spa->spa_syncing_txg || |
| 1231 | (spa_sync_pass(spa) >= zfs_sync_pass_deferred_free && |
| 1232 | !spa_feature_is_active(spa, SPA_FEATURE_LOG_SPACEMAP))) { |
| 1233 | bplist_append(&spa->spa_free_bplist[txg & TXG_MASK], bp); |
| 1234 | } else { |
| 1235 | VERIFY3P(zio_free_sync(NULL, spa, txg, bp, 0), ==, NULL); |
| 1236 | } |
| 1237 | } |
| 1238 | |
| 1239 | /* |
| 1240 | * To improve performance, this function may return NULL if we were able |
no test coverage detected