aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/md/md.c')
-rw-r--r--sys/dev/md/md.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 241517898ad4..267554031f23 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -887,23 +887,6 @@ mdstart_vnode(struct md_s *sc, struct bio *bp)
int ma_offs, npages;
bool mapped;
- switch (bp->bio_cmd) {
- case BIO_READ:
- auio.uio_rw = UIO_READ;
- break;
- case BIO_WRITE:
- auio.uio_rw = UIO_WRITE;
- break;
- case BIO_FLUSH:
- break;
- case BIO_DELETE:
- if (sc->candelete)
- break;
- /* FALLTHROUGH */
- default:
- return (EOPNOTSUPP);
- }
-
td = curthread;
vp = sc->vnode;
piov = NULL;
@@ -920,7 +903,14 @@ mdstart_vnode(struct md_s *sc, struct bio *bp)
* still valid.
*/
- if (bp->bio_cmd == BIO_FLUSH) {
+ switch (bp->bio_cmd) {
+ case BIO_READ:
+ auio.uio_rw = UIO_READ;
+ break;
+ case BIO_WRITE:
+ auio.uio_rw = UIO_WRITE;
+ break;
+ case BIO_FLUSH:
do {
(void)vn_start_write(vp, &mp, V_WAIT);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@@ -929,11 +919,17 @@ mdstart_vnode(struct md_s *sc, struct bio *bp)
vn_finished_write(mp);
} while (error == ERELOOKUP);
return (error);
- } else if (bp->bio_cmd == BIO_DELETE) {
- error = vn_deallocate(vp, &off, &len, 0,
- sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred, NOCRED);
- bp->bio_resid = len;
- return (error);
+ case BIO_DELETE:
+ if (sc->candelete) {
+ error = vn_deallocate(vp, &off, &len, 0,
+ sc->flags & MD_ASYNC ? 0 : IO_SYNC, sc->cred,
+ NOCRED);
+ bp->bio_resid = len;
+ return (error);
+ }
+ /* FALLTHROUGH */
+ default:
+ return (EOPNOTSUPP);
}
auio.uio_offset = (vm_ooffset_t)bp->bio_offset;
@@ -981,7 +977,7 @@ unmapped_step:
auio.uio_iovcnt = 1;
}
iostart = auio.uio_offset;
- if (auio.uio_rw == UIO_READ) {
+ if (bp->bio_cmd == BIO_READ) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_READ(vp, &auio, 0, sc->cred);
VOP_UNLOCK(vp);