Add missing part of kmem_cache cleanup. Use Solaris argument order for

kmem_cache destructors, umem_cache_alloc() and umem_cache_free() too.
This commit is contained in:
hannken 2019-05-26 10:21:00 +00:00
parent ae5e88e264
commit 0d3564d150
6 changed files with 3 additions and 26 deletions

View File

@ -1623,9 +1623,6 @@ hdr_full_dest(void *vbuf, void *unused)
{
arc_buf_hdr_t *hdr = vbuf;
#ifdef __NetBSD__
hdr = unused;
#endif
ASSERT(HDR_EMPTY(hdr));
cv_destroy(&hdr->b_l1hdr.b_cv);
refcount_destroy(&hdr->b_l1hdr.b_refcnt);
@ -1640,9 +1637,6 @@ hdr_l2only_dest(void *vbuf, void *unused)
{
arc_buf_hdr_t *hdr = vbuf;
#ifdef __NetBSD__
hdr = unused;
#endif
ASSERT(HDR_EMPTY(hdr));
arc_space_return(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS);
}
@ -1653,9 +1647,6 @@ buf_dest(void *vbuf, void *unused)
{
arc_buf_t *buf = vbuf;
#ifdef __NetBSD__
buf = unused;
#endif
mutex_destroy(&buf->b_evict_lock);
arc_space_return(sizeof (arc_buf_t), ARC_SPACE_HDRS);
}

View File

@ -153,9 +153,6 @@ dbuf_dest(void *vdb, void *unused)
{
dmu_buf_impl_t *db = vdb;
#ifdef __NetBSD__
db = unused;
#endif
mutex_destroy(&db->db_mtx);
cv_destroy(&db->db_changed);
ASSERT(!multilist_link_active(&db->db_cache_link));

View File

@ -168,9 +168,6 @@ dnode_dest(void *arg, void *unused)
int i;
dnode_t *dn = arg;
#ifdef __NetBSD__
dn = unused;
#endif
rw_destroy(&dn->dn_struct_rwlock);
mutex_destroy(&dn->dn_mtx);
mutex_destroy(&dn->dn_dbufs_mtx);

View File

@ -222,9 +222,6 @@ sa_cache_destructor(void *buf, void *unused)
{
sa_handle_t *hdl = buf;
#ifdef __NetBSD__
hdl = unused;
#endif
mutex_destroy(&hdl->sa_lock);
}

View File

@ -152,9 +152,6 @@ zfs_znode_cache_destructor(void *buf, void *arg)
{
znode_t *zp = buf;
#ifdef __NetBSD__
zp = arg;
#endif
ASSERT(!POINTER_IS_VALID(zp->z_zfsvfs));
ASSERT(ZTOV(zp) == NULL);
#ifndef __NetBSD__

View File

@ -1,4 +1,4 @@
/* $NetBSD: umem.c,v 1.2 2010/05/02 23:59:54 haad Exp $ */
/* $NetBSD: umem.c,v 1.3 2019/05/26 10:21:00 hannken Exp $ */
/*
* CDDL HEADER START
@ -135,8 +135,7 @@ void *umem_cache_alloc(umem_cache_t *cache, int flags)
}
if(cache->constructor != NULL) {
/* XXX NetBSD pool cache costructor has switched arguments. */
if(cache->constructor(cache->callback_data, buf, flags) != 0) {
if(cache->constructor(buf, cache->callback_data, flags) != 0) {
free(buf);
if(!(flags & UMEM_NOFAIL))
return NULL;
@ -156,8 +155,7 @@ void *umem_cache_alloc(umem_cache_t *cache, int flags)
void umem_cache_free(umem_cache_t *cache, void *buffer)
{
if(cache->destructor != NULL)
/* XXX NetBSD pool cache costructor has switched arguments. */
cache->destructor(cache->callback_data, buffer);
cache->destructor(buffer, cache->callback_data);
free(buffer);
}