summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2013-11-01 01:06:04 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2013-11-01 01:06:04 +0000
commite7a6c8455a06afddf53016e1936e8bdc5f7323b5 (patch)
treec4503998156d9229046c14060855defed30d6141 /sys
parent6708f7c3ddfd55d9c7e4287ed8d64620c8c70313 (diff)
replace bare use of disksort with bufqs.
tweaks and ok jmatthew@ testing and ok bcallah@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/octeon/dev/octcf.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/arch/octeon/dev/octcf.c b/sys/arch/octeon/dev/octcf.c
index 179f7589e64..3227d5f2c65 100644
--- a/sys/arch/octeon/dev/octcf.c
+++ b/sys/arch/octeon/dev/octcf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: octcf.c,v 1.12 2013/06/11 16:42:10 deraadt Exp $ */
+/* $OpenBSD: octcf.c,v 1.13 2013/11/01 01:06:03 dlg Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -111,7 +111,7 @@ struct octcf_softc {
/* General disk infos */
struct device sc_dev;
struct disk sc_dk;
- struct buf sc_q;
+ struct bufq sc_bufq;
struct buf *sc_bp;
struct ataparams sc_params;/* drive characteristics found */
int sc_flags;
@@ -260,6 +260,7 @@ octcfattach(struct device *parent, struct device *self, void *aux)
* Initialize disk structures.
*/
wd->sc_dk.dk_name = wd->sc_dev.dv_xname;
+ bufq_init(&wd->sc_bufq, BUFQ_DEFAULT);
/* Attach disk. */
disk_attach(&wd->sc_dev, &wd->sc_dk);
@@ -326,9 +327,11 @@ octcfstrategy(struct buf *bp)
goto bad;
}
+ /* Queue the I/O */
+ bufq_queue(&wd->sc_bufq, bp);
+
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- disksort(&wd->sc_q, bp);
octcfstart(wd);
splx(s);
device_unref(&wd->sc_dev);
@@ -352,18 +355,11 @@ void
octcfstart(void *arg)
{
struct octcf_softc *wd = arg;
- struct buf *dp, *bp;
+ struct buf *bp;
OCTCFDEBUG_PRINT(("%s %s\n", __func__, wd->sc_dev.dv_xname),
DEBUG_XFERS);
- while (1) {
- /* Remove the next buffer from the queue or stop. */
- dp = &wd->sc_q;
- bp = dp->b_actf;
- if (bp == NULL)
- return;
- dp->b_actf = bp->b_actf;
-
+ while ((bp = bufq_dequeue(&wd->sc_bufq)) != NULL) {
/* Transfer this buffer now. */
_octcfstart(wd, bp);
}