summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_default.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_default.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_default.c')
-rw-r--r--sys/kern/vfs_default.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index dc5b9c9..1a1f55b 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -527,6 +527,8 @@ vop_stdcreatevobject(ap)
vm_object_t object;
int error = 0;
+ GIANT_REQUIRED;
+
if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE)
return (0);
@@ -535,7 +537,6 @@ retry:
if (vp->v_type == VREG || vp->v_type == VDIR) {
if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0)
goto retn;
- mtx_lock(&vm_mtx);
object = vnode_pager_alloc(vp, vat.va_size, 0, 0);
} else if (devsw(vp->v_rdev) != NULL) {
/*
@@ -543,7 +544,6 @@ retry:
* for a disk vnode. This should be fixed, but doesn't
* cause any problems (yet).
*/
- mtx_lock(&vm_mtx);
object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0);
} else {
goto retn;
@@ -553,21 +553,14 @@ retry:
* that the object is associated with the vp.
*/
object->ref_count--;
- mtx_unlock(&vm_mtx);
vp->v_usecount--;
} else {
- /*
- * XXX: safe to hold vm mutex through VOP_UNLOCK?
- */
- mtx_lock(&vm_mtx);
if (object->flags & OBJ_DEAD) {
VOP_UNLOCK(vp, 0, p);
- msleep(object, VM_OBJECT_MTX(object), PVM, "vodead", 0);
- mtx_unlock(&vm_mtx);
+ tsleep(object, PVM, "vodead", 0);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
goto retry;
}
- mtx_unlock(&vm_mtx);
}
KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
@@ -586,10 +579,11 @@ vop_stddestroyvobject(ap)
struct vnode *vp = ap->a_vp;
vm_object_t obj = vp->v_object;
+ GIANT_REQUIRED;
+
if (vp->v_object == NULL)
return (0);
- mtx_lock(&vm_mtx);
if (obj->ref_count == 0) {
/*
* vclean() may be called twice. The first time
@@ -604,7 +598,6 @@ vop_stddestroyvobject(ap)
*/
vm_pager_deallocate(obj);
}
- mtx_unlock(&vm_mtx);
return (0);
}
OpenPOWER on IntegriCloud