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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/driver_lyr.c
          +++ new/usr/src/uts/common/os/driver_lyr.c
↓ open down ↓ 400 lines elided ↑ open up ↑
 401  401          }
 402  402  
 403  403          /* get holds on other objects */
 404  404          ident_hold(ident);
 405  405          ASSERT(vp->v_count >= 1);
 406  406          VN_HOLD(vp);
 407  407  
 408  408          /* add it to the handle hash */
 409  409          lhp->lh_next = ldi_handle_hash[index];
 410  410          ldi_handle_hash[index] = lhp;
 411      -        atomic_add_long(&ldi_handle_hash_count, 1);
      411 +        atomic_inc_ulong(&ldi_handle_hash_count);
 412  412  
 413  413          LDI_ALLOCFREE((CE_WARN, "ldi handle alloc: new "
 414  414              "lh=0x%p, ident=0x%p, vp=0x%p, drv=%s, minor=0x%x",
 415  415              (void *)lhp, (void *)ident, (void *)vp,
 416  416              mod_major_to_name(getmajor(vp->v_rdev)),
 417  417              getminor(vp->v_rdev)));
 418  418  
 419  419          mutex_exit(&ldi_handle_hash_lock[index]);
 420  420          return (lhp);
 421  421  }
↓ open down ↓ 19 lines elided ↑ open up ↑
 441  441          if (--lhp->lh_ref > 0) {
 442  442                  /* there are more references to this handle */
 443  443                  mutex_exit(&ldi_handle_hash_lock[index]);
 444  444                  return;
 445  445          }
 446  446  
 447  447          /* this was the last reference/open for this handle.  free it. */
 448  448          lhpp = handle_find_ref_nolock(lhp->lh_vp, lhp->lh_ident);
 449  449          ASSERT((lhpp != NULL) && (*lhpp != NULL));
 450  450          *lhpp = lhp->lh_next;
 451      -        atomic_add_long(&ldi_handle_hash_count, -1);
      451 +        atomic_dec_ulong(&ldi_handle_hash_count);
 452  452          mutex_exit(&ldi_handle_hash_lock[index]);
 453  453  
 454  454          VN_RELE(lhp->lh_vp);
 455  455          ident_release(lhp->lh_ident);
 456  456  #ifdef  LDI_OBSOLETE_EVENT
 457  457          mutex_destroy(lhp->lh_lock);
 458  458  #endif
 459  459          kmem_free(lhp, sizeof (struct ldi_handle));
 460  460  }
 461  461  
↓ open down ↓ 3296 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX