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 | |
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.
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_pt.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_sa.c | 11 | ||||
-rw-r--r-- | sys/contrib/dev/fla/fla.c | 3 | ||||
-rw-r--r-- | sys/dev/amr/amr_disk.c | 3 | ||||
-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 | ||||
-rw-r--r-- | sys/dev/ccd/ccd.c | 3 | ||||
-rw-r--r-- | sys/dev/fdc/fdc.c | 6 | ||||
-rw-r--r-- | sys/dev/ida/ida_disk.c | 3 | ||||
-rw-r--r-- | sys/dev/md/md.c | 9 | ||||
-rw-r--r-- | sys/dev/mlx/mlx_disk.c | 3 | ||||
-rw-r--r-- | sys/geom/geom_ccd.c | 3 | ||||
-rw-r--r-- | sys/ia64/ia64/sscdisk.c | 3 | ||||
-rw-r--r-- | sys/isa/fd.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_disk.c | 4 | ||||
-rw-r--r-- | sys/pc98/cbus/fdc.c | 6 | ||||
-rw-r--r-- | sys/pc98/pc98/fd.c | 6 | ||||
-rw-r--r-- | sys/pc98/pc98/wd.c | 3 | ||||
-rw-r--r-- | sys/pc98/pc98/wd_cd.c | 15 | ||||
-rw-r--r-- | sys/pc98/pc98/wfd.c | 3 | ||||
-rw-r--r-- | sys/pc98/pc98/wst.c | 4 | ||||
-rw-r--r-- | sys/sys/bio.h | 18 | ||||
-rw-r--r-- | sys/sys/devicestat.h | 2 | ||||
-rw-r--r-- | sys/vm/swap_pager.c | 4 |
29 files changed, 75 insertions, 154 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 4768ff1..278dfc2 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -387,9 +387,7 @@ cdoninvalidate(struct cam_periph *periph) while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ bioq_remove(&softc->bio_queue, q_bp); q_bp->bio_resid = q_bp->bio_bcount; - q_bp->bio_error = ENXIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, ENXIO); } splx(s); @@ -1577,9 +1575,7 @@ cddone(struct cam_periph *periph, union ccb *done_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; - q_bp->bio_error = EIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, EIO); } splx(s); bp->bio_resid = bp->bio_bcount; @@ -1611,8 +1607,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) if (softc->flags & CD_FLAG_CHANGER) cdchangerschedule(softc); - devstat_end_transaction_bio(&softc->device_stats, bp); - biodone(bp); + biofinish(bp, &softc->device_stats, 0); break; } case CD_CCB_PROBE: diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 772e5bc..10c22f8 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -862,9 +862,7 @@ daoninvalidate(struct cam_periph *periph) while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ bioq_remove(&softc->bio_queue, q_bp); q_bp->bio_resid = q_bp->bio_bcount; - q_bp->bio_error = ENXIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, ENXIO); } splx(s); @@ -1244,9 +1242,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) != NULL) { bioq_remove(&softc->bio_queue, q_bp); q_bp->bio_resid = q_bp->bio_bcount; - q_bp->bio_error = EIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, EIO); } splx(s); bp->bio_error = error; @@ -1285,8 +1281,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) if (softc->device_stats.busy_count == 0) softc->flags |= DA_FLAG_WENT_IDLE; - devstat_end_transaction_bio(&softc->device_stats, bp); - biodone(bp); + biofinish(bp, &softc->device_stats, 0); break; } case DA_CCB_PROBE: diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 3137b4a..dff8c60 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -414,9 +414,7 @@ ptoninvalidate(struct cam_periph *periph) while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ bioq_remove(&softc->bio_queue, q_bp); q_bp->bio_resid = q_bp->bio_bcount; - q_bp->bio_error = ENXIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, ENXIO); } splx(s); @@ -626,9 +624,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) != NULL) { bioq_remove(&softc->bio_queue, q_bp); q_bp->bio_resid = q_bp->bio_bcount; - q_bp->bio_error = EIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, EIO); } splx(s); bp->bio_error = error; @@ -662,8 +658,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); splx(oldspl); - devstat_end_transaction_bio(&softc->device_stats, bp); - biodone(bp); + biofinish(bp, &softc->device_stats, 0); break; } case PT_CCB_WAITING: diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 318534e..de3c7c1 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1323,9 +1323,7 @@ saoninvalidate(struct cam_periph *periph) while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ bioq_remove(&softc->bio_queue, q_bp); q_bp->bio_resid = q_bp->bio_bcount; - q_bp->bio_error = ENXIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, ENXIO); } softc->queue_count = 0; splx(s); @@ -1708,9 +1706,7 @@ sadone(struct cam_periph *periph, union ccb *done_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; - q_bp->bio_error = EIO; - q_bp->bio_flags |= BIO_ERROR; - biodone(q_bp); + biofinish(q_bp, NULL, EIO); } splx(s); } @@ -1761,8 +1757,7 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) bp->bio_resid, bp->bio_bcount)); } #endif - devstat_end_transaction_bio(&softc->device_stats, bp); - biodone(bp); + biofinish(bp, &softc->device_stats, 0); break; } case SA_CCB_WAITING: diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c index 54a98b9..6f758de 100644 --- a/sys/contrib/dev/fla/fla.c +++ b/sys/contrib/dev/fla/fla.c @@ -235,8 +235,7 @@ flastrategy(struct bio *bp) } else { bp->bio_resid = 0; } - devstat_end_transaction_bio(&sc->stats, bp); - biodone(bp); + biofinish(bp, &sc->stats, 0); s = splbio(); } diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index bd9c729..f846043 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -200,8 +200,7 @@ amrd_intr(void *data) bio->bio_resid = 0; } - devstat_end_transaction_bio(&sc->amrd_stats, bio); - biodone(bio); + biofinish(bio, &sc->amrd_stats, 0); } static int 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; } diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 6494861..4addc2e 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -1116,8 +1116,7 @@ ccdintr(cs, bp) */ if (bp->bio_flags & BIO_ERROR) bp->bio_resid = bp->bio_bcount; - devstat_end_transaction_bio(&cs->device_stats, bp); - biodone(bp); + biofinish(bp, &cs->device_stats, 0); } /* diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 285aed8..29939cc 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -2082,8 +2082,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fd->device_stats, 0); fdc->fd = (fd_p) 0; fdc->fdu = -1; fdc->state = FINDWORK; @@ -2246,8 +2245,7 @@ retrier(struct fdc_data *fdc) fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fdc->fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fdc->fd->device_stats, 0); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; fdc->fd = (fd_p) 0; diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c index 0aaeadc..99251ef 100644 --- a/sys/dev/ida/ida_disk.c +++ b/sys/dev/ida/ida_disk.c @@ -252,8 +252,7 @@ idad_intr(struct bio *bp) else bp->bio_resid = 0; - devstat_end_transaction_bio(&drv->stats, bp); - biodone(bp); + biofinish(bp, &drv->stats, 0); } static int diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 0d882c1..87576e7 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -304,8 +304,7 @@ mdstart_malloc(struct md_s *sc) dst += sc->secsize; } bp->bio_resid = 0; - devstat_end_transaction_bio(&sc->stats, bp); - biodone(bp); + biofinish(bp, &sc->stats, 0); } return; } @@ -338,8 +337,7 @@ mdstart_preload(struct md_s *sc) bcopy(bp->bio_data, sc->pl_ptr + (bp->bio_pblkno << DEV_BSHIFT), bp->bio_bcount); } bp->bio_resid = 0; - devstat_end_transaction_bio(&sc->stats, bp); - biodone(bp); + biofinish(bp, &sc->stats, 0); } return; } @@ -404,8 +402,7 @@ mdstart_vnode(struct md_s *sc) bp->bio_error = error; bp->bio_flags |= BIO_ERROR; } - devstat_end_transaction_bio(&sc->stats, bp); - biodone(bp); + biofinish(bp, &sc->stats, 0); } return; } diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index 365ac45..18698c2 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -212,8 +212,7 @@ mlxd_intr(void *data) else bp->bio_resid = 0; - devstat_end_transaction_bio(&sc->mlxd_stats, bp); - biodone(bp); + biofinish(bp, &sc->mlxd_stats, 0); } static int diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 6494861..4addc2e 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1116,8 +1116,7 @@ ccdintr(cs, bp) */ if (bp->bio_flags & BIO_ERROR) bp->bio_resid = bp->bio_bcount; - devstat_end_transaction_bio(&cs->device_stats, bp); - biodone(bp); + biofinish(bp, &cs->device_stats, 0); } /* diff --git a/sys/ia64/ia64/sscdisk.c b/sys/ia64/ia64/sscdisk.c index 4a9cff0..e58f412 100644 --- a/sys/ia64/ia64/sscdisk.c +++ b/sys/ia64/ia64/sscdisk.c @@ -224,8 +224,7 @@ sscstrategy(struct bio *bp) off += t; } bp->bio_resid = 0; - devstat_end_transaction_bio(&sc->stats, bp); - biodone(bp); + biofinish(bp, &sc->stats, 0); s = splbio(); } diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 285aed8..29939cc 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -2082,8 +2082,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fd->device_stats, 0); fdc->fd = (fd_p) 0; fdc->fdu = -1; fdc->state = FINDWORK; @@ -2246,8 +2245,7 @@ retrier(struct fdc_data *fdc) fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fdc->fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fdc->fd->device_stats, 0); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; fdc->fd = (fd_p) 0; diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 762658f..b4932cb 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -300,9 +300,7 @@ diskstrategy(struct bio *bp) inherit_raw(pdev, bp->bio_dev); if (!dp) { - bp->bio_error = ENXIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, ENXIO); return; } diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index 74db224..a7df8b3 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -2514,8 +2514,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fd->device_stats, 0); fdc->fd = (fd_p) 0; fdc->fdu = -1; fdc->state = FINDWORK; @@ -2687,8 +2686,7 @@ retrier(struct fdc_data *fdc) fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fdc->fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fdc->fd->device_stats, 0); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; fdc->fd = (fd_p) 0; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index 74db224..a7df8b3 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -2514,8 +2514,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fd->device_stats, 0); fdc->fd = (fd_p) 0; fdc->fdu = -1; fdc->state = FINDWORK; @@ -2687,8 +2686,7 @@ retrier(struct fdc_data *fdc) fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_bio(&fdc->fd->device_stats, bp); - biodone(bp); + biofinish(bp, &fdc->fd->device_stats, 0); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; fdc->fd = (fd_p) 0; diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index a527233..5779d39 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -1210,8 +1210,7 @@ done: ; bp->bio_resid = bp->bio_bcount - du->dk_skip * DEV_BSIZE; wdutab[du->dk_lunit].b_active = 0; du->dk_skip = 0; - devstat_end_transaction_bio(&du->dk_stats, bp); - biodone(bp); + biofinish(bp, &du->dk_stats, 0); } /* controller idle */ diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index 0de3104..98146f6 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -437,9 +437,7 @@ acdstrategy(struct bio *bp) #ifdef NOTYET /* allow write only on CD-R/RW media */ /* all for now SOS */ if ((bp->bio_cmd == BIO_WRITE) && !(writeable_media)) { - bp->bio_error = EROFS; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EROFS); return; } #endif @@ -474,9 +472,7 @@ acd_start(struct acd *cdp) /* Should reject all queued entries if media have changed. */ if (cdp->flags & F_MEDIA_CHANGED) { - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EIO); return; } @@ -486,9 +482,7 @@ acd_start(struct acd *cdp) if ((cdp->flags & F_TRACK_PREPED) == 0) { if ((cdp->flags & F_TRACK_PREP) == 0) { printf("wcd%d: sequence error\n", cdp->lun); - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EIO); return; } else { if (acd_open_track(cdp, &cdp->preptrack) != 0) { @@ -540,8 +534,7 @@ acd_done(struct acd *cdp, struct bio *bp, int resid, struct atapires result) if (bp->bio_cmd == BIO_WRITE) cdp->flags |= F_WRITTEN; } - devstat_end_transaction_bio(cdp->device_stats, bp); - biodone(bp); + biofinish(bp, cdp->device_stats, 0); acd_start(cdp); } diff --git a/sys/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c index 42abf43..fd6d66c 100644 --- a/sys/pc98/pc98/wfd.c +++ b/sys/pc98/pc98/wfd.c @@ -542,8 +542,7 @@ static void wfd_done (struct wfd *t, struct bio *bp, int resid, */ if (((int)bp->bio_driver1)-- <= 0) { bp->bio_resid = (int)bp->bio_driver2; - devstat_end_transaction_bio(&t->device_stats, bp); - biodone (bp); + biofinish(bp, &t->device_stats, 0); } wfd_start (t); diff --git a/sys/pc98/pc98/wst.c b/sys/pc98/pc98/wst.c index 4b9b1b3..0f2c942 100644 --- a/sys/pc98/pc98/wst.c +++ b/sys/pc98/pc98/wst.c @@ -395,9 +395,7 @@ wststrategy(struct bio *bp) /* Check for != blocksize requests */ if (bp->bio_bcount % t->blksize) { printf("wst%d: bad request, must be multiple of %d\n", lun, t->blksize); - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EIO); return; } diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 4e01e1e..1af16d8 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -103,13 +103,21 @@ biodone(struct bio *bp) bp->bio_done(bp); } +#ifndef _DEVICESTAT_H +struct devstat; +void devstat_end_transaction_bio(struct devstat *, struct bio *); +#endif + static __inline__ void -bioerror(struct bio *bp, int error, int complete) +biofinish(struct bio *bp, struct devstat *stat, int error) { - if (complete) - bp->bio_resid = bp->bio_bcount; - bp->bio_error = error; - bp->bio_flags |= BIO_ERROR; + + if (error) { + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; + } + if (stat != NULL) + devstat_end_transaction_bio(stat, bp); biodone(bp); } diff --git a/sys/sys/devicestat.h b/sys/sys/devicestat.h index 7e617c6..b3e7f7f 100644 --- a/sys/sys/devicestat.h +++ b/sys/sys/devicestat.h @@ -218,7 +218,9 @@ void devstat_start_transaction(struct devstat *ds); void devstat_end_transaction(struct devstat *ds, u_int32_t bytes, devstat_tag_type tag_type, devstat_trans_flags flags); +#ifndef _SYS_BIO_H_ void devstat_end_transaction_bio(struct devstat *ds, struct bio *bp); #endif +#endif #endif /* _DEVICESTAT_H */ diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index aa2cb52..8d343f4 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -853,9 +853,7 @@ swap_pager_strategy(vm_object_t object, struct bio *bp) /* XXX: KASSERT instead ? */ if (bp->bio_bcount & PAGE_MASK) { - bp->bio_error = EINVAL; - bp->bio_flags |= BIO_ERROR; - biodone(bp); + biofinish(bp, NULL, EINVAL); printf("swap_pager_strategy: bp %p blk %d size %d, not page bounded\n", bp, (int)bp->bio_pblkno, (int)bp->bio_bcount); return; } |