* Free the objects used to store this vdev's spacemaps, and the array * that points to them. */
| 3473 | * that points to them. |
| 3474 | */ |
| 3475 | void |
| 3476 | vdev_destroy_spacemaps(vdev_t *vd, dmu_tx_t *tx) |
| 3477 | { |
| 3478 | if (vd->vdev_ms_array == 0) |
| 3479 | return; |
| 3480 | |
| 3481 | objset_t *mos = vd->vdev_spa->spa_meta_objset; |
| 3482 | uint64_t array_count = vd->vdev_asize >> vd->vdev_ms_shift; |
| 3483 | size_t array_bytes = array_count * sizeof (uint64_t); |
| 3484 | uint64_t *smobj_array = kmem_alloc(array_bytes, KM_SLEEP); |
| 3485 | VERIFY0(dmu_read(mos, vd->vdev_ms_array, 0, |
| 3486 | array_bytes, smobj_array, 0)); |
| 3487 | |
| 3488 | for (uint64_t i = 0; i < array_count; i++) { |
| 3489 | uint64_t smobj = smobj_array[i]; |
| 3490 | if (smobj == 0) |
| 3491 | continue; |
| 3492 | |
| 3493 | space_map_free_obj(mos, smobj, tx); |
| 3494 | } |
| 3495 | |
| 3496 | kmem_free(smobj_array, array_bytes); |
| 3497 | VERIFY0(dmu_object_free(mos, vd->vdev_ms_array, tx)); |
| 3498 | vdev_destroy_ms_flush_data(vd, tx); |
| 3499 | vd->vdev_ms_array = 0; |
| 3500 | } |
| 3501 | |
| 3502 | static void |
| 3503 | vdev_remove_empty_log(vdev_t *vd, uint64_t txg) |
no test coverage detected