summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-07-04 16:20:28 +0000
committerdillon <dillon@FreeBSD.org>2001-07-04 16:20:28 +0000
commite028603b7e3e4fb35cdf00aab533f3965f4a13cc (patch)
tree7420cce169451a74c5b87963467a4aeff668ed12 /sys/kern/vfs_subr.c
parent0b028660051eb7abf4306d34e7fec0e7fde86a28 (diff)
downloadFreeBSD-src-e028603b7e3e4fb35cdf00aab533f3965f4a13cc.zip
FreeBSD-src-e028603b7e3e4fb35cdf00aab533f3965f4a13cc.tar.gz
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 04941e3..b421902 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -711,7 +711,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
int s, error;
vm_object_t object;
- mtx_assert(&vm_mtx, MA_NOTOWNED);
+ GIANT_REQUIRED;
if (flags & V_SAVE) {
s = splbio();
@@ -799,10 +799,8 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo)
*/
mtx_lock(&vp->v_interlock);
if (VOP_GETVOBJECT(vp, &object) == 0) {
- mtx_lock(&vm_mtx);
vm_object_page_remove(object, 0, 0,
(flags & V_SAVE) ? TRUE : FALSE);
- mtx_unlock(&vm_mtx);
}
mtx_unlock(&vp->v_interlock);
@@ -1136,8 +1134,6 @@ speedup_syncer()
* Also sets B_PAGING flag to indicate that vnode is not fully associated
* with the buffer. i.e. the bp has not been linked into the vnode or
* ref-counted.
- *
- * Doesn't block, only vnode seems to need a lock.
*/
void
pbgetvp(vp, bp)
@@ -1560,7 +1556,8 @@ vput(vp)
{
struct proc *p = curproc; /* XXX */
- mtx_assert(&Giant, MA_OWNED);
+ GIANT_REQUIRED;
+
KASSERT(vp != NULL, ("vput: null vp"));
mtx_lock(&vp->v_interlock);
/* Skip this v_writecount check if we're going to panic below. */
@@ -2363,6 +2360,8 @@ vfs_msync(struct mount *mp, int flags) {
struct vm_object *obj;
int anyio, tries;
+ GIANT_REQUIRED;
+
tries = 5;
loop:
anyio = 0;
@@ -2394,11 +2393,9 @@ loop:
if (!vget(vp,
LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY | LK_NOOBJ, curproc)) {
if (VOP_GETVOBJECT(vp, &obj) == 0) {
- mtx_lock(&vm_mtx);
vm_object_page_clean(obj, 0, 0,
flags == MNT_WAIT ?
OBJPC_SYNC : OBJPC_NOSYNC);
- mtx_unlock(&vm_mtx);
anyio = 1;
}
vput(vp);
@@ -2427,8 +2424,7 @@ vfs_object_create(vp, p, cred)
struct proc *p;
struct ucred *cred;
{
-
- mtx_assert(&vm_mtx, MA_NOTOWNED);
+ GIANT_REQUIRED;
return (VOP_CREATEVOBJECT(vp, cred, p));
}
OpenPOWER on IntegriCloud