summaryrefslogtreecommitdiff
path: root/sys/dev/ata
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2009-06-03 22:09:31 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2009-06-03 22:09:31 +0000
commitb25274aac4d1fef726702d299f285d361d17febc (patch)
treebf0a0eecf0269cbaf678c70381c20b040e57ed02 /sys/dev/ata
parentb96794b04ab20a0aba439e48813238555739661d (diff)
add a flexible buffer queue (bufq) api, based on the never used
one by tedu@. It doesn't do anything smart yet, it just uses plain old disksort. we also keep the old method of queueing bufs since some miods have crazy MD drivers that need some love. ok beck@, art@ tested by many on many archs.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r--sys/dev/ata/wd.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 045f8188f3b..e6d9f45e2f6 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.73 2008/11/08 01:32:06 chl Exp $ */
+/* $OpenBSD: wd.c,v 1.74 2009/06/03 22:09:30 thib Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -119,7 +119,7 @@ struct wd_softc {
/* General disk infos */
struct device sc_dev;
struct disk sc_dk;
- struct buf sc_q;
+
/* IDE disk soft states */
struct ata_bio sc_wdc_bio; /* current transfer */
struct buf *sc_bp; /* buf being transferred */
@@ -396,13 +396,12 @@ int
wddetach(struct device *self, int flags)
{
struct wd_softc *sc = (struct wd_softc *)self;
- struct buf *dp, *bp;
+ struct buf *bp;
int s, bmaj, cmaj, mn;
/* Remove unprocessed buffers from queue */
s = splbio();
- for (dp = &sc->sc_q; (bp = dp->b_actf) != NULL; ) {
- dp->b_actf = bp->b_actf;
+ while ((bp = BUFQ_GET(sc->sc_dk.dk_bufq)) != NULL) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
biodone(bp);
@@ -475,7 +474,7 @@ wdstrategy(struct buf *bp)
goto done;
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- disksort(&wd->sc_q, bp);
+ BUFQ_ADD(wd->sc_dk.dk_bufq, bp);
wdstart(wd);
splx(s);
device_unref(&wd->sc_dev);
@@ -499,18 +498,15 @@ void
wdstart(void *arg)
{
struct wd_softc *wd = arg;
- struct buf *dp, *bp = NULL;
+ struct buf *bp = NULL;
WDCDEBUG_PRINT(("wdstart %s\n", wd->sc_dev.dv_xname),
DEBUG_XFERS);
while (wd->openings > 0) {
/* Is there a buf for us ? */
- dp = &wd->sc_q;
- if ((bp = dp->b_actf) == NULL) /* yes, an assign */
+ if ((bp = BUFQ_GET(wd->sc_dk.dk_bufq)) == NULL)
return;
- dp->b_actf = bp->b_actf;
-
/*
* Make the command. First lock the device
*/