diff options
author | phk <phk@FreeBSD.org> | 2001-05-06 20:00:03 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-05-06 20:00:03 +0000 |
commit | 16caeec9b02aa3b15073b68736e4e950266ffd81 (patch) | |
tree | 530c90a78ebb64a793fe1f7688a50c3a46c4eba9 /sys/dev/ata | |
parent | 33cb778d44db479f7586e1b5c1f9b400db720f22 (diff) | |
download | FreeBSD-src-16caeec9b02aa3b15073b68736e4e950266ffd81.zip FreeBSD-src-16caeec9b02aa3b15073b68736e4e950266ffd81.tar.gz |
Actually biofinish(struct bio *, struct devstat *, int error) is more general
than the bioerror().
Most of this patch is generated by scripts.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-disk.c | 21 | ||||
-rw-r--r-- | sys/dev/ata/atapi-all.c | 4 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 19 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 15 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.c | 19 |
5 files changed, 21 insertions, 57 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index ec720cb..6d44958 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -228,15 +228,11 @@ ad_detach(struct ad_softc *adp, int flush) if (request->device != adp) continue; TAILQ_REMOVE(&adp->controller->ata_queue, request, chain); - request->bp->bio_error = ENXIO; - request->bp->bio_flags |= BIO_ERROR; - biodone(request->bp); + biofinish(request->bp, NULL, ENXIO); ad_free(request); } while ((bp = bioq_first(&adp->queue))) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); } disk_invalidate(&adp->disk); disk_destroy(adp->dev); @@ -269,9 +265,7 @@ adstrategy(struct bio *bp) int s; if (adp->flags & AD_F_DETACHING) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); return; } @@ -580,8 +574,7 @@ transfer_failed: request->bp->bio_error = EIO; request->bp->bio_flags |= BIO_ERROR; request->bp->bio_resid = request->bytecount; - devstat_end_transaction_bio(&adp->stats, request->bp); - biodone(request->bp); + biofinish(request->bp, &adp->stats, 0); ad_free(request); } ata_reinit(adp->controller); @@ -714,8 +707,7 @@ ad_interrupt(struct ad_request *request) } #endif finish: - devstat_end_transaction_bio(&adp->stats, request->bp); - biodone(request->bp); + biofinish(request->bp, &adp->stats, 0); ad_free(request); adp->outstanding--; @@ -905,8 +897,7 @@ ad_timeout(struct ad_request *request) /* retries all used up, return error */ request->bp->bio_error = EIO; request->bp->bio_flags |= BIO_ERROR; - devstat_end_transaction_bio(&adp->stats, request->bp); - biodone(request->bp); + biofinish(request->bp, &adp->stats, 0); ad_free(request); } ata_reinit(adp->controller); diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index 24f4ea2..5ebc611 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -159,9 +159,7 @@ atapi_detach(struct atapi_softc *atp) TAILQ_REMOVE(&atp->controller->atapi_queue, request, chain); if (request->driver) { struct bio *bp = (struct bio *) request->driver; - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); } if (request->dmatab) free(request->dmatab, M_DEVBUF); diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 8af513f..4e79c74 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -200,9 +200,7 @@ acddetach(struct atapi_softc *atp) if (cdp->driver[subdev] == cdp) continue; while ((bp = bioq_first(&cdp->driver[subdev]->queue))) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); } destroy_dev(cdp->driver[subdev]->dev1); destroy_dev(cdp->driver[subdev]->dev2); @@ -220,9 +218,7 @@ acddetach(struct atapi_softc *atp) free(cdp->changer_info, M_ACD); } while ((bp = bioq_first(&cdp->queue))) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); } destroy_dev(cdp->dev1); destroy_dev(cdp->dev2); @@ -1061,9 +1057,7 @@ acdstrategy(struct bio *bp) int s; if (cdp->atp->flags & ATAPI_F_DETACHING) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); return; } @@ -1116,9 +1110,7 @@ acd_start(struct atapi_softc *atp) /* reject all queued entries if media changed */ if (cdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EIO); return; } @@ -1194,8 +1186,7 @@ acd_done(struct atapi_request *request) } else bp->bio_resid = bp->bio_bcount - request->donecount; - devstat_end_transaction_bio(cdp->stats, bp); - biodone(bp); + biofinish(bp, cdp->stats, 0); return 0; } diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 6905a29..a831ff4 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -127,9 +127,7 @@ afddetach(struct atapi_softc *atp) struct bio *bp; while ((bp = bioq_first(&fdp->queue))) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); } disk_invalidate(&fdp->disk); disk_destroy(fdp->dev); @@ -305,9 +303,7 @@ afdstrategy(struct bio *bp) int s; if (fdp->atp->flags & ATAPI_F_DETACHING) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); return; } @@ -341,9 +337,7 @@ afd_start(struct atapi_softc *atp) /* should reject all queued entries if media have changed. */ if (fdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EIO); return; } @@ -416,8 +410,7 @@ afd_done(struct atapi_request *request) } else bp->bio_resid += (bp->bio_bcount - request->donecount); - devstat_end_transaction_bio(&fdp->stats, bp); - biodone(bp); + biofinish(bp, &fdp->stats, 0); return 0; } diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index a5f3f42..fb02a1f 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -159,9 +159,7 @@ astdetach(struct atapi_softc *atp) struct bio *bp; while ((bp = bioq_first(&stp->queue))) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); } destroy_dev(stp->dev1); destroy_dev(stp->dev2); @@ -430,9 +428,7 @@ aststrategy(struct bio *bp) int s; if (stp->atp->flags & ATAPI_F_DETACHING) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); return; } @@ -443,9 +439,7 @@ aststrategy(struct bio *bp) return; } if (!(bp->bio_cmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { - bp->bio_error = EPERM; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EPERM); return; } @@ -453,9 +447,7 @@ aststrategy(struct bio *bp) if (bp->bio_bcount % stp->blksize) { ata_printf(stp->atp->controller, stp->atp->unit, "bad request, must be multiple of %d\n", stp->blksize); - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EIO); return; } @@ -524,8 +516,7 @@ ast_done(struct atapi_request *request) bp->bio_resid = bp->bio_bcount - request->donecount; ast_total += (bp->bio_bcount - bp->bio_resid); } - devstat_end_transaction_bio(&stp->stats, bp); - biodone(bp); + biofinish(bp, &stp->stats, 0); return 0; } |