mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +03:00
Convert zio_buf_alloc() consumers
In multiple cases zio_buf_alloc() was used instead of kmem_alloc() or vmem_alloc(). This was often done because the allocations could be large and it was easy to use zfs_buf_alloc() for them. But this isn't ideal for allocations which are small or short lived. In these cases it is better to use kmem_alloc() or vmem_alloc(). If possible we want to avoid the case where we have slabs allocated for kmem caches which are rarely used. Note for small allocations vmem_alloc() will be internally converted to kmem_alloc(). Therefore as long as large allocations are infrequent and short lived the penalty for using vmem_alloc() is small. Reviewed-by: Chunwei Chen <david.chen@osnexus.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #5409
This commit is contained in:
+2
-2
@@ -1690,7 +1690,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
|
||||
|
||||
if ((error = sa_get_spill(hdl)) == 0) {
|
||||
spill_data_size = hdl->sa_spill->db_size;
|
||||
old_data[1] = zio_buf_alloc(spill_data_size);
|
||||
old_data[1] = vmem_alloc(spill_data_size, KM_SLEEP);
|
||||
bcopy(hdl->sa_spill->db_data, old_data[1],
|
||||
hdl->sa_spill->db_size);
|
||||
spill_attr_count =
|
||||
@@ -1773,7 +1773,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
|
||||
if (old_data[0])
|
||||
kmem_free(old_data[0], bonus_data_size);
|
||||
if (old_data[1])
|
||||
zio_buf_free(old_data[1], spill_data_size);
|
||||
vmem_free(old_data[1], spill_data_size);
|
||||
kmem_free(attr_desc, sizeof (sa_bulk_attr_t) * attr_count);
|
||||
|
||||
return (error);
|
||||
|
||||
Reference in New Issue
Block a user