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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/sockfs/socksyscalls.c
          +++ new/usr/src/uts/common/fs/sockfs/socksyscalls.c
↓ open down ↓ 2394 lines elided ↑ open up ↑
2395 2395  
2396 2396  /*
2397 2397   * The callback function used for vpm mapped mblks called when the last ref of
2398 2398   * the mblk is dropped which normally occurs when TCP receives the ack. But it
2399 2399   * can be the driver too due to lazy reclaim.
2400 2400   */
2401 2401  void
2402 2402  snf_vmap_desbfree(snf_vmap_desbinfo *snfv)
2403 2403  {
2404 2404          ASSERT(snfv->snfv_ref != 0);
2405      -        if (atomic_add_32_nv(&snfv->snfv_ref, -1) == 0) {
     2405 +        if (atomic_dec_32_nv(&snfv->snfv_ref) == 0) {
2406 2406                  vpm_unmap_pages(snfv->snfv_vml, S_READ);
2407 2407                  VN_RELE(snfv->snfv_vp);
2408 2408                  kmem_free(snfv, sizeof (snf_vmap_desbinfo));
2409 2409          }
2410 2410  }
2411 2411  
2412 2412  /*
2413 2413   * The callback function used for segmap'ped mblks called when the last ref of
2414 2414   * the mblk is dropped which normally occurs when TCP receives the ack. But it
2415 2415   * can be the driver too due to lazy reclaim.
↓ open down ↓ 673 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX