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

@@ -931,11 +931,11 @@
          */
         ufs_thread_suspend(&ufsvfsp->vfs_reclaim);
         ufs_thread_suspend(&ufsvfsp->vfs_delete);
 
         mutex_enter(&ulp->ul_lock);
-        atomic_add_long(&ufs_quiesce_pend, 1);
+        atomic_inc_ulong(&ufs_quiesce_pend);
 
         /*
          * Quit if there is another lockfs request in progress
          * that is waiting for existing ufs_vnops to complete.
          */

@@ -1161,11 +1161,11 @@
             !(ufsvfsp->vfs_fsfx.fx_flags & (UFSMNT_ONERROR_PANIC >> 4)))
                 (void) ufs_fault(ufsvfsp->vfs_root,
                     ulp->ul_lockfs.lf_comment && ulp->ul_lockfs.lf_comlen > 0 ?
                     ulp->ul_lockfs.lf_comment: "user-applied error lock");
 
-        atomic_add_long(&ufs_quiesce_pend, -1);
+        atomic_dec_ulong(&ufs_quiesce_pend);
         mutex_exit(&ulp->ul_lock);
         vfs_unlock(vfsp);
 
         if (ULOCKFS_IS_HLOCK(&ufsvfsp->vfs_ulockfs))
                 poll_events |= POLLERR;

@@ -1200,11 +1200,11 @@
 
         ULOCKFS_CLR_BUSY(ulp);
         LOCKFS_CLR_BUSY(&ulp->ul_lockfs);
 
 errexit:
-        atomic_add_long(&ufs_quiesce_pend, -1);
+        atomic_dec_ulong(&ufs_quiesce_pend);
         mutex_exit(&ulp->ul_lock);
         vfs_unlock(vfsp);
 
         /*
          * Allow both the delete thread and the reclaim thread to

@@ -1297,14 +1297,14 @@
                                 return (EINTR);
                 }
         }
 
         if (mask & ULOCKFS_FWLOCK) {
-                atomic_add_long(&ulp->ul_falloc_cnt, 1);
+                atomic_inc_ulong(&ulp->ul_falloc_cnt);
                 ULOCKFS_SET_FALLOC(ulp);
         } else {
-                atomic_add_long(&ulp->ul_vnops_cnt, 1);
+                atomic_inc_ulong(&ulp->ul_vnops_cnt);
         }
 
         return (0);
 }
 

@@ -1378,11 +1378,11 @@
          * never see the value of zero for ctr - a livelock kind of scenario.
          */
         ctr = (mask & ULOCKFS_FWLOCK) ?
             &ulp->ul_falloc_cnt : &ulp->ul_vnops_cnt;
         if (!ULOCKFS_IS_SLOCK(ulp)) {
-                atomic_add_long(ctr, 1);
+                atomic_inc_ulong(ctr);
                 op_cnt_incremented++;
         }
 
         /*
          * If the lockfs state (indicated by ul_fs_lock) is not just

@@ -1397,11 +1397,11 @@
          * so make use of ufs_quiesce_pend to disallow vnode operations when a
          * quiesce is in progress.
          */
         if (!ULOCKFS_IS_JUSTULOCK(ulp) || ufs_quiesce_pend) {
                 if (op_cnt_incremented)
-                        if (!atomic_add_long_nv(ctr, -1))
+                        if (!atomic_dec_ulong_nv(ctr))
                                 cv_broadcast(&ulp->ul_cv);
                 mutex_enter(&ulp->ul_lock);
                 error = ufs_check_lockfs(ufsvfsp, ulp, mask);
                 mutex_exit(&ulp->ul_lock);
                 if (error) {

@@ -1512,18 +1512,18 @@
 
         /* fallocate thread */
         if (ULOCKFS_IS_FALLOC(ulp) && info->flags & ULOCK_INFO_FALLOCATE) {
                 /* Clear the thread's fallocate state */
                 info->flags &= ~ULOCK_INFO_FALLOCATE;
-                if (!atomic_add_long_nv(&ulp->ul_falloc_cnt, -1)) {
+                if (!atomic_dec_ulong_nv(&ulp->ul_falloc_cnt)) {
                         mutex_enter(&ulp->ul_lock);
                         ULOCKFS_CLR_FALLOC(ulp);
                         cv_broadcast(&ulp->ul_cv);
                         mutex_exit(&ulp->ul_lock);
                 }
         } else  { /* normal thread */
-                if (!atomic_add_long_nv(&ulp->ul_vnops_cnt, -1))
+                if (!atomic_dec_ulong_nv(&ulp->ul_vnops_cnt))
                         cv_broadcast(&ulp->ul_cv);
         }
 }
 
 /*

@@ -1585,11 +1585,11 @@
          * never see the value of zero for ctr - a livelock kind of scenario.
          */
         ctr = (mask & ULOCKFS_FWLOCK) ?
             &ulp->ul_falloc_cnt : &ulp->ul_vnops_cnt;
         if (!ULOCKFS_IS_SLOCK(ulp)) {
-                atomic_add_long(ctr, 1);
+                atomic_inc_ulong(ctr);
                 op_cnt_incremented++;
         }
 
         if (!ULOCKFS_IS_JUSTULOCK(ulp) || ufs_quiesce_pend) {
                 /*

@@ -1599,11 +1599,11 @@
                  * and if ulp->ul_fs_lock allows this operation, increment
                  * the appropriate counter and proceed (For eg., In case the
                  * file system is delete locked, a mmap can still go through).
                  */
                 if (op_cnt_incremented)
-                        if (!atomic_add_long_nv(ctr, -1))
+                        if (!atomic_dec_ulong_nv(ctr))
                                 cv_broadcast(&ulp->ul_cv);
                 mutex_enter(&ulp->ul_lock);
                 if (ULOCKFS_IS_HLOCK(ulp) ||
                     (ULOCKFS_IS_ELOCK(ulp) && ufsvfsp->vfs_dontblock))
                         error = EIO;

@@ -1615,11 +1615,11 @@
                         if (ulockfs_info_free == NULL)
                                 kmem_free(ulockfs_info_temp,
                                     sizeof (ulockfs_info_t));
                         return (error);
                 }
-                atomic_add_long(ctr, 1);
+                atomic_inc_ulong(ctr);
                 if (mask & ULOCKFS_FWLOCK)
                         ULOCKFS_SET_FALLOC(ulp);
                 mutex_exit(&ulp->ul_lock);
         } else {
                 /*

@@ -1646,11 +1646,11 @@
                                 if (ulockfs_info_free == NULL)
                                         kmem_free(ulockfs_info_temp,
                                             sizeof (ulockfs_info_t));
                                 return (error);
                         }
-                        atomic_add_long(ctr, 1);
+                        atomic_inc_ulong(ctr);
                         if (mask & ULOCKFS_FWLOCK)
                                 ULOCKFS_SET_FALLOC(ulp);
                         mutex_exit(&ulp->ul_lock);
                 } else if (mask & ULOCKFS_FWLOCK) {
                         mutex_enter(&ulp->ul_lock);

@@ -1728,13 +1728,13 @@
         }
 
         /*
          * First time VOP call
          */
-        atomic_add_long(&ulp->ul_vnops_cnt, 1);
+        atomic_inc_ulong(&ulp->ul_vnops_cnt);
         if (!ULOCKFS_IS_JUSTULOCK(ulp) || ufs_quiesce_pend) {
-                if (!atomic_add_long_nv(&ulp->ul_vnops_cnt, -1))
+                if (!atomic_dec_ulong_nv(&ulp->ul_vnops_cnt))
                         cv_broadcast(&ulp->ul_cv);
                 mutex_enter(&ulp->ul_lock);
                 if (seg->s_ops == &segvn_ops &&
                     ((struct segvn_data *)seg->s_data)->type != MAP_SHARED) {
                         mask = (ulong_t)ULOCKFS_GETREAD_MASK;