mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
brt_vdev_realloc: use vmem_alloc for large allocation
bv_entcount can be a relatively large allocation (see comment for BRT_RANGESIZE), so get it from the big allocator. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Kay Pedersen <mail@mkwg.de> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Sponsored-By: OpenDrives Inc. Sponsored-By: Klara Inc. Closes #15050
This commit is contained in:
parent
7698503dca
commit
8aa4f0f0fc
@ -680,7 +680,7 @@ brt_vdev_realloc(brt_t *brt, brt_vdev_t *brtvd)
|
||||
size = (vdev_get_min_asize(vd) - 1) / brt->brt_rangesize + 1;
|
||||
spa_config_exit(brt->brt_spa, SCL_VDEV, FTAG);
|
||||
|
||||
entcount = kmem_zalloc(sizeof (entcount[0]) * size, KM_SLEEP);
|
||||
entcount = vmem_zalloc(sizeof (entcount[0]) * size, KM_SLEEP);
|
||||
nblocks = BRT_RANGESIZE_TO_NBLOCKS(size);
|
||||
bitmap = kmem_zalloc(BT_SIZEOFMAP(nblocks), KM_SLEEP);
|
||||
|
||||
@ -709,7 +709,7 @@ brt_vdev_realloc(brt_t *brt, brt_vdev_t *brtvd)
|
||||
sizeof (entcount[0]) * MIN(size, brtvd->bv_size));
|
||||
memcpy(bitmap, brtvd->bv_bitmap, MIN(BT_SIZEOFMAP(nblocks),
|
||||
BT_SIZEOFMAP(brtvd->bv_nblocks)));
|
||||
kmem_free(brtvd->bv_entcount,
|
||||
vmem_free(brtvd->bv_entcount,
|
||||
sizeof (entcount[0]) * brtvd->bv_size);
|
||||
kmem_free(brtvd->bv_bitmap, BT_SIZEOFMAP(brtvd->bv_nblocks));
|
||||
}
|
||||
@ -792,7 +792,7 @@ brt_vdev_dealloc(brt_t *brt, brt_vdev_t *brtvd)
|
||||
ASSERT(RW_WRITE_HELD(&brt->brt_lock));
|
||||
ASSERT(brtvd->bv_initiated);
|
||||
|
||||
kmem_free(brtvd->bv_entcount, sizeof (uint16_t) * brtvd->bv_size);
|
||||
vmem_free(brtvd->bv_entcount, sizeof (uint16_t) * brtvd->bv_size);
|
||||
brtvd->bv_entcount = NULL;
|
||||
kmem_free(brtvd->bv_bitmap, BT_SIZEOFMAP(brtvd->bv_nblocks));
|
||||
brtvd->bv_bitmap = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user