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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs4_client.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_client.c
↓ open down ↓ 3140 lines elided ↑ open up ↑
3141 3141          }
3142 3142          list_destroy(&mi->mi_foo_list);
3143 3143          list_destroy(&mi->mi_bseqid_list);
3144 3144          list_destroy(&mi->mi_lost_state);
3145 3145          avl_destroy(&mi->mi_filehandles);
3146 3146          kmem_free(mi, sizeof (*mi));
3147 3147  }
3148 3148  void
3149 3149  mi_hold(mntinfo4_t *mi)
3150 3150  {
3151      -        atomic_add_32(&mi->mi_count, 1);
     3151 +        atomic_inc_32(&mi->mi_count);
3152 3152          ASSERT(mi->mi_count != 0);
3153 3153  }
3154 3154  
3155 3155  void
3156 3156  mi_rele(mntinfo4_t *mi)
3157 3157  {
3158 3158          ASSERT(mi->mi_count != 0);
3159      -        if (atomic_add_32_nv(&mi->mi_count, -1) == 0) {
     3159 +        if (atomic_dec_32_nv(&mi->mi_count) == 0) {
3160 3160                  nfs_free_mi4(mi);
3161 3161          }
3162 3162  }
3163 3163  
3164 3164  vnode_t    nfs4_xattr_notsupp_vnode;
3165 3165  
3166 3166  void
3167 3167  nfs4_clnt_init(void)
3168 3168  {
3169 3169          nfs4_vnops_init();
↓ open down ↓ 934 lines elided ↑ open up ↑
4104 4104                  avl_insert(&parent->fn_children, fnp, where);
4105 4105                  mutex_exit(&parent->fn_lock);
4106 4106          }
4107 4107  
4108 4108          return (fnp);
4109 4109  }
4110 4110  
4111 4111  void
4112 4112  fn_hold(nfs4_fname_t *fnp)
4113 4113  {
4114      -        atomic_add_32(&fnp->fn_refcnt, 1);
     4114 +        atomic_inc_32(&fnp->fn_refcnt);
4115 4115          NFS4_DEBUG(nfs4_fname_debug, (CE_NOTE,
4116 4116              "fn_hold %p:%s, new refcnt=%d",
4117 4117              (void *)fnp, fnp->fn_name, fnp->fn_refcnt));
4118 4118  }
4119 4119  
4120 4120  /*
4121 4121   * Decrement the reference count of the given fname, and destroy it if its
4122 4122   * reference count goes to zero.  Nulls out the given pointer.
4123 4123   */
4124 4124  
↓ open down ↓ 5 lines elided ↑ open up ↑
4130 4130          nfs4_fname_t *fnp;
4131 4131  
4132 4132  recur:
4133 4133          fnp = *fnpp;
4134 4134          *fnpp = NULL;
4135 4135  
4136 4136          mutex_enter(&fnp->fn_lock);
4137 4137          parent = fnp->fn_parent;
4138 4138          if (parent != NULL)
4139 4139                  mutex_enter(&parent->fn_lock);  /* prevent new references */
4140      -        newref = atomic_add_32_nv(&fnp->fn_refcnt, -1);
     4140 +        newref = atomic_dec_32_nv(&fnp->fn_refcnt);
4141 4141          if (newref > 0) {
4142 4142                  NFS4_DEBUG(nfs4_fname_debug, (CE_NOTE,
4143 4143                      "fn_rele %p:%s, new refcnt=%d",
4144 4144                      (void *)fnp, fnp->fn_name, fnp->fn_refcnt));
4145 4145                  if (parent != NULL)
4146 4146                          mutex_exit(&parent->fn_lock);
4147 4147                  mutex_exit(&fnp->fn_lock);
4148 4148                  return;
4149 4149          }
4150 4150  
↓ open down ↓ 239 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX