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

*** 1242,1254 **** int filemode) { ASSERT(vp->v_type == VREG); if (filemode & FREAD) ! atomic_add_32(&(vp->v_rdcnt), 1); if (filemode & FWRITE) ! atomic_add_32(&(vp->v_wrcnt), 1); } void vn_open_downgrade( --- 1242,1254 ---- int filemode) { ASSERT(vp->v_type == VREG); if (filemode & FREAD) ! atomic_inc_32(&vp->v_rdcnt); if (filemode & FWRITE) ! atomic_inc_32(&vp->v_wrcnt); } void vn_open_downgrade(
*** 1257,1271 **** { ASSERT(vp->v_type == VREG); if (filemode & FREAD) { ASSERT(vp->v_rdcnt > 0); ! atomic_add_32(&(vp->v_rdcnt), -1); } if (filemode & FWRITE) { ASSERT(vp->v_wrcnt > 0); ! atomic_add_32(&(vp->v_wrcnt), -1); } } int --- 1257,1271 ---- { ASSERT(vp->v_type == VREG); if (filemode & FREAD) { ASSERT(vp->v_rdcnt > 0); ! atomic_dec_32(&vp->v_rdcnt); } if (filemode & FWRITE) { ASSERT(vp->v_wrcnt > 0); ! atomic_dec_32(&vp->v_wrcnt); } } int
*** 2916,2926 **** u_longlong_t fs_new_caller_id() { static uint64_t next_caller_id = 0LL; /* First call returns 1 */ ! return ((u_longlong_t)atomic_add_64_nv(&next_caller_id, 1)); } /* * Given a starting vnode and a path, updates the path in the target vnode in * a safe manner. If the vnode already has path information embedded, then the --- 2916,2926 ---- u_longlong_t fs_new_caller_id() { static uint64_t next_caller_id = 0LL; /* First call returns 1 */ ! return ((u_longlong_t)atomic_inc_64_nv(&next_caller_id)); } /* * Given a starting vnode and a path, updates the path in the target vnode in * a safe manner. If the vnode already has path information embedded, then the
*** 3144,3156 **** * * The vnode counts are only kept on regular files */ if ((*vpp)->v_type == VREG) { if (mode & FREAD) ! atomic_add_32(&((*vpp)->v_rdcnt), 1); if (mode & FWRITE) ! atomic_add_32(&((*vpp)->v_wrcnt), 1); } VOPXID_MAP_CR(vp, cr); ret = (*(*(vpp))->v_op->vop_open)(vpp, mode, cr, ct); --- 3144,3156 ---- * * The vnode counts are only kept on regular files */ if ((*vpp)->v_type == VREG) { if (mode & FREAD) ! atomic_inc_32(&(*vpp)->v_rdcnt); if (mode & FWRITE) ! atomic_inc_32(&(*vpp)->v_wrcnt); } VOPXID_MAP_CR(vp, cr); ret = (*(*(vpp))->v_op->vop_open)(vpp, mode, cr, ct);
*** 3160,3172 **** * Use the saved vp just in case the vnode ptr got trashed * by the error. */ VOPSTATS_UPDATE(vp, open); if ((vp->v_type == VREG) && (mode & FREAD)) ! atomic_add_32(&(vp->v_rdcnt), -1); if ((vp->v_type == VREG) && (mode & FWRITE)) ! atomic_add_32(&(vp->v_wrcnt), -1); } else { /* * Some filesystems will return a different vnode, * but the same path was still used to open it. * So if we do change the vnode and need to --- 3160,3172 ---- * Use the saved vp just in case the vnode ptr got trashed * by the error. */ VOPSTATS_UPDATE(vp, open); if ((vp->v_type == VREG) && (mode & FREAD)) ! atomic_dec_32(&vp->v_rdcnt); if ((vp->v_type == VREG) && (mode & FWRITE)) ! atomic_dec_32(&vp->v_wrcnt); } else { /* * Some filesystems will return a different vnode, * but the same path was still used to open it. * So if we do change the vnode and need to
*** 3176,3192 **** */ VOPSTATS_UPDATE(*vpp, open); if (*vpp != vp && *vpp != NULL) { vn_copypath(vp, *vpp); if (((*vpp)->v_type == VREG) && (mode & FREAD)) ! atomic_add_32(&((*vpp)->v_rdcnt), 1); if ((vp->v_type == VREG) && (mode & FREAD)) ! atomic_add_32(&(vp->v_rdcnt), -1); if (((*vpp)->v_type == VREG) && (mode & FWRITE)) ! atomic_add_32(&((*vpp)->v_wrcnt), 1); if ((vp->v_type == VREG) && (mode & FWRITE)) ! atomic_add_32(&(vp->v_wrcnt), -1); } } VN_RELE(vp); return (ret); } --- 3176,3192 ---- */ VOPSTATS_UPDATE(*vpp, open); if (*vpp != vp && *vpp != NULL) { vn_copypath(vp, *vpp); if (((*vpp)->v_type == VREG) && (mode & FREAD)) ! atomic_inc_32(&(*vpp)->v_rdcnt); if ((vp->v_type == VREG) && (mode & FREAD)) ! atomic_dec_32(&vp->v_rdcnt); if (((*vpp)->v_type == VREG) && (mode & FWRITE)) ! atomic_inc_32(&(*vpp)->v_wrcnt); if ((vp->v_type == VREG) && (mode & FWRITE)) ! atomic_dec_32(&vp->v_wrcnt); } } VN_RELE(vp); return (ret); }
*** 3211,3225 **** * kept on regular files */ if ((vp->v_type == VREG) && (count == 1)) { if (flag & FREAD) { ASSERT(vp->v_rdcnt > 0); ! atomic_add_32(&(vp->v_rdcnt), -1); } if (flag & FWRITE) { ASSERT(vp->v_wrcnt > 0); ! atomic_add_32(&(vp->v_wrcnt), -1); } } return (err); } --- 3211,3225 ---- * kept on regular files */ if ((vp->v_type == VREG) && (count == 1)) { if (flag & FREAD) { ASSERT(vp->v_rdcnt > 0); ! atomic_dec_32(&vp->v_rdcnt); } if (flag & FWRITE) { ASSERT(vp->v_wrcnt > 0); ! atomic_dec_32(&vp->v_wrcnt); } } return (err); }