diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-03-10 20:41:09 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-03-10 20:41:09 +0000 |
| commit | 7a6b2b64294749875e4dc9ae49feac24c1d862e5 (patch) | |
| tree | 59ebe2a7ed44e7865042f27309af6372e0e6c948 | |
| parent | 724e52cd0dd6494889b65466e9350632f4d6eaa8 (diff) | |
Notes
| -rw-r--r-- | sbin/mdconfig/mdconfig.8 | 3 | ||||
| -rw-r--r-- | sbin/mdconfig/mdconfig.c | 6 | ||||
| -rw-r--r-- | sys/dev/md/md.c | 8 | ||||
| -rw-r--r-- | sys/sys/mdioctl.h | 1 |
4 files changed, 14 insertions, 4 deletions
diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index 0b97ddf1c1206..4b2f8e246861e 100644 --- a/sbin/mdconfig/mdconfig.8 +++ b/sbin/mdconfig/mdconfig.8 @@ -141,6 +141,9 @@ other devices. .It Fl o Oo Cm no Oc Ns Ar option Set or reset options. .Bl -tag -width indent +.It Oo Cm no Oc Ns Cm async +For vnode backed devices: avoid IO_SYNC for increased performance but +at the risk of deadlocking the entire kernel. .It Oo Cm no Oc Ns Cm reserve Allocate and reserve all needed storage from the start, rather than as needed. .It Oo Cm no Oc Ns Cm cluster diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 6296da7992686..b23e903831aba 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -117,7 +117,11 @@ main(int argc, char **argv) case 'o': if (cmdline != 2) usage(); - if (!strcmp(optarg, "cluster")) + if (!strcmp(optarg, "async")) + mdio.md_options |= MD_ASYNC; + else if (!strcmp(optarg, "noasync")) + mdio.md_options &= ~MD_ASYNC; + else if (!strcmp(optarg, "cluster")) mdio.md_options |= MD_CLUSTER; else if (!strcmp(optarg, "nocluster")) mdio.md_options &= ~MD_CLUSTER; diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 0d3d9189cd498..6e345dada7278 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -503,13 +503,15 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) if (bp->bio_cmd == BIO_READ) { vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread); error = VOP_READ(sc->vnode, &auio, IO_DIRECT, sc->cred); + VOP_UNLOCK(sc->vnode, 0, curthread); } else { (void) vn_start_write(sc->vnode, &mp, V_WAIT); vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread); - error = VOP_WRITE(sc->vnode, &auio, 0, sc->cred); + error = VOP_WRITE(sc->vnode, &auio, + sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred); + VOP_UNLOCK(sc->vnode, 0, curthread); vn_finished_write(mp); } - VOP_UNLOCK(sc->vnode, 0, curthread); bp->bio_resid = auio.uio_resid; return (error); } @@ -938,7 +940,7 @@ mdcreate_vnode(struct md_ioctl *mdio, struct thread *td) if (mdio->md_fwheads != 0) sc->fwheads = mdio->md_fwheads; sc->type = MD_VNODE; - sc->flags = mdio->md_options & MD_FORCE; + sc->flags = mdio->md_options & (MD_FORCE | MD_ASYNC); if (!(flags & FWRITE)) sc->flags |= MD_READONLY; sc->secsize = DEV_BSIZE; diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h index 3ba206b6aa9a6..861619b3b8cbf 100644 --- a/sys/sys/mdioctl.h +++ b/sys/sys/mdioctl.h @@ -90,5 +90,6 @@ struct md_ioctl { #define MD_READONLY 0x08 /* Readonly mode */ #define MD_COMPRESS 0x10 /* Compression mode */ #define MD_FORCE 0x20 /* Don't try to prevent foot-shooting */ +#define MD_ASYNC 0x40 /* Don't try to prevent foot-shooting */ #endif /* _SYS_MDIOCTL_H_*/ |
