On 10/31/2013 2:33 AM, David Gwynne wrote:
jmatthew@ tells me this compiles, but we dont have hardware to test
with.
tests? oks? go for its?
I'll run a test on my CAM-0100 later today.
cheers,
dlg
Index: octcf.c
===================================================================
RCS file: /cvs/src/sys/arch/octeon/dev/octcf.c,v
retrieving revision 1.12
diff -u -p -r1.12 octcf.c
--- octcf.c 11 Jun 2013 16:42:10 -0000 1.12
+++ octcf.c 31 Oct 2013 06:32:11 -0000
@@ -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, struc
* 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);
}