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_subr.c
          +++ new/usr/src/uts/common/fs/nfs/nfs4_subr.c
↓ open down ↓ 926 lines elided ↑ open up ↑
 927  927                  *newcl = cp->ch_client;
 928  928                  *chp = cp;
 929  929                  return (0);
 930  930          }
 931  931  
 932  932          /*
 933  933           * There weren't any free client handles which fit, so allocate
 934  934           * a new one and use that.
 935  935           */
 936  936  #ifdef DEBUG
 937      -        atomic_add_64(&nfscl->nfscl_stat.clalloc.value.ui64, 1);
      937 +        atomic_inc_64(&nfscl->nfscl_stat.clalloc.value.ui64);
 938  938  #endif
 939  939          mutex_exit(&nfscl->nfscl_chtable4_lock);
 940  940  
 941  941          nfscl->nfscl_stat.cltoomany.value.ui64++;
 942  942          if (newch != NULL) {
 943  943                  kmem_free(newch->ch_protofmly, strlen(newch->ch_protofmly) + 1);
 944  944                  kmem_free(newch, sizeof (*newch));
 945  945          }
 946  946  
 947  947          cp = kmem_cache_alloc(chtab4_cache, KM_SLEEP);
 948  948          cp->ch_head = ch;
 949  949  
 950  950          sigintr(&smask, (int)ci->cl_flags & MI4_INT);
 951  951          error = clnt_tli_kcreate(svp->sv_knconf, &svp->sv_addr, ci->cl_prog,
 952  952              ci->cl_vers, ci->cl_readsize, ci->cl_retrans, cr, &cp->ch_client);
 953  953          sigunintr(&smask);
 954  954  
 955  955          if (error != 0) {
 956  956                  kmem_cache_free(chtab4_cache, cp);
 957  957  #ifdef DEBUG
 958      -                atomic_add_64(&nfscl->nfscl_stat.clalloc.value.ui64, -1);
      958 +                atomic_dec_64(&nfscl->nfscl_stat.clalloc.value.ui64);
 959  959  #endif
 960  960                  /*
 961  961                   * Warning is unnecessary if error is EINTR.
 962  962                   */
 963  963                  if (error != EINTR) {
 964  964                          nfs_cmn_err(error, CE_WARN,
 965  965                              "clget: couldn't create handle: %m\n");
 966  966                  }
 967  967                  return (error);
 968  968          }
↓ open down ↓ 1 lines elided ↑ open up ↑
 970  970          auth_destroy(cp->ch_client->cl_auth);
 971  971  
 972  972          /*
 973  973           * Get an auth handle.
 974  974           */
 975  975          error = authget(svp, cp->ch_client, cr);
 976  976          if (error || cp->ch_client->cl_auth == NULL) {
 977  977                  CLNT_DESTROY(cp->ch_client);
 978  978                  kmem_cache_free(chtab4_cache, cp);
 979  979  #ifdef DEBUG
 980      -                atomic_add_64(&nfscl->nfscl_stat.clalloc.value.ui64, -1);
      980 +                atomic_dec_64(&nfscl->nfscl_stat.clalloc.value.ui64);
 981  981  #endif
 982  982                  return ((error != 0) ? error : EINTR);
 983  983          }
 984  984          ch->ch_timesused++;
 985  985          *newcl = cp->ch_client;
 986  986          ASSERT(cp->ch_client->cl_nosignal == FALSE);
 987  987          *chp = cp;
 988  988          return (0);
 989  989  }
 990  990  
↓ open down ↓ 1648 lines elided ↑ open up ↑
2639 2639                  rc->actlen = 0;
2640 2640                  /*
2641 2641                   * A readdir is required so set the flag.
2642 2642                   */
2643 2643                  rc->flags = RDDIRREQ;
2644 2644                  cv_init(&rc->cv, NULL, CV_DEFAULT, NULL);
2645 2645                  rc->error = 0;
2646 2646                  mutex_init(&rdip->lock, NULL, MUTEX_DEFAULT, NULL);
2647 2647                  rdip->count = 1;
2648 2648  #ifdef DEBUG
2649      -                atomic_add_64(&clstat4_debug.dirent.value.ui64, 1);
     2649 +                atomic_inc_64(&clstat4_debug.dirent.value.ui64);
2650 2650  #endif
2651 2651          }
2652 2652          return (rc);
2653 2653  }
2654 2654  
2655 2655  /*
2656 2656   * Increment the reference count to this cache element.
2657 2657   */
2658 2658  static void
2659 2659  rddir4_cache_hold(rddir4_cache *rc)
↓ open down ↓ 36 lines elided ↑ open up ↑
2696 2696  
2697 2697  /*
2698 2698   * Free a cache element.
2699 2699   */
2700 2700  static void
2701 2701  rddir4_cache_free(rddir4_cache_impl *rdip)
2702 2702  {
2703 2703          rddir4_cache *rc = &rdip->rc;
2704 2704  
2705 2705  #ifdef DEBUG
2706      -        atomic_add_64(&clstat4_debug.dirent.value.ui64, -1);
     2706 +        atomic_dec_64(&clstat4_debug.dirent.value.ui64);
2707 2707  #endif
2708 2708          if (rc->entries != NULL)
2709 2709                  kmem_free(rc->entries, rc->buflen);
2710 2710          cv_destroy(&rc->cv);
2711 2711          mutex_destroy(&rdip->lock);
2712 2712          kmem_free(rdip, sizeof (*rdip));
2713 2713  }
2714 2714  
2715 2715  /*
2716 2716   * Snapshot callback for nfs:0:nfs4_client as registered with the kstat
↓ open down ↓ 441 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX