static int sa_legacy_attr_count = 16;
static kmem_cache_t *sa_cache = NULL;
-static kmem_cache_t *spill_cache = NULL;
/*ARGSUSED*/
static int
sa_cache = kmem_cache_create("sa_cache",
sizeof (sa_handle_t), 0, sa_cache_constructor,
sa_cache_destructor, NULL, NULL, NULL, 0);
- spill_cache = kmem_cache_create("spill_cache",
- SPA_MAXBLOCKSIZE, 0, NULL, NULL, NULL, NULL, NULL, 0);
}
void
{
if (sa_cache)
kmem_cache_destroy(sa_cache);
-
- if (spill_cache)
- kmem_cache_destroy(spill_cache);
-}
-
-void *
-sa_spill_alloc(int flags)
-{
- return (kmem_cache_alloc(spill_cache, flags));
-}
-
-void
-sa_spill_free(void *obj)
-{
- kmem_cache_free(spill_cache, obj);
}
static int
void *old_data[2];
int bonus_attr_count = 0;
int bonus_data_size = 0;
+ int spill_data_size = 0;
int spill_attr_count = 0;
int error;
uint16_t length;
/* Bring spill buffer online if it isn't currently */
if ((error = sa_get_spill(hdl)) == 0) {
- ASSERT3U(hdl->sa_spill->db_size, <=, SPA_MAXBLOCKSIZE);
- old_data[1] = sa_spill_alloc(KM_SLEEP);
+ spill_data_size = hdl->sa_spill->db_size;
+ old_data[1] = zio_buf_alloc(spill_data_size);
bcopy(hdl->sa_spill->db_data, old_data[1],
hdl->sa_spill->db_size);
spill_attr_count =
if (old_data[0])
kmem_free(old_data[0], bonus_data_size);
if (old_data[1])
- sa_spill_free(old_data[1]);
+ zio_buf_free(old_data[1], spill_data_size);
kmem_free(attr_desc, sizeof (sa_bulk_attr_t) * attr_count);
return (error);
EXPORT_SYMBOL(sa_enabled);
EXPORT_SYMBOL(sa_cache_init);
EXPORT_SYMBOL(sa_cache_fini);
-EXPORT_SYMBOL(sa_spill_alloc);
-EXPORT_SYMBOL(sa_spill_free);
EXPORT_SYMBOL(sa_set_sa_object);
EXPORT_SYMBOL(sa_hdrsize);
EXPORT_SYMBOL(sa_handle_lock);
return (error);
}
- obj = sa_spill_alloc(KM_SLEEP);
+ obj = zio_buf_alloc(size);
error = sa_lookup(zp->z_sa_hdl, SA_ZPL_DXATTR(zsb), obj, size);
if (error == 0)
error = nvlist_unpack(obj, size, &zp->z_xattr_cached, KM_SLEEP);
- sa_spill_free(obj);
+ zio_buf_free(obj, size);
return (error);
}
if (error)
goto out;
- obj = sa_spill_alloc(KM_SLEEP);
+ obj = zio_buf_alloc(size);
error = nvlist_pack(zp->z_xattr_cached, &obj, &size,
NV_ENCODE_XDR, KM_SLEEP);
dmu_tx_commit(tx);
}
out_free:
- sa_spill_free(obj);
+ zio_buf_free(obj, size);
out:
return (error);
}
EXPORT_SYMBOL(zio_handle_device_injection);
EXPORT_SYMBOL(zio_handle_label_injection);
EXPORT_SYMBOL(zio_type_name);
+EXPORT_SYMBOL(zio_buf_alloc);
+EXPORT_SYMBOL(zio_data_buf_alloc);
+EXPORT_SYMBOL(zio_buf_free);
+EXPORT_SYMBOL(zio_data_buf_free);
module_param(zio_bulk_flags, int, 0644);
MODULE_PARM_DESC(zio_bulk_flags, "Additional flags to pass to bulk buffers");