MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vdev_destroy_spacemaps

Function vdev_destroy_spacemaps

freebsd/contrib/openzfs/module/zfs/vdev.c:3475–3500  ·  view source on GitHub ↗

* Free the objects used to store this vdev's spacemaps, and the array * that points to them. */

Source from the content-addressed store, hash-verified

3473 * that points to them.
3474 */
3475void
3476vdev_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
3502static void
3503vdev_remove_empty_log(vdev_t *vd, uint64_t txg)

Callers 2

vdev_remove_empty_logFunction · 0.85

Calls 5

dmu_readFunction · 0.85
space_map_free_objFunction · 0.85
dmu_object_freeFunction · 0.85
kmem_freeFunction · 0.50

Tested by

no test coverage detected