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

*** 331,351 **** * holding the lock. */ void ire_refhold(ire_t *ire) { ! atomic_add_32(&(ire)->ire_refcnt, 1); ASSERT((ire)->ire_refcnt != 0); #ifdef DEBUG ire_trace_ref(ire); #endif } void ire_refhold_notr(ire_t *ire) { ! atomic_add_32(&(ire)->ire_refcnt, 1); ASSERT((ire)->ire_refcnt != 0); } void ire_refhold_locked(ire_t *ire) --- 331,351 ---- * holding the lock. */ void ire_refhold(ire_t *ire) { ! atomic_inc_32(&(ire)->ire_refcnt); ASSERT((ire)->ire_refcnt != 0); #ifdef DEBUG ire_trace_ref(ire); #endif } void ire_refhold_notr(ire_t *ire) { ! atomic_inc_32(&(ire)->ire_refcnt); ASSERT((ire)->ire_refcnt != 0); } void ire_refhold_locked(ire_t *ire)
*** 377,396 **** #ifdef DEBUG ire_untrace_ref(ire); #endif ASSERT((ire)->ire_refcnt != 0); membar_exit(); ! if (atomic_add_32_nv(&(ire)->ire_refcnt, -1) == 0) ire_inactive(ire); } void ire_refrele_notr(ire_t *ire) { ASSERT((ire)->ire_refcnt != 0); membar_exit(); ! if (atomic_add_32_nv(&(ire)->ire_refcnt, -1) == 0) ire_inactive(ire); } /* * This function is associated with the IP_IOC_IRE_DELETE[_NO_REPLY] --- 377,396 ---- #ifdef DEBUG ire_untrace_ref(ire); #endif ASSERT((ire)->ire_refcnt != 0); membar_exit(); ! if (atomic_dec_32_nv(&(ire)->ire_refcnt) == 0) ire_inactive(ire); } void ire_refrele_notr(ire_t *ire) { ASSERT((ire)->ire_refcnt != 0); membar_exit(); ! if (atomic_dec_32_nv(&(ire)->ire_refcnt) == 0) ire_inactive(ire); } /* * This function is associated with the IP_IOC_IRE_DELETE[_NO_REPLY]
*** 1270,1280 **** * We only allow exactly one IRE_IF_CLONE for any dst, * so, if the is an IF_CLONE, return the ire without * an identical_ref, but with an ire_ref held. */ if (ire->ire_type != IRE_IF_CLONE) { ! atomic_add_32(&ire1->ire_identical_ref, 1); DTRACE_PROBE2(ire__add__exist, ire_t *, ire1, ire_t *, ire); } ire_refhold(ire1); ire_atomic_end(irb_ptr, ire); --- 1270,1280 ---- * We only allow exactly one IRE_IF_CLONE for any dst, * so, if the is an IF_CLONE, return the ire without * an identical_ref, but with an ire_ref held. */ if (ire->ire_type != IRE_IF_CLONE) { ! atomic_inc_32(&ire1->ire_identical_ref); DTRACE_PROBE2(ire__add__exist, ire_t *, ire1, ire_t *, ire); } ire_refhold(ire1); ire_atomic_end(irb_ptr, ire);
*** 1531,1541 **** } if (!IRE_IS_CONDEMNED(ire)) { /* Is this an IRE representing multiple duplicate entries? */ ASSERT(ire->ire_identical_ref >= 1); ! if (atomic_add_32_nv(&ire->ire_identical_ref, -1) != 0) { /* Removed one of the identical parties */ rw_exit(&irb->irb_lock); return; } --- 1531,1541 ---- } if (!IRE_IS_CONDEMNED(ire)) { /* Is this an IRE representing multiple duplicate entries? */ ASSERT(ire->ire_identical_ref >= 1); ! if (atomic_dec_32_nv(&ire->ire_identical_ref) != 0) { /* Removed one of the identical parties */ rw_exit(&irb->irb_lock); return; }
*** 2616,2626 **** ASSERT(ire->ire_bucket == NULL || RW_WRITE_HELD(&ire->ire_bucket->irb_lock)); ASSERT(!IRE_IS_CONDEMNED(ire)); ire->ire_generation = IRE_GENERATION_CONDEMNED; /* Count how many condemned ires for kmem_cache callback */ ! atomic_add_32(&ipst->ips_num_ire_condemned, 1); nce = ire->ire_nce_cache; ire->ire_nce_cache = NULL; mutex_exit(&ire->ire_lock); if (nce != NULL) nce_refrele(nce); --- 2616,2626 ---- ASSERT(ire->ire_bucket == NULL || RW_WRITE_HELD(&ire->ire_bucket->irb_lock)); ASSERT(!IRE_IS_CONDEMNED(ire)); ire->ire_generation = IRE_GENERATION_CONDEMNED; /* Count how many condemned ires for kmem_cache callback */ ! atomic_inc_32(&ipst->ips_num_ire_condemned); nce = ire->ire_nce_cache; ire->ire_nce_cache = NULL; mutex_exit(&ire->ire_lock); if (nce != NULL) nce_refrele(nce);