Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 3146,3164 **** kmem_free(mi, sizeof (*mi)); } void mi_hold(mntinfo4_t *mi) { ! atomic_add_32(&mi->mi_count, 1); ASSERT(mi->mi_count != 0); } void mi_rele(mntinfo4_t *mi) { ASSERT(mi->mi_count != 0); ! if (atomic_add_32_nv(&mi->mi_count, -1) == 0) { nfs_free_mi4(mi); } } vnode_t nfs4_xattr_notsupp_vnode; --- 3146,3164 ---- kmem_free(mi, sizeof (*mi)); } void mi_hold(mntinfo4_t *mi) { ! atomic_inc_32(&mi->mi_count); ASSERT(mi->mi_count != 0); } void mi_rele(mntinfo4_t *mi) { ASSERT(mi->mi_count != 0); ! if (atomic_dec_32_nv(&mi->mi_count) == 0) { nfs_free_mi4(mi); } } vnode_t nfs4_xattr_notsupp_vnode;
*** 4109,4119 **** } void fn_hold(nfs4_fname_t *fnp) { ! atomic_add_32(&fnp->fn_refcnt, 1); NFS4_DEBUG(nfs4_fname_debug, (CE_NOTE, "fn_hold %p:%s, new refcnt=%d", (void *)fnp, fnp->fn_name, fnp->fn_refcnt)); } --- 4109,4119 ---- } void fn_hold(nfs4_fname_t *fnp) { ! atomic_inc_32(&fnp->fn_refcnt); NFS4_DEBUG(nfs4_fname_debug, (CE_NOTE, "fn_hold %p:%s, new refcnt=%d", (void *)fnp, fnp->fn_name, fnp->fn_refcnt)); }
*** 4135,4145 **** mutex_enter(&fnp->fn_lock); parent = fnp->fn_parent; if (parent != NULL) mutex_enter(&parent->fn_lock); /* prevent new references */ ! newref = atomic_add_32_nv(&fnp->fn_refcnt, -1); if (newref > 0) { NFS4_DEBUG(nfs4_fname_debug, (CE_NOTE, "fn_rele %p:%s, new refcnt=%d", (void *)fnp, fnp->fn_name, fnp->fn_refcnt)); if (parent != NULL) --- 4135,4145 ---- mutex_enter(&fnp->fn_lock); parent = fnp->fn_parent; if (parent != NULL) mutex_enter(&parent->fn_lock); /* prevent new references */ ! newref = atomic_dec_32_nv(&fnp->fn_refcnt); if (newref > 0) { NFS4_DEBUG(nfs4_fname_debug, (CE_NOTE, "fn_rele %p:%s, new refcnt=%d", (void *)fnp, fnp->fn_name, fnp->fn_refcnt)); if (parent != NULL)