summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/conf/files3
-rw-r--r--sys/dev/ata/wd.c22
2 files changed, 13 insertions, 12 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 3cc13213774..4c9c5d674fb 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.490 2010/05/11 09:37:13 claudio Exp $
+# $OpenBSD: files,v 1.491 2010/05/26 16:16:23 thib Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -692,6 +692,7 @@ file kern/exec_subr.c
file kern/init_main.c
file kern/init_sysent.c
file kern/kern_acct.c accounting
+file kern/kern_bufq.c
file kern/kern_clock.c
file kern/kern_descrip.c
file kern/kern_event.c
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 545236089f1..6b172b1a0e3 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.82 2010/05/24 11:18:50 kettenis Exp $ */
+/* $OpenBSD: wd.c,v 1.83 2010/05/26 16:16:23 thib Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -70,6 +70,7 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/mutex.h>
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/malloc.h>
@@ -120,7 +121,8 @@ struct wd_softc {
/* General disk infos */
struct device sc_dev;
struct disk sc_dk;
- struct buf sc_q;
+ struct bufq *sc_bufq;
+
/* IDE disk soft states */
struct ata_bio sc_wdc_bio; /* current transfer */
struct buf *sc_bp; /* buf being transferred */
@@ -367,6 +369,7 @@ wdattach(struct device *parent, struct device *self, void *aux)
*/
wd->sc_dk.dk_driver = &wddkdriver;
wd->sc_dk.dk_name = wd->sc_dev.dv_xname;
+ wd->sc_bufq = bufq_init(BUFQ_DEFAULT);
disk_attach(&wd->sc_dk);
wd->sc_wdc_bio.lp = wd->sc_dk.dk_label;
wd->sc_sdhook = shutdownhook_establish(wd_shutdown, wd);
@@ -403,13 +406,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_DEQUEUE(sc->sc_bufq)) != NULL) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
biodone(bp);
@@ -431,6 +433,7 @@ wddetach(struct device *self, int flags)
shutdownhook_disestablish(sc->sc_sdhook);
/* Detach disk. */
+ bufq_destroy(sc->sc_bufq);
disk_detach(&sc->sc_dk);
return (0);
@@ -481,8 +484,8 @@ wdstrategy(struct buf *bp)
(wd->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0)
goto done;
/* Queue transfer on drive, activate drive and controller if idle. */
+ BUFQ_QUEUE(wd->sc_bufq, bp);
s = splbio();
- disksort(&wd->sc_q, bp);
wdstart(wd);
splx(s);
device_unref(&wd->sc_dev);
@@ -506,18 +509,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_DEQUEUE(wd->sc_bufq)) == NULL)
return;
- dp->b_actf = bp->b_actf;
-
/*
* Make the command. First lock the device
*/