summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2009-06-17 01:30:33 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2009-06-17 01:30:33 +0000
commit3ee68d23a3466d2029ffb173fb427cbe52bf1c22 (patch)
tree9836d4f2fe25decc84e3ffcba4a9c31e9b946d7c /sys/scsi/sd.c
parentc51365090d32d88879756762d7720c7761a80060 (diff)
Revert bufq's. this is inline with the major midlayer reverts that
have been going on. this appears to bring us back to stable state. lots of testing by oga and ariane and my self.
Diffstat (limited to 'sys/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 27e9ee7e65e..8f9d44c4e6d 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.155 2009/06/03 22:09:30 thib Exp $ */
+/* $OpenBSD: sd.c,v 1.156 2009/06/17 01:30:30 thib Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -90,6 +90,7 @@ int sd_reassign_blocks(struct sd_softc *, u_long);
int sd_interpret_sense(struct scsi_xfer *);
int sd_get_parms(struct sd_softc *, struct disk_parms *, int);
void sd_flush(struct sd_softc *, int);
+void sd_kill_buffers(struct sd_softc *);
void viscpy(u_char *, u_char *, int);
@@ -267,7 +268,7 @@ sdactivate(struct device *self, enum devact act)
case DVACT_DEACTIVATE:
sd->flags |= SDF_DYING;
- bufq_drain(sd->sc_dk.dk_bufq);
+ sd_kill_buffers(sd);
break;
}
@@ -281,7 +282,7 @@ sddetach(struct device *self, int flags)
struct sd_softc *sd = (struct sd_softc *)self;
int bmaj, cmaj, mn;
- bufq_drain(sd->sc_dk.dk_bufq);
+ sd_kill_buffers(sd);
/* Locate the lowest minor number to be detached. */
mn = DISKMINOR(self->dv_unit, 0);
@@ -549,8 +550,10 @@ sdstrategy(struct buf *bp)
s = splbio();
- /* Place it in the queue of disk activities for this disk */
- BUFQ_ADD(sd->sc_dk.dk_bufq, bp);
+ /*
+ * Place it in the queue of disk activities for this disk
+ */
+ disksort(&sd->buf_queue, bp);
/*
* Tell the device to get going on the transfer if it's
@@ -599,6 +602,7 @@ sdstart(void *v)
struct sd_softc *sd = (struct sd_softc *)v;
struct scsi_link *sc_link = sd->sc_link;
struct buf *bp = 0;
+ struct buf *dp;
struct scsi_rw_big cmd_big;
struct scsi_rw_12 cmd_12;
struct scsi_rw_16 cmd_16;
@@ -633,8 +637,10 @@ sdstart(void *v)
/*
* See if there is a buf with work for us to do..
*/
- if ((bp = BUFQ_GET(sd->sc_dk.dk_bufq)) == NULL)
+ dp = &sd->buf_queue;
+ if ((bp = dp->b_actf) == NULL) /* yes, an assign */
return;
+ dp->b_actf = bp->b_actf;
/*
* If the device has become invalid, abort all the
@@ -741,7 +747,7 @@ sdstart(void *v)
/*
* The device can't start another i/o. Try again later.
*/
- BUFQ_ADD(sd->sc_dk.dk_bufq, bp);
+ dp->b_actf = bp;
disk_unbusy(&sd->sc_dk, 0, 0);
timeout_add(&sd->sc_timeout, 1);
return;
@@ -1489,3 +1495,23 @@ sd_flush(struct sd_softc *sd, int flags)
} else
sd->flags &= ~SDF_DIRTY;
}
+
+/*
+ * Remove unprocessed buffers from queue.
+ */
+void
+sd_kill_buffers(struct sd_softc *sd)
+{
+ struct buf *dp, *bp;
+ int s;
+
+ s = splbio();
+ for (dp = &sd->buf_queue; (bp = dp->b_actf) != NULL; ) {
+ dp->b_actf = bp->b_actf;
+
+ bp->b_error = ENXIO;
+ bp->b_flags |= B_ERROR;
+ biodone(bp);
+ }
+ splx(s);
+}