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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/ufs/ufs_directio.c
          +++ new/usr/src/uts/common/fs/ufs/ufs_directio.c
↓ open down ↓ 606 lines elided ↑ open up ↑
 607  607                          rw_downgrade(&ip->i_contents);
 608  608                  ufs_directio_kstats.nflushes.value.ui64++;
 609  609          }
 610  610  
 611  611          /*
 612  612           * Direct Writes
 613  613           */
 614  614  
 615  615          if (!exclusive) {
 616  616                  ufs_shared_writes++;
 617      -                ncur = atomic_add_32_nv(&ufs_cur_writes, 1);
      617 +                ncur = atomic_inc_32_nv(&ufs_cur_writes);
 618  618                  if (ncur > ufs_maxcur_writes)
 619  619                          ufs_maxcur_writes = ncur;
 620  620          }
 621  621  
 622  622          /*
 623  623           * proc and as are for VM operations in directio_start()
 624  624           */
 625  625          if (uio->uio_segflg == UIO_USERSPACE) {
 626  626                  procp = ttoproc(curthread);
 627  627                  as = procp->p_as;
↓ open down ↓ 92 lines elided ↑ open up ↑
 720  720                  newerror = directio_wait(tail, &bytes_written);
 721  721  
 722  722                  /*
 723  723                   * Release VM resources
 724  724                   */
 725  725                  as_pageunlock(as, pplist, pglck_base, pglck_size, S_READ);
 726  726  
 727  727          }
 728  728  
 729  729          if (!exclusive) {
 730      -                atomic_add_32(&ufs_cur_writes, -1);
      730 +                atomic_dec_32(&ufs_cur_writes);
 731  731                  /*
 732  732                   * If this write was done shared, readers may
 733  733                   * have pulled in unmodified pages. Get rid of
 734  734                   * these potentially stale pages.
 735  735                   */
 736  736                  if (vn_has_cached_data(vp)) {
 737  737                          rw_exit(&ip->i_contents);
 738  738                          rw_enter(&ip->i_contents, RW_WRITER);
 739  739                          (void) VOP_PUTPAGE(vp, (offset_t)0, (size_t)0,
 740  740                              B_INVAL, cr, NULL);
↓ open down ↓ 310 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX