summaryrefslogtreecommitdiffstats
path: root/sys/dev
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/dev
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/dev')
-rw-r--r--sys/dev/md/md.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index a7de5c2..f8e6a18 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -692,6 +692,8 @@ mddestroy(struct md_s *sc, struct md_ioctl *mdio, struct proc *p)
{
unsigned u;
+ GIANT_REQUIRED;
+
if (sc->dev != NULL) {
devstat_remove_entry(&sc->stats);
disk_destroy(sc->dev);
@@ -701,9 +703,7 @@ mddestroy(struct md_s *sc, struct md_ioctl *mdio, struct proc *p)
if (sc->cred != NULL)
crfree(sc->cred);
if (sc->object != NULL) {
- mtx_lock(&vm_mtx);
vm_pager_deallocate(sc->object);
- mtx_unlock(&vm_mtx);
}
if (sc->secp != NULL) {
for (u = 0; u < sc->nsect; u++)
@@ -725,6 +725,8 @@ mdcreate_swap(struct md_ioctl *mdio, struct proc *p)
int error;
struct md_s *sc;
+ GIANT_REQUIRED;
+
if (mdio->md_options & MD_AUTOUNIT) {
sc = mdnew(-1);
mdio->md_unit = sc->unit;
@@ -757,18 +759,15 @@ mdcreate_swap(struct md_ioctl *mdio, struct proc *p)
sc->secsize = PAGE_SIZE;
sc->nsect = mdio->md_size / (PAGE_SIZE / DEV_BSIZE);
- mtx_lock(&vm_mtx);
sc->object = vm_pager_allocate(OBJT_SWAP, NULL, sc->secsize * (vm_offset_t)sc->nsect, VM_PROT_DEFAULT, 0);
if (mdio->md_options & MD_RESERVE) {
if (swap_pager_reserve(sc->object, 0, sc->nsect) < 0) {
vm_pager_deallocate(sc->object);
- mtx_unlock(&vm_mtx);
sc->object = NULL;
mddestroy(sc, mdio, p);
return(EDOM);
}
}
- mtx_unlock(&vm_mtx);
error = mdsetcred(sc, p->p_ucred);
if (error)
mddestroy(sc, mdio, p);
OpenPOWER on IntegriCloud