summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-04-01 15:06:26 +0000
committerphk <phk@FreeBSD.org>2003-04-01 15:06:26 +0000
commitc235e25328c6cf4b9091f38d9c18db15764df594 (patch)
treef08dda1f60d395e9bc94bf2fd1921768bf958c6d /sys/cam/scsi
parent98acc8a3d79206dbf51e83ae8573fa89e54645b6 (diff)
downloadFreeBSD-src-c235e25328c6cf4b9091f38d9c18db15764df594.zip
FreeBSD-src-c235e25328c6cf4b9091f38d9c18db15764df594.tar.gz
Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now. Spell bioq_disksort() consistently with the remaining bioq_*(). #include <geom/geom_disk.h> where this is more appropriate.
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r--sys/cam/scsi/scsi_cd.c16
-rw-r--r--sys/cam/scsi/scsi_da.c20
-rw-r--r--sys/cam/scsi/scsi_pt.c16
-rw-r--r--sys/cam/scsi/scsi_sa.c14
4 files changed, 12 insertions, 54 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 66b18f0..2fe1e16 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -394,7 +394,6 @@ cdoninvalidate(struct cam_periph *periph)
{
int s;
struct cd_softc *softc;
- struct bio *q_bp;
struct ccb_setasync csa;
softc = (struct cd_softc *)periph->softc;
@@ -424,11 +423,7 @@ cdoninvalidate(struct cam_periph *periph)
* XXX Handle any transactions queued to the card
* with XPT_ABORT_CCB.
*/
- while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, ENXIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, ENXIO);
splx(s);
/*
@@ -1464,7 +1459,7 @@ cdstrategy(struct bio *bp)
/*
* Place it in the queue of disk activities for this disk
*/
- bioqdisksort(&softc->bio_queue, bp);
+ bioq_disksort(&softc->bio_queue, bp);
splx(s);
@@ -1630,16 +1625,11 @@ cddone(struct cam_periph *periph, union ccb *done_ccb)
if (error != 0) {
int s;
- struct bio *q_bp;
xpt_print_path(periph->path);
printf("cddone: got error %#x back\n", error);
s = splbio();
- while ((q_bp = bioq_first(&softc->bio_queue)) != NULL) {
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, EIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, EIO);
splx(s);
bp->bio_resid = bp->bio_bcount;
bp->bio_error = error;
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index bdb8276..05402b3 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -43,7 +43,6 @@
#include <sys/devicestat.h>
#include <sys/conf.h>
-#include <sys/disk.h>
#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/cons.h>
@@ -53,6 +52,8 @@
#include <vm/vm.h>
#include <vm/pmap.h>
+#include <geom/geom_disk.h>
+
#ifndef _KERNEL
#include <stdio.h>
#include <string.h>
@@ -750,7 +751,7 @@ dastrategy(struct bio *bp)
/*
* Place it in the queue of disk activities for this disk
*/
- bioqdisksort(&softc->bio_queue, bp);
+ bioq_disksort(&softc->bio_queue, bp);
splx(s);
@@ -935,7 +936,6 @@ daoninvalidate(struct cam_periph *periph)
{
int s;
struct da_softc *softc;
- struct bio *q_bp;
struct ccb_setasync csa;
softc = (struct da_softc *)periph->softc;
@@ -965,11 +965,7 @@ daoninvalidate(struct cam_periph *periph)
* XXX Handle any transactions queued to the card
* with XPT_ABORT_CCB.
*/
- while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, ENXIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, ENXIO);
splx(s);
SLIST_REMOVE(&softc_list, softc, da_softc, links);
@@ -1438,7 +1434,6 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
return;
}
if (error != 0) {
- struct bio *q_bp;
s = splbio();
@@ -1460,12 +1455,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
* the client can retry these I/Os in the
* proper order should it attempt to recover.
*/
- while ((q_bp = bioq_first(&softc->bio_queue))
- != NULL) {
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, EIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, EIO);
splx(s);
bp->bio_error = error;
bp->bio_resid = bp->bio_bcount;
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index 280093a..63bb15a 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -353,7 +353,6 @@ ptoninvalidate(struct cam_periph *periph)
{
int s;
struct pt_softc *softc;
- struct bio *q_bp;
struct ccb_setasync csa;
softc = (struct pt_softc *)periph->softc;
@@ -383,11 +382,7 @@ ptoninvalidate(struct cam_periph *periph)
* XXX Handle any transactions queued to the card
* with XPT_ABORT_CCB.
*/
- while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, ENXIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, ENXIO);
splx(s);
@@ -574,8 +569,6 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb)
return;
}
if (error != 0) {
- struct bio *q_bp;
-
s = splbio();
if (error == ENXIO) {
@@ -593,12 +586,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb)
* the client can retry these I/Os in the
* proper order should it attempt to recover.
*/
- while ((q_bp = bioq_first(&softc->bio_queue))
- != NULL) {
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, EIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, EIO);
splx(s);
bp->bio_error = error;
bp->bio_resid = bp->bio_bcount;
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index acf5acf..e81b110 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -1281,7 +1281,6 @@ static void
saoninvalidate(struct cam_periph *periph)
{
struct sa_softc *softc;
- struct bio *q_bp;
struct ccb_setasync csa;
int s;
@@ -1312,11 +1311,7 @@ saoninvalidate(struct cam_periph *periph)
* XXX Handle any transactions queued to the card
* with XPT_ABORT_CCB.
*/
- while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, ENXIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, ENXIO);
softc->queue_count = 0;
splx(s);
@@ -1698,7 +1693,6 @@ sadone(struct cam_periph *periph, union ccb *done_ccb)
if (error == EIO) {
int s;
- struct bio *q_bp;
/*
* Catastrophic error. Mark the tape as frozen
@@ -1713,11 +1707,7 @@ sadone(struct cam_periph *periph, union ccb *done_ccb)
s = splbio();
softc->flags |= SA_FLAG_TAPE_FROZEN;
- while ((q_bp = bioq_first(&softc->bio_queue)) != NULL) {
- bioq_remove(&softc->bio_queue, q_bp);
- q_bp->bio_resid = q_bp->bio_bcount;
- biofinish(q_bp, NULL, EIO);
- }
+ bioq_flush(&softc->bio_queue, NULL, EIO);
splx(s);
}
if (error != 0) {
OpenPOWER on IntegriCloud