summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2013-11-11 03:03:35 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2013-11-11 03:03:35 +0000
commitfca3bd74920f3bc21cea67fa9216092b803f4cce (patch)
tree0d2f328279460d3f3348e1324492017a7dd3644f
parenta5f053934b0d26517ccacf9e54c921d65c5297ef (diff)
replace disksort with bufqs.
i havent had any tests, so if there's any fallout ill deal with it when people hit it. i wont feel guilty about it at all though.
-rw-r--r--sys/dev/flash.c18
-rw-r--r--sys/dev/flashvar.h4
2 files changed, 9 insertions, 13 deletions
diff --git a/sys/dev/flash.c b/sys/dev/flash.c
index 422db0cc9dc..56c6bc18061 100644
--- a/sys/dev/flash.c
+++ b/sys/dev/flash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: flash.c,v 1.28 2013/10/29 21:58:38 krw Exp $ */
+/* $OpenBSD: flash.c,v 1.29 2013/11/11 03:03:34 dlg Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -155,6 +155,7 @@ flashattach(struct flash_softc *sc, struct flash_ctl_tag *tag,
* Initialize and attach the disk structure.
*/
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
+ bufq_init(&sc->sc_bufq, BUFQ_FIFO);
disk_attach(&sc->sc_dev, &sc->sc_dk);
/* XXX establish shutdown hook to finish any commands. */
@@ -795,10 +796,12 @@ flashstrategy(struct buf *bp)
goto done;
/* Queue the transfer. */
+ bufq_queue(&sc->sc_bufq, bp);
+
s = splbio();
- disksort(&sc->sc_q, bp);
flashstart(sc);
splx(s);
+
device_unref(&sc->sc_dev);
return;
@@ -863,16 +866,9 @@ flashsize(dev_t dev)
void
flashstart(struct flash_softc *sc)
{
- struct buf *dp, *bp;
-
- while (1) {
- /* Remove the next buffer from the queue or stop. */
- dp = &sc->sc_q;
- bp = dp->b_actf;
- if (bp == NULL)
- return;
- dp->b_actf = bp->b_actf;
+ struct buf *bp;
+ while ((bp = bufq_dequeue(&sc->sc_bufq)) != NULL) {
/* Transfer this buffer now. */
_flashstart(sc, bp);
}
diff --git a/sys/dev/flashvar.h b/sys/dev/flashvar.h
index 0541cbefb03..5ebf27bd992 100644
--- a/sys/dev/flashvar.h
+++ b/sys/dev/flashvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: flashvar.h,v 1.6 2013/05/30 16:15:01 deraadt Exp $ */
+/* $OpenBSD: flashvar.h,v 1.7 2013/11/11 03:03:34 dlg Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -77,7 +77,7 @@ struct flash_softc {
struct device sc_dev;
/* Disk device information */
struct disk sc_dk;
- struct buf sc_q;
+ struct bufq sc_bufq;
struct buf *sc_bp;
int sc_flags;
/* Flash controller tag */