diff options
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 16 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 17 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_pt.c | 17 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_sa.c | 40 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_target.c | 24 |
5 files changed, 39 insertions, 75 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 278dfc2..6c12ed2 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -1366,8 +1366,8 @@ cdstrategy(struct bio *bp) part = dkpart(bp->bio_dev); periph = cam_extend_get(cdperiphs, unit); if (periph == NULL) { - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstrategy\n")); @@ -1386,8 +1386,8 @@ cdstrategy(struct bio *bp) */ if ((softc->flags & CD_FLAG_INVALID)) { splx(s); - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } /* @@ -1407,14 +1407,6 @@ cdstrategy(struct bio *bp) cdschedule(periph, /* priority */ 1); return; -bad: - bp->bio_flags |= BIO_ERROR; - /* - * Correctly set the buf to indicate a completed xfer - */ - bp->bio_resid = bp->bio_bcount; - biodone(bp); - return; } static void diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 10c22f8..c1c9e30 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -555,8 +555,8 @@ dastrategy(struct bio *bp) part = dkpart(bp->bio_dev); periph = cam_extend_get(daperiphs, unit); if (periph == NULL) { - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } softc = (struct da_softc *)periph->softc; #if 0 @@ -578,8 +578,8 @@ dastrategy(struct bio *bp) */ if ((softc->flags & DA_FLAG_PACK_INVALID)) { splx(s); - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } /* @@ -595,15 +595,6 @@ dastrategy(struct bio *bp) xpt_schedule(periph, /* XXX priority */1); return; -bad: - bp->bio_flags |= BIO_ERROR; - - /* - * Correctly set the buf to indicate a completed xfer - */ - bp->bio_resid = bp->bio_bcount; - biodone(bp); - return; } /* For 2.2-stable support */ diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index dff8c60..a1fe607 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -223,9 +223,10 @@ ptstrategy(struct bio *bp) unit = minor(bp->bio_dev); periph = cam_extend_get(ptperiphs, unit); + bp->bio_resid = bp->bio_bcount; if (periph == NULL) { - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } softc = (struct pt_softc *)periph->softc; @@ -241,8 +242,8 @@ ptstrategy(struct bio *bp) */ if ((softc->flags & PT_FLAG_DEVICE_INVALID)) { splx(s); - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } /* @@ -258,14 +259,6 @@ ptstrategy(struct bio *bp) xpt_schedule(periph, /* XXX priority */1); return; -bad: - bp->bio_flags |= BIO_ERROR; - - /* - * Correctly set the buf to indicate a completed xfer - */ - bp->bio_resid = bp->bio_bcount; - biodone(bp); } static void diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index de3c7c1..db9a7a8 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -652,15 +652,16 @@ sastrategy(struct bio *bp) u_int unit; int s; + bp->bio_resid = bp->bio_bcount; if (SA_IS_CTRL(bp->bio_dev)) { - bp->bio_error = EINVAL; - goto bad; + biofinish(bp, NULL, EINVAL); + return; } unit = SAUNIT(bp->bio_dev); periph = cam_extend_get(saperiphs, unit); if (periph == NULL) { - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } softc = (struct sa_softc *)periph->softc; @@ -668,14 +669,14 @@ sastrategy(struct bio *bp) if (softc->flags & SA_FLAG_INVALID) { splx(s); - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } if (softc->flags & SA_FLAG_TAPE_FROZEN) { splx(s); - bp->bio_error = EPERM; - goto bad; + biofinish(bp, NULL, EPERM); + return; } splx(s); @@ -683,8 +684,10 @@ sastrategy(struct bio *bp) /* * If it's a null transfer, return immediatly */ - if (bp->bio_bcount == 0) - goto done; + if (bp->bio_bcount == 0) { + biodone(bp); + return; + } /* valid request? */ if (softc->flags & SA_FLAG_FIXED) { @@ -700,8 +703,8 @@ sastrategy(struct bio *bp) printf("Invalid request. Fixed block device " "requests must be a multiple " "of %d bytes\n", softc->min_blk); - bp->bio_error = EINVAL; - goto bad; + biofinish(bp, NULL, EINVAL); + return; } } else if ((bp->bio_bcount > softc->max_blk) || (bp->bio_bcount < softc->min_blk) || @@ -715,8 +718,8 @@ sastrategy(struct bio *bp) } printf("between %d and %d bytes\n", softc->min_blk, softc->max_blk); - bp->bio_error = EINVAL; - goto bad; + biofinish(bp, NULL, EINVAL); + return; } /* @@ -745,15 +748,6 @@ sastrategy(struct bio *bp) xpt_schedule(periph, 1); return; -bad: - bp->bio_flags |= BIO_ERROR; -done: - - /* - * Correctly set the buf to indicate a completed xfer - */ - bp->bio_resid = bp->bio_bcount; - biodone(bp); } static int diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index ee817de..93338ff 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -1155,17 +1155,18 @@ targstrategy(struct bio *bp) int s; unit = minor(bp->bio_dev); + bp->bio_resid = bp->bio_bcount; /* ioctl is the only supported operation of the control device */ if (TARG_IS_CONTROL_DEV(unit)) { - bp->bio_error = EINVAL; - goto bad; + biofinish(bp, NULL, EINVAL); + return; } periph = cam_extend_get(targperiphs, unit); if (periph == NULL) { - bp->bio_error = ENXIO; - goto bad; + biofinish(bp, NULL, ENXIO); + return; } softc = (struct targ_softc *)periph->softc; @@ -1183,10 +1184,11 @@ targstrategy(struct bio *bp) splx(s); if (softc->state == TARG_STATE_EXCEPTION && (softc->exceptions & TARG_EXCEPT_DEVICE_INVALID) == 0) - bp->bio_error = EBUSY; + s = EBUSY; else - bp->bio_error = ENXIO; - goto bad; + s = ENXIO; + biofinish(bp, NULL, s); + return; } /* @@ -1214,14 +1216,6 @@ targstrategy(struct bio *bp) targrunqueue(periph, softc); return; -bad: - bp->bio_flags |= BIO_ERROR; - - /* - * Correctly set the buf to indicate a completed xfer - */ - bp->bio_resid = bp->bio_bcount; - biodone(bp); } static void |