diff options
author | bmilekic <bmilekic@FreeBSD.org> | 2001-02-09 06:11:45 +0000 |
---|---|---|
committer | bmilekic <bmilekic@FreeBSD.org> | 2001-02-09 06:11:45 +0000 |
commit | f364d4ac3621ae2689a3cc1b82c73eb491475a24 (patch) | |
tree | 84444d0341ce519800ed7913d826f5f38c622d6d /sys/fs | |
parent | 363bdddf694863339f6629340cfb324771b8ffe7 (diff) | |
download | FreeBSD-src-f364d4ac3621ae2689a3cc1b82c73eb491475a24.zip FreeBSD-src-f364d4ac3621ae2689a3cc1b82c73eb491475a24.tar.gz |
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.
Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 16 | ||||
-rw-r--r-- | sys/fs/deadfs/dead_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_hash.c | 24 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 16 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 14 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 4 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_ihash.c | 12 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_subr.c | 14 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vfsops.c | 4 | ||||
-rw-r--r-- | sys/fs/nullfs/null_vnops.c | 4 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_node.c | 2 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_vnops.c | 14 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_ctl.c | 32 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_status.c | 6 |
14 files changed, 82 insertions, 82 deletions
diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index f260802..00f79e8 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -102,18 +102,18 @@ cd9660_ihashget(dev, inum) struct vnode *vp; loop: - mtx_enter(&cd9660_ihash_mtx, MTX_DEF); + mtx_lock(&cd9660_ihash_mtx); for (ip = isohashtbl[INOHASH(dev, inum)]; ip; ip = ip->i_next) { if (inum == ip->i_number && dev == ip->i_dev) { vp = ITOV(ip); - mtx_enter(&vp->v_interlock, MTX_DEF); - mtx_exit(&cd9660_ihash_mtx, MTX_DEF); + mtx_lock(&vp->v_interlock); + mtx_unlock(&cd9660_ihash_mtx); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; return (vp); } } - mtx_exit(&cd9660_ihash_mtx, MTX_DEF); + mtx_unlock(&cd9660_ihash_mtx); return (NULL); } @@ -127,14 +127,14 @@ cd9660_ihashins(ip) struct proc *p = curproc; /* XXX */ struct iso_node **ipp, *iq; - mtx_enter(&cd9660_ihash_mtx, MTX_DEF); + mtx_lock(&cd9660_ihash_mtx); ipp = &isohashtbl[INOHASH(ip->i_dev, ip->i_number)]; if ((iq = *ipp) != NULL) iq->i_prev = &ip->i_next; ip->i_next = iq; ip->i_prev = ipp; *ipp = ip; - mtx_exit(&cd9660_ihash_mtx, MTX_DEF); + mtx_unlock(&cd9660_ihash_mtx); lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, p); } @@ -148,7 +148,7 @@ cd9660_ihashrem(ip) { register struct iso_node *iq; - mtx_enter(&cd9660_ihash_mtx, MTX_DEF); + mtx_lock(&cd9660_ihash_mtx); if ((iq = ip->i_next) != NULL) iq->i_prev = ip->i_prev; *ip->i_prev = iq; @@ -156,7 +156,7 @@ cd9660_ihashrem(ip) ip->i_next = NULL; ip->i_prev = NULL; #endif - mtx_exit(&cd9660_ihash_mtx, MTX_DEF); + mtx_unlock(&cd9660_ihash_mtx); } /* diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 4211f25..8de5c57 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -211,7 +211,7 @@ dead_lock(ap) * the interlock here. */ if (ap->a_flags & LK_INTERLOCK) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); ap->a_flags &= ~LK_INTERLOCK; } if (!chkvnlock(vp)) diff --git a/sys/fs/hpfs/hpfs_hash.c b/sys/fs/hpfs/hpfs_hash.c index 50c9b66..791680c 100644 --- a/sys/fs/hpfs/hpfs_hash.c +++ b/sys/fs/hpfs/hpfs_hash.c @@ -92,11 +92,11 @@ hpfs_hphashlookup(dev, ino) { struct hpfsnode *hp; - mtx_enter(&hpfs_hphash_mtx, MTX_DEF); + mtx_lock(&hpfs_hphash_mtx); LIST_FOREACH(hp, HPNOHASH(dev, ino), h_hash) if (ino == hp->h_no && dev == hp->h_dev) break; - mtx_exit(&hpfs_hphash_mtx, MTX_DEF); + mtx_unlock(&hpfs_hphash_mtx); return (hp); } @@ -110,14 +110,14 @@ hpfs_hphashget(dev, ino) struct hpfsnode *hp; loop: - mtx_enter(&hpfs_hphash_mtx, MTX_DEF); + mtx_lock(&hpfs_hphash_mtx); LIST_FOREACH(hp, HPNOHASH(dev, ino), h_hash) { if (ino == hp->h_no && dev == hp->h_dev) { LOCKMGR(&hp->h_intlock, LK_EXCLUSIVE | LK_INTERLOCK, &hpfs_hphash_slock, NULL); return (hp); } } - mtx_exit(&hpfs_hphash_mtx, MTX_DEF); + mtx_unlock(&hpfs_hphash_mtx); return (hp); } #endif @@ -132,18 +132,18 @@ hpfs_hphashvget(dev, ino, p) struct vnode *vp; loop: - mtx_enter(&hpfs_hphash_mtx, MTX_DEF); + mtx_lock(&hpfs_hphash_mtx); LIST_FOREACH(hp, HPNOHASH(dev, ino), h_hash) { if (ino == hp->h_no && dev == hp->h_dev) { vp = HPTOV(hp); - mtx_enter(&vp->v_interlock, MTX_DEF); - mtx_exit(&hpfs_hphash_mtx, MTX_DEF); + mtx_lock(&vp->v_interlock); + mtx_unlock(&hpfs_hphash_mtx); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; return (vp); } } - mtx_exit(&hpfs_hphash_mtx, MTX_DEF); + mtx_unlock(&hpfs_hphash_mtx); return (NULLVP); } @@ -156,11 +156,11 @@ hpfs_hphashins(hp) { struct hphashhead *hpp; - mtx_enter(&hpfs_hphash_mtx, MTX_DEF); + mtx_lock(&hpfs_hphash_mtx); hpp = HPNOHASH(hp->h_dev, hp->h_no); hp->h_flag |= H_HASHED; LIST_INSERT_HEAD(hpp, hp, h_hash); - mtx_exit(&hpfs_hphash_mtx, MTX_DEF); + mtx_unlock(&hpfs_hphash_mtx); } /* @@ -170,10 +170,10 @@ void hpfs_hphashrem(hp) struct hpfsnode *hp; { - mtx_enter(&hpfs_hphash_mtx, MTX_DEF); + mtx_lock(&hpfs_hphash_mtx); if (hp->h_flag & H_HASHED) { hp->h_flag &= ~H_HASHED; LIST_REMOVE(hp, h_hash); } - mtx_exit(&hpfs_hphash_mtx, MTX_DEF); + mtx_unlock(&hpfs_hphash_mtx); } diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 6c1a3c7..dbdf554 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -130,21 +130,21 @@ msdosfs_hashget(dev, dirclust, diroff) struct vnode *vp; loop: - mtx_enter(&dehash_mtx, MTX_DEF); + mtx_lock(&dehash_mtx); for (dep = DEHASH(dev, dirclust, diroff); dep; dep = dep->de_next) { if (dirclust == dep->de_dirclust && diroff == dep->de_diroffset && dev == dep->de_dev && dep->de_refcnt != 0) { vp = DETOV(dep); - mtx_enter(&vp->v_interlock, MTX_DEF); - mtx_exit(&dehash_mtx, MTX_DEF); + mtx_lock(&vp->v_interlock); + mtx_unlock(&dehash_mtx); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; return (dep); } } - mtx_exit(&dehash_mtx, MTX_DEF); + mtx_unlock(&dehash_mtx); return (NULL); } @@ -154,7 +154,7 @@ msdosfs_hashins(dep) { struct denode **depp, *deq; - mtx_enter(&dehash_mtx, MTX_DEF); + mtx_lock(&dehash_mtx); depp = &DEHASH(dep->de_dev, dep->de_dirclust, dep->de_diroffset); deq = *depp; if (deq) @@ -162,7 +162,7 @@ msdosfs_hashins(dep) dep->de_next = deq; dep->de_prev = depp; *depp = dep; - mtx_exit(&dehash_mtx, MTX_DEF); + mtx_unlock(&dehash_mtx); } static void @@ -171,7 +171,7 @@ msdosfs_hashrem(dep) { struct denode *deq; - mtx_enter(&dehash_mtx, MTX_DEF); + mtx_lock(&dehash_mtx); deq = dep->de_next; if (deq) deq->de_prev = dep->de_prev; @@ -180,7 +180,7 @@ msdosfs_hashrem(dep) dep->de_next = NULL; dep->de_prev = NULL; #endif - mtx_exit(&dehash_mtx, MTX_DEF); + mtx_unlock(&dehash_mtx); } /* diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 449d691..3088d7a 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -862,7 +862,7 @@ msdosfs_sync(mp, waitfor, cred, p) /* * Write back each (modified) denode. */ - mtx_enter(&mntvnode_mtx, MTX_DEF); + mtx_lock(&mntvnode_mtx); loop: for (vp = LIST_FIRST(&mp->mnt_vnodelist); vp != NULL; vp = nvp) { /* @@ -872,20 +872,20 @@ loop: if (vp->v_mount != mp) goto loop; - mtx_enter(&vp->v_interlock, MTX_DEF); + mtx_lock(&vp->v_interlock); nvp = LIST_NEXT(vp, v_mntvnodes); dep = VTODE(vp); if (vp->v_type == VNON || ((dep->de_flag & (DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0 && (TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); continue; } - mtx_exit(&mntvnode_mtx, MTX_DEF); + mtx_unlock(&mntvnode_mtx); error = vget(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, p); if (error) { - mtx_enter(&mntvnode_mtx, MTX_DEF); + mtx_lock(&mntvnode_mtx); if (error == ENOENT) goto loop; continue; @@ -895,9 +895,9 @@ loop: allerror = error; VOP_UNLOCK(vp, 0, p); vrele(vp); - mtx_enter(&mntvnode_mtx, MTX_DEF); + mtx_lock(&mntvnode_mtx); } - mtx_exit(&mntvnode_mtx, MTX_DEF); + mtx_unlock(&mntvnode_mtx); /* * Flush filesystem control info. diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index e4052f7..fb7b83d 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -233,12 +233,12 @@ msdosfs_close(ap) struct denode *dep = VTODE(vp); struct timespec ts; - mtx_enter(&vp->v_interlock, MTX_DEF); + mtx_lock(&vp->v_interlock); if (vp->v_usecount > 1) { getnanotime(&ts); DETIMES(dep, &ts, &ts, &ts); } - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); return 0; } diff --git a/sys/fs/ntfs/ntfs_ihash.c b/sys/fs/ntfs/ntfs_ihash.c index b9c0345..fea648c 100644 --- a/sys/fs/ntfs/ntfs_ihash.c +++ b/sys/fs/ntfs/ntfs_ihash.c @@ -93,11 +93,11 @@ ntfs_nthashlookup(dev, inum) { struct ntnode *ip; - mtx_enter(&ntfs_nthash_mtx, MTX_DEF); + mtx_lock(&ntfs_nthash_mtx); LIST_FOREACH(ip, NTNOHASH(dev, inum), i_hash) if (inum == ip->i_number && dev == ip->i_dev) break; - mtx_exit(&ntfs_nthash_mtx, MTX_DEF); + mtx_unlock(&ntfs_nthash_mtx); return (ip); } @@ -111,11 +111,11 @@ ntfs_nthashins(ip) { struct nthashhead *ipp; - mtx_enter(&ntfs_nthash_mtx, MTX_DEF); + mtx_lock(&ntfs_nthash_mtx); ipp = NTNOHASH(ip->i_dev, ip->i_number); LIST_INSERT_HEAD(ipp, ip, i_hash); ip->i_flag |= IN_HASHED; - mtx_exit(&ntfs_nthash_mtx, MTX_DEF); + mtx_unlock(&ntfs_nthash_mtx); } /* @@ -125,10 +125,10 @@ void ntfs_nthashrem(ip) struct ntnode *ip; { - mtx_enter(&ntfs_nthash_mtx, MTX_DEF); + mtx_lock(&ntfs_nthash_mtx); if (ip->i_flag & IN_HASHED) { ip->i_flag &= ~IN_HASHED; LIST_REMOVE(ip, i_hash); } - mtx_exit(&ntfs_nthash_mtx, MTX_DEF); + mtx_unlock(&ntfs_nthash_mtx); } diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index 38324f2..c55cd0a 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -360,7 +360,7 @@ ntfs_ntget(ip) dprintf(("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount)); - mtx_enter(&ip->i_interlock, MTX_DEF); + mtx_lock(&ip->i_interlock); ip->i_usecount++; LOCKMGR(&ip->i_lock, LK_EXCLUSIVE | LK_INTERLOCK, &ip->i_interlock); @@ -438,7 +438,7 @@ ntfs_ntput(ip) dprintf(("ntfs_ntput: rele ntnode %d: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount)); - mtx_enter(&ip->i_interlock, MTX_DEF); + mtx_lock(&ip->i_interlock); ip->i_usecount--; #ifdef DIAGNOSTIC @@ -462,7 +462,7 @@ ntfs_ntput(ip) LIST_REMOVE(vap,va_list); ntfs_freentvattr(vap); } - mtx_exit(&ip->i_interlock, MTX_DEF); + mtx_unlock(&ip->i_interlock); mtx_destroy(&ip->i_interlock); lockdestroy(&ip->i_lock); @@ -479,9 +479,9 @@ void ntfs_ntref(ip) struct ntnode *ip; { - mtx_enter(&ip->i_interlock, MTX_DEF); + mtx_lock(&ip->i_interlock); ip->i_usecount++; - mtx_exit(&ip->i_interlock, MTX_DEF); + mtx_unlock(&ip->i_interlock); dprintf(("ntfs_ntref: ino %d, usecount: %d\n", ip->i_number, ip->i_usecount)); @@ -498,13 +498,13 @@ ntfs_ntrele(ip) dprintf(("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount)); - mtx_enter(&ip->i_interlock, MTX_DEF); + mtx_lock(&ip->i_interlock); ip->i_usecount--; if (ip->i_usecount < 0) panic("ntfs_ntrele: ino: %d usecount: %d \n", ip->i_number,ip->i_usecount); - mtx_exit(&ip->i_interlock, MTX_DEF); + mtx_unlock(&ip->i_interlock); } /* diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 7c6b2c0..384883e 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -196,9 +196,9 @@ ntfs_mountroot() return (error); } - mtx_enter(&mountlist_mtx, MTX_DEF); + mtx_lock(&mountlist_mtx); TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); - mtx_exit(&mountlist_mtx, MTX_DEF); + mtx_unlock(&mountlist_mtx); (void)ntfs_statfs(mp, &mp->mnt_stat, p); vfs_unbusy(mp); return (0); diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 6dc0509..e9fded7 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -624,7 +624,7 @@ null_lock(ap) if (lvp == NULL) return (lockmgr(&vp->v_lock, flags, &vp->v_interlock, p)); if (flags & LK_INTERLOCK) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); flags &= ~LK_INTERLOCK; } if ((flags & LK_TYPE_MASK) == LK_DRAIN) { @@ -671,7 +671,7 @@ null_unlock(ap) return (lockmgr(&vp->v_lock, flags | LK_RELEASE, &vp->v_interlock, p)); if ((flags & LK_THISLAYER) == 0) { if (flags & LK_INTERLOCK) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); flags &= ~LK_INTERLOCK; } VOP_UNLOCK(lvp, flags & ~LK_INTERLOCK, p); diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index 02a4ee3..2025191 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -149,7 +149,7 @@ loop: rescan: if (nwfs_hashlookup(nmp, fid, &np) == 0) { vp = NWTOV(np); - mtx_enter(&vp->v_interlock, MTX_DEF); + mtx_lock(&vp->v_interlock); lockmgr(&nwhashlock, LK_RELEASE, NULL, p); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index 59694f9..93fe639 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -256,24 +256,24 @@ nwfs_close(ap) if (vp->v_type == VDIR) return 0; /* nothing to do now */ error = 0; - mtx_enter(&vp->v_interlock, MTX_DEF); + mtx_lock(&vp->v_interlock); if (np->opened == 0) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); return 0; } - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1); - mtx_enter(&vp->v_interlock, MTX_DEF); + mtx_lock(&vp->v_interlock); if (np->opened == 0) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); return 0; } if (--np->opened == 0) { - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, ap->a_p, ap->a_cred); } else - mtx_exit(&vp->v_interlock, MTX_DEF); + mtx_unlock(&vp->v_interlock); np->n_atime = 0; return (error); } diff --git a/sys/fs/procfs/procfs_ctl.c b/sys/fs/procfs/procfs_ctl.c index 5d0ce44..1ca2208 100644 --- a/sys/fs/procfs/procfs_ctl.c +++ b/sys/fs/procfs/procfs_ctl.c @@ -167,13 +167,13 @@ procfs_control(curp, p, op) default: PROCTREE_LOCK(PT_SHARED); - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); if (!TRACE_WAIT_P(curp, p)) { - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); PROCTREE_LOCK(PT_RELEASE); return (EBUSY); } - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); PROCTREE_LOCK(PT_RELEASE); } @@ -252,31 +252,31 @@ procfs_control(curp, p, op) error = 0; if (p->p_flag & P_TRACED) { PROCTREE_LOCK(PT_SHARED); - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); while (error == 0 && (p->p_stat != SSTOP) && (p->p_flag & P_TRACED) && (p->p_pptr == curp)) { - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); PROCTREE_LOCK(PT_RELEASE); error = tsleep((caddr_t) p, PWAIT|PCATCH, "procfsx", 0); PROCTREE_LOCK(PT_SHARED); - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); } if (error == 0 && !TRACE_WAIT_P(curp, p)) error = EBUSY; - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); PROCTREE_LOCK(PT_RELEASE); } else { - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); while (error == 0 && p->p_stat != SSTOP) { - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); error = tsleep((caddr_t) p, PWAIT|PCATCH, "procfs", 0); - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); } - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); } return (error); @@ -284,10 +284,10 @@ procfs_control(curp, p, op) panic("procfs_control"); } - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); if (p->p_stat == SSTOP) setrunnable(p); - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); return (0); } @@ -329,17 +329,17 @@ procfs_doctl(curp, p, pfs, uio) nm = vfs_findname(signames, msg, xlen); if (nm) { PROCTREE_LOCK(PT_SHARED); - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); if (TRACE_WAIT_P(curp, p)) { p->p_xstat = nm->nm_val; #ifdef FIX_SSTEP FIX_SSTEP(p); #endif setrunnable(p); - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); PROCTREE_LOCK(PT_RELEASE); } else { - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); PROCTREE_LOCK(PT_RELEASE); psignal(p, nm->nm_val); } diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index 813ad60..14c8fb4 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -123,12 +123,12 @@ procfs_dostatus(curp, p, pfs, uio) DOCHECK(); } - mtx_enter(&sched_lock, MTX_SPIN); + mtx_lock_spin(&sched_lock); if (p->p_sflag & PS_INMEM) { struct timeval ut, st; calcru(p, &ut, &st, (struct timeval *) NULL); - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %ld,%ld %ld,%ld %ld,%ld", p->p_stats->p_start.tv_sec, @@ -136,7 +136,7 @@ procfs_dostatus(curp, p, pfs, uio) ut.tv_sec, ut.tv_usec, st.tv_sec, st.tv_usec); } else { - mtx_exit(&sched_lock, MTX_SPIN); + mtx_unlock_spin(&sched_lock); ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " -1,-1 -1,-1 -1,-1"); } |