summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-02-01 01:02:06 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-02-01 01:02:06 +0000
commita777ad9e26b2a0e2e9bf21b52934a353580f4239 (patch)
tree2f21ec7451fe11e7cc5053b357b651f727bf8324 /sys/dev
parent21863e52dc1f57db88c638692064e42cf6eb19be (diff)
Don't throttle and serialize I/O operations, okay miod@ krw@
Fixes kern/5347
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/vnd.c58
1 files changed, 5 insertions, 53 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index fd5091a8944..9dc37757c22 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.67 2007/01/13 16:47:15 thib Exp $ */
+/* $OpenBSD: vnd.c,v 1.68 2007/02/01 01:02:05 pedro Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -130,7 +130,6 @@ struct vnd_softc {
size_t sc_size; /* size of vnd in blocks */
struct vnode *sc_vp; /* vnode */
struct ucred *sc_cred; /* credentials */
- int sc_maxactive; /* max # of active requests */
struct buf sc_tab; /* transfer queue */
blf_ctx *sc_keyctx; /* key context */
};
@@ -143,7 +142,6 @@ struct vnd_softc {
#define VNF_LABELLING 0x0100
#define VNF_WLABEL 0x0200
#define VNF_HAVELABEL 0x0400
-#define VNF_BUSY 0x0800
#define VNF_SIMPLE 0x1000
#define VNF_READONLY 0x2000
@@ -160,7 +158,6 @@ void vndattach(int);
void vndclear(struct vnd_softc *);
void vndstart(struct vnd_softc *);
int vndsetcred(struct vnd_softc *, struct ucred *);
-void vndthrottle(struct vnd_softc *, struct vnode *);
void vndiodone(struct buf *);
void vndshutdown(void);
void vndgetdisklabel(dev_t, struct vnd_softc *);
@@ -378,9 +375,7 @@ vndclose(dev_t dev, int flags, int mode, struct proc *p)
*
* Latter method:
* Repack the buffer into an uio structure and use VOP_READ/VOP_WRITE to
- * access the underlying file. Things are complicated by the fact that we
- * might get recursively called due to buffer flushes. In those cases we
- * queue one write.
+ * access the underlying file.
*/
void
vndstrategy(struct buf *bp)
@@ -440,25 +435,6 @@ vndstrategy(struct buf *bp)
/* No bypassing of buffer cache? */
if (vndsimple(bp->b_dev)) {
- /*
- * In order to avoid "locking against myself" panics, we
- * must be prepared to queue operations during another I/O
- * operation. This situation comes up where a dirty cache
- * buffer needs to be flushed in order to provide the current
- * operation with a fresh buffer.
- *
- * XXX do we really need to protect stuff relating to this with
- * splbio?
- */
- if (vnd->sc_flags & VNF_BUSY) {
- s = splbio();
- bp->b_actf = vnd->sc_tab.b_actf;
- vnd->sc_tab.b_actf = bp;
- vnd->sc_tab.b_active++;
- splx(s);
- return;
- }
-
/* Loop until all queued requests are handled. */
for (;;) {
int part = DISKPART(bp->b_dev);
@@ -473,7 +449,6 @@ vndstrategy(struct buf *bp)
auio.uio_procp = p;
vn_lock(vnd->sc_vp, LK_EXCLUSIVE | LK_RETRY, p);
- vnd->sc_flags |= VNF_BUSY;
if (bp->b_flags & B_READ) {
auio.uio_rw = UIO_READ;
bp->b_error = VOP_READ(vnd->sc_vp, &auio, 0,
@@ -493,7 +468,6 @@ vndstrategy(struct buf *bp)
vndencrypt(vnd, bp->b_data,
bp->b_bcount, bp->b_blkno, 0);
}
- vnd->sc_flags &= ~VNF_BUSY;
VOP_UNLOCK(vnd->sc_vp, 0, p);
if (bp->b_error)
bp->b_flags |= B_ERROR;
@@ -604,12 +578,9 @@ vndstrategy(struct buf *bp)
nbp->vb_buf.b_cylinder = nbp->vb_buf.b_blkno;
s = splbio();
disksort(&vnd->sc_tab, &nbp->vb_buf);
- if (vnd->sc_tab.b_active < vnd->sc_maxactive) {
- vnd->sc_tab.b_active++;
- vndstart(vnd);
- }
+ vnd->sc_tab.b_active++;
+ vndstart(vnd);
splx(s);
-
bn += sz;
addr += sz;
}
@@ -672,9 +643,7 @@ vndiodone(struct buf *bp)
if (vnd->sc_tab.b_active) {
disk_unbusy(&vnd->sc_dk, (pbp->b_bcount - pbp->b_resid),
(pbp->b_flags & B_READ));
- if (vnd->sc_tab.b_actf)
- vndstart(vnd);
- else
+ if (!vnd->sc_tab.b_actf)
vnd->sc_tab.b_active--;
}
if (pbp->b_resid == 0) {
@@ -824,7 +793,6 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
} else
vnd->sc_keyctx = NULL;
- vndthrottle(vnd, vnd->sc_vp);
vio->vnd_size = dbtob((off_t)vnd->sc_size);
vnd->sc_flags |= VNF_INITED;
@@ -999,22 +967,6 @@ vndsetcred(struct vnd_softc *vnd, struct ucred *cred)
return (error);
}
-/*
- * Set maxactive based on FS type
- */
-void
-vndthrottle(struct vnd_softc *vnd, struct vnode *vp)
-{
-#ifdef NFSCLIENT
- extern int (**nfsv2_vnodeop_p)(void *);
-
- if (vp->v_op == nfsv2_vnodeop_p)
- vnd->sc_maxactive = 2;
- else
-#endif
- vnd->sc_maxactive = 8;
-}
-
void
vndshutdown(void)
{