From aaaef0b54e307450b19dcd1fb6ec921cc62d1acf Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 15 Apr 2000 05:54:02 +0000 Subject: Complete the bio/buf divorce for all code below devfs::strategy Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case. CCD not converted yet, casts to struct buf (still safe) atapi-cd casts to struct buf to examine B_PHYS --- sys/dev/amr/amr.c | 36 ++++++------ sys/dev/amr/amr_disk.c | 30 +++++----- sys/dev/amr/amrvar.h | 4 +- sys/dev/ata/ata-disk.c | 38 ++++++------- sys/dev/ata/ata-disk.h | 4 +- sys/dev/ata/atapi-cd.c | 60 ++++++++++---------- sys/dev/ata/atapi-cd.h | 2 +- sys/dev/ata/atapi-fd.c | 54 +++++++++--------- sys/dev/ata/atapi-fd.h | 2 +- sys/dev/ata/atapi-tape.c | 54 +++++++++--------- sys/dev/ata/atapi-tape.h | 2 +- sys/dev/ccd/ccd.c | 11 ++-- sys/dev/fdc/fdc.c | 139 +++++++++++++++++++++++------------------------ sys/dev/ida/ida.c | 24 ++++---- sys/dev/ida/ida_disk.c | 30 +++++----- sys/dev/ida/idavar.h | 8 +-- sys/dev/mcd/mcd.c | 66 +++++++++++----------- sys/dev/md/md.c | 79 ++++++++++++++------------- sys/dev/mlx/mlx.c | 44 +++++++-------- sys/dev/mlx/mlx_disk.c | 26 ++++----- sys/dev/mlx/mlxvar.h | 4 +- sys/dev/scd/scd.c | 64 +++++++++++----------- sys/dev/vn/vn.c | 70 ++++++++++++------------ 23 files changed, 429 insertions(+), 422 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 54ab85a..de6f965 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -337,7 +337,7 @@ amr_attach(struct amr_softc *sc) */ TAILQ_INIT(&sc->amr_work); TAILQ_INIT(&sc->amr_freecmds); - bufq_init(&sc->amr_bufq); + bioq_init(&sc->amr_bioq); /* * Configure for this controller type. @@ -503,7 +503,7 @@ amr_detach(device_t dev) * an operation which may add or delete system disks. (Call amr_startup to * resume normal operation.) * - * Note that we can assume that the bufq on the controller is empty, as we won't + * Note that we can assume that the bioq on the controller is empty, as we won't * allow shutdown if any device is open. */ int @@ -608,14 +608,14 @@ amr_intr(void *arg) * disk resource, then poke the disk resource to start as much work as it can. */ int -amr_submit_buf(struct amr_softc *sc, struct buf *bp) +amr_submit_buf(struct amr_softc *sc, struct bio *bp) { int s; debug("called"); s = splbio(); - bufq_insert_tail(&sc->amr_bufq, bp); + bioq_insert_tail(&sc->amr_bioq, bp); splx(s); sc->amr_waitbufs++; amr_startio(sc); @@ -884,7 +884,7 @@ amr_startio(struct amr_softc *sc) { struct amr_command *ac; struct amrd_softc *amrd; - struct buf *bp; + struct bio *bp; int blkcount; int driveno; int cmd; @@ -899,7 +899,7 @@ amr_startio(struct amr_softc *sc) for (;;) { /* see if there's work to be done */ - if ((bp = bufq_first(&sc->amr_bufq)) == NULL) + if ((bp = bioq_first(&sc->amr_bioq)) == NULL) break; /* get a command */ if ((ac = amr_alloccmd(sc)) == NULL) @@ -910,16 +910,16 @@ amr_startio(struct amr_softc *sc) break; } /* get the buf containing our work */ - bufq_remove(&sc->amr_bufq, bp); + bioq_remove(&sc->amr_bioq, bp); sc->amr_waitbufs--; splx(s); /* connect the buf to the command */ ac->ac_complete = amr_completeio; ac->ac_private = bp; - ac->ac_data = bp->b_data; - ac->ac_length = bp->b_bcount; - if (bp->b_iocmd == BIO_READ) { + ac->ac_data = bp->bio_data; + ac->ac_length = bp->bio_bcount; + if (bp->bio_cmd == BIO_READ) { ac->ac_flags |= AMR_CMD_DATAIN; cmd = AMR_CMD_LREAD; } else { @@ -931,20 +931,20 @@ amr_startio(struct amr_softc *sc) amr_mapcmd(ac); /* build a suitable I/O command (assumes 512-byte rounded transfers) */ - amrd = (struct amrd_softc *)bp->b_dev->si_drv1; + amrd = (struct amrd_softc *)bp->bio_dev->si_drv1; driveno = amrd->amrd_drive - sc->amr_drive; - blkcount = (bp->b_bcount + AMR_BLKSIZE - 1) / AMR_BLKSIZE; + blkcount = (bp->bio_bcount + AMR_BLKSIZE - 1) / AMR_BLKSIZE; - if ((bp->b_pblkno + blkcount) > sc->amr_drive[driveno].al_size) + if ((bp->bio_pblkno + blkcount) > sc->amr_drive[driveno].al_size) device_printf(sc->amr_dev, "I/O beyond end of unit (%u,%d > %u)\n", - bp->b_pblkno, blkcount, sc->amr_drive[driveno].al_size); + bp->bio_pblkno, blkcount, sc->amr_drive[driveno].al_size); /* * Build the I/O command. */ ac->ac_mailbox.mb_command = cmd; ac->ac_mailbox.mb_blkcount = blkcount; - ac->ac_mailbox.mb_lba = bp->b_pblkno; + ac->ac_mailbox.mb_lba = bp->bio_pblkno; ac->ac_mailbox.mb_physaddr = ac->ac_sgphys; ac->ac_mailbox.mb_drive = driveno; ac->ac_mailbox.mb_nsgelem = ac->ac_nsgent; @@ -968,15 +968,15 @@ static void amr_completeio(struct amr_command *ac) { struct amr_softc *sc = ac->ac_sc; - struct buf *bp = (struct buf *)ac->ac_private; + struct bio *bp = (struct bio *)ac->ac_private; int notify, release; notify = 1; release = 1; if (ac->ac_status != AMR_STATUS_SUCCESS) { /* could be more verbose here? */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; switch(ac->ac_status) { /* XXX need more information on I/O error reasons */ diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index 10cf0d6..3fd566b 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -172,29 +172,29 @@ amrd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) * be a multiple of a sector in length. */ static void -amrd_strategy(struct buf *bp) +amrd_strategy(struct bio *bp) { - struct amrd_softc *sc = (struct amrd_softc *)bp->b_dev->si_drv1; + struct amrd_softc *sc = (struct amrd_softc *)bp->bio_dev->si_drv1; debug("called to %s %d bytes at b_blkno 0x%x b_pblkno 0x%x", - (bp->b_flags & B_READ) ? "read" : "write", bp->b_bcount, bp->b_blkno, bp->b_pblkno); + (bp->b_flags & B_READ) ? "read" : "write", bp->bio_bcount, bp->bio_blkno, bp->bio_pblkno); /* bogus disk? */ if (sc == NULL) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } #if 0 /* XXX may only be temporarily offline - sleep? */ if (sc->amrd_drive->ld_state == AMR_SYSD_OFFLINE) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } #endif /* do-nothing operation */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; devstat_start_transaction(&sc->amrd_stats); @@ -202,13 +202,13 @@ amrd_strategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed transfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -216,24 +216,24 @@ amrd_strategy(struct buf *bp) void amrd_intr(void *data) { - struct buf *bp = (struct buf *)data; - struct amrd_softc *sc = (struct amrd_softc *)bp->b_dev->si_drv1; + struct bio *bp = (struct bio *)data; + struct amrd_softc *sc = (struct amrd_softc *)bp->bio_dev->si_drv1; debug("called"); - if (bp->b_ioflags & BIO_ERROR) { - bp->b_error = EIO; + if (bp->bio_flags & BIO_ERROR) { + bp->bio_error = EIO; debug("i/o error\n"); } else { #if 0 int i; for (i = 0; i < 512; i += 16) - debug(" %04x %16D", i, bp->b_data + i, " "); + debug(" %04x %16D", i, bp->bio_data + i, " "); #endif - bp->b_resid = 0; + bp->bio_resid = 0; } - devstat_end_transaction_buf(&sc->amrd_stats, bp); + devstat_end_transaction_bio(&sc->amrd_stats, bp); biodone(bp); } diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index 84777b5..5edfb1f 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -136,7 +136,7 @@ struct amr_softc struct callout_handle amr_timeout; /* periodic status check */ /* per-controller queues */ - struct buf_queue_head amr_bufq; /* pending I/O */ + struct bio_queue_head amr_bioq; /* pending I/O */ int amr_waitbufs; struct amr_command *amr_busycmd[AMR_MAXCMD]; int amr_busycmdcount; @@ -239,7 +239,7 @@ struct amrd_softc /* * Interface between driver core and disk driver (should be using a bus?) */ -extern int amr_submit_buf(struct amr_softc *sc, struct buf *bp); +extern int amr_submit_buf(struct amr_softc *sc, struct bio *bp); extern int amr_submit_ioctl(struct amr_softc *sc, struct amr_logdrive *drive, u_long cmd, caddr_t addr, int32_t flag, struct proc *p); extern void amrd_intr(void *data); diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index b830046..2f0460f 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -202,7 +202,7 @@ ad_attach(struct ata_softc *scp, int32_t device) dev->si_iosize_max = 256 * DEV_BSIZE; adp->dev2 = dev; - bufq_init(&adp->queue); + bioq_init(&adp->queue); } void @@ -234,20 +234,20 @@ adopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p) } static void -adstrategy(struct buf *bp) +adstrategy(struct bio *bp) { - struct ad_softc *adp = bp->b_dev->si_drv1; + struct ad_softc *adp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } s = splbio(); - bufqdisksort(&adp->queue, bp); + bioqdisksort(&adp->queue, bp); ata_start(adp->controller); splx(s); } @@ -319,7 +319,7 @@ addump(dev_t dev) void ad_start(struct ad_softc *adp) { - struct buf *bp = bufq_first(&adp->queue); + struct bio *bp = bioq_first(&adp->queue); struct ad_request *request; if (!bp) @@ -334,13 +334,13 @@ ad_start(struct ad_softc *adp) bzero(request, sizeof(struct ad_request)); request->device = adp; request->bp = bp; - request->blockaddr = bp->b_pblkno; - request->bytecount = bp->b_bcount; - request->data = bp->b_data; - request->flags = (bp->b_iocmd == BIO_READ) ? ADR_F_READ : 0; + request->blockaddr = bp->bio_pblkno; + request->bytecount = bp->bio_bcount; + request->data = bp->bio_data; + request->flags = (bp->bio_cmd == BIO_READ) ? ADR_F_READ : 0; /* remove from drive queue */ - bufq_remove(&adp->queue, bp); + bioq_remove(&adp->queue, bp); /* link onto controller queue */ TAILQ_INSERT_TAIL(&adp->controller->ata_queue, request, chain); @@ -538,8 +538,8 @@ oops: /* finish up transfer */ if (request->flags & ADR_F_ERROR) { - request->bp->b_error = EIO; - request->bp->b_ioflags |= BIO_ERROR; + request->bp->bio_error = EIO; + request->bp->bio_flags |= BIO_ERROR; } else { request->bytecount -= request->currentsize; @@ -550,8 +550,8 @@ oops: } } - request->bp->b_resid = request->bytecount; - devstat_end_transaction_buf(&adp->stats, request->bp); + request->bp->bio_resid = request->bytecount; + devstat_end_transaction_bio(&adp->stats, request->bp); biodone(request->bp); /* disarm timeout for this transfer */ @@ -598,9 +598,9 @@ ad_timeout(struct ad_request *request) TAILQ_INSERT_HEAD(&adp->controller->ata_queue, request, chain); else { /* retries all used up, return error */ - request->bp->b_error = EIO; - request->bp->b_ioflags |= BIO_ERROR; - devstat_end_transaction_buf(&adp->stats, request->bp); + request->bp->bio_error = EIO; + request->bp->bio_flags |= BIO_ERROR; + devstat_end_transaction_bio(&adp->stats, request->bp); biodone(request->bp); free(request, M_AD); } diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h index 91e9fad..4a184d9 100644 --- a/sys/dev/ata/ata-disk.h +++ b/sys/dev/ata/ata-disk.h @@ -44,7 +44,7 @@ struct ad_softc { #define AD_F_32B_ENABLED 0x0004 #define AD_F_TAG_ENABLED 0x0008 - struct buf_queue_head queue; /* head of request queue */ + struct bio_queue_head queue; /* head of request queue */ struct devstat stats; /* devstat entry */ struct disk disk; /* disklabel/slice stuff */ dev_t dev1, dev2; /* device place holder */ @@ -65,7 +65,7 @@ struct ad_request { #define ADR_F_FORCE_PIO 0x0008 int8_t *data; /* pointer to data buf */ - struct buf *bp; /* associated buf ptr */ + struct bio *bp; /* associated bio ptr */ u_int8_t tag; /* tag ID of this request */ TAILQ_ENTRY(ad_request) chain; /* list management */ }; diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 61c1795..15a6a2b 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -231,7 +231,7 @@ acd_init_lun(struct atapi_softc *atp, struct devstat *stats) if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT))) return NULL; bzero(cdp, sizeof(struct acd_softc)); - bufq_init(&cdp->buf_queue); + bioq_init(&cdp->bio_queue); cdp->atp = atp; cdp->lun = ata_get_lun(&acd_lun_map); cdp->flags &= ~(F_WRITTEN|F_DISK_OPEN|F_TRACK_OPEN); @@ -1085,23 +1085,23 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p) } static void -acdstrategy(struct buf *bp) +acdstrategy(struct bio *bp) { - struct acd_softc *cdp = bp->b_dev->si_drv1; + struct acd_softc *cdp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - bp->b_pblkno = bp->b_blkno; - bp->b_resid = bp->b_bcount; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = bp->bio_bcount; s = splbio(); - bufqdisksort(&cdp->buf_queue, bp); + bioqdisksort(&cdp->bio_queue, bp); ata_start(cdp->atp->controller); splx(s); } @@ -1110,7 +1110,7 @@ void acd_start(struct atapi_softc *atp) { struct acd_softc *cdp = atp->driver; - struct buf *bp = bufq_first(&cdp->buf_queue); + struct bio *bp = bioq_first(&cdp->bio_queue); u_int32_t lba, count; int8_t ccb[16]; @@ -1118,13 +1118,13 @@ acd_start(struct atapi_softc *atp) int i; cdp = cdp->driver[cdp->changer_info->current_slot]; - bp = bufq_first(&cdp->buf_queue); + bp = bioq_first(&cdp->bio_queue); /* check for work pending on any other slot */ for (i = 0; i < cdp->changer_info->slots; i++) { if (i == cdp->changer_info->current_slot) continue; - if (bufq_first(&(cdp->driver[i]->buf_queue))) { + if (bioq_first(&(cdp->driver[i]->bio_queue))) { if (!bp || time_second > (cdp->timestamp + 10)) { acd_select_slot(cdp->driver[i]); return; @@ -1134,29 +1134,33 @@ acd_start(struct atapi_softc *atp) } if (!bp) return; - bufq_remove(&cdp->buf_queue, bp); + bioq_remove(&cdp->bio_queue, bp); /* reject all queued entries if media changed */ if (cdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } bzero(ccb, sizeof(ccb)); - count = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; - if (bp->b_flags & B_PHYS) - lba = bp->b_offset / cdp->block_size; + count = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size; + { + /* XXX Hack until b_offset is always initialized */ + struct buf *bup = (struct buf *)bp; + if (bup->b_flags & B_PHYS) + lba = bup->b_offset / cdp->block_size; else - lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); + lba = bp->bio_blkno / (cdp->block_size / DEV_BSIZE); + } - if (bp->b_iocmd == BIO_READ) { + if (bp->bio_cmd == BIO_READ) { /* if transfer goes beyond EOM adjust it to be within limits */ if (lba + count > cdp->info.volsize) { /* if we are entirely beyond EOM return EOF */ if ((count = cdp->info.volsize - lba) <= 0) { - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -1181,26 +1185,26 @@ acd_start(struct atapi_softc *atp) devstat_start_transaction(cdp->stats); - atapi_queue_cmd(cdp->atp, ccb, bp->b_data, count * cdp->block_size, - (bp->b_iocmd == BIO_READ)?ATPR_F_READ : 0, 30, acd_done, bp); + atapi_queue_cmd(cdp->atp, ccb, bp->bio_data, count * cdp->block_size, + (bp->bio_cmd == BIO_READ)?ATPR_F_READ : 0, 30, acd_done, bp); } static int32_t acd_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct acd_softc *cdp = request->device->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = bp->b_bcount - request->donecount; - if (bp->b_iocmd == BIO_WRITE) + bp->bio_resid = bp->bio_bcount - request->donecount; + if (bp->bio_cmd == BIO_WRITE) cdp->flags |= F_WRITTEN; } - devstat_end_transaction_buf(cdp->stats, bp); + devstat_end_transaction_bio(cdp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-cd.h b/sys/dev/ata/atapi-cd.h index eed3647..ca65af2 100644 --- a/sys/dev/ata/atapi-cd.h +++ b/sys/dev/ata/atapi-cd.h @@ -316,7 +316,7 @@ struct acd_softc { #define F_DISK_OPEN 0x0004 /* disk open for writing */ #define F_TRACK_OPEN 0x0008 /* track open for writing */ - struct buf_queue_head buf_queue; /* Queue of i/o requests */ + struct bio_queue_head bio_queue; /* Queue of i/o requests */ struct toc toc; /* table of disc contents */ struct { u_int32_t volsize; /* volume size in blocks */ diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 1b7e177..b1e2051 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -91,7 +91,7 @@ afdattach(struct atapi_softc *atp) return -1; } bzero(fdp, sizeof(struct afd_softc)); - bufq_init(&fdp->buf_queue); + bioq_init(&fdp->bio_queue); fdp->atp = atp; fdp->lun = ata_get_lun(&afd_lun_map); @@ -274,20 +274,20 @@ afdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) } static void -afdstrategy(struct buf *bp) +afdstrategy(struct bio *bp) { - struct afd_softc *fdp = bp->b_dev->si_drv1; + struct afd_softc *fdp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } s = splbio(); - bufqdisksort(&fdp->buf_queue, bp); + bioqdisksort(&fdp->bio_queue, bp); ata_start(fdp->atp->controller); splx(s); } @@ -296,7 +296,7 @@ void afd_start(struct atapi_softc *atp) { struct afd_softc *fdp = atp->driver; - struct buf *bp = bufq_first(&fdp->buf_queue); + struct bio *bp = bioq_first(&fdp->bio_queue); u_int32_t lba, count; int8_t ccb[16]; int8_t *data_ptr; @@ -304,24 +304,24 @@ afd_start(struct atapi_softc *atp) if (!bp) return; - bufq_remove(&fdp->buf_queue, bp); + bioq_remove(&fdp->bio_queue, bp); /* should reject all queued entries if media have changed. */ if (fdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - lba = bp->b_pblkno; - count = bp->b_bcount / fdp->cap.sector_size; - data_ptr = bp->b_data; - bp->b_resid = 0; + lba = bp->bio_pblkno; + count = bp->bio_bcount / fdp->cap.sector_size; + data_ptr = bp->bio_data; + bp->bio_resid = 0; bzero(ccb, sizeof(ccb)); - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) ccb[0] = ATAPI_READ_BIG; else ccb[0] = ATAPI_WRITE_BIG; @@ -338,7 +338,7 @@ afd_start(struct atapi_softc *atp) atapi_queue_cmd(fdp->atp, ccb, data_ptr, fdp->transfersize * fdp->cap.sector_size, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 30, + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_partial_done, bp); count -= fdp->transfersize; @@ -354,35 +354,35 @@ afd_start(struct atapi_softc *atp) ccb[8] = count; atapi_queue_cmd(fdp->atp, ccb, data_ptr, count * fdp->cap.sector_size, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); } static int32_t afd_partial_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } - bp->b_resid += request->bytecount; + bp->bio_resid += request->bytecount; return 0; } static int32_t afd_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct afd_softc *fdp = request->device->driver; - if (request->error || (bp->b_ioflags & BIO_ERROR)) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + if (request->error || (bp->bio_flags & BIO_ERROR)) { + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else - bp->b_resid += (bp->b_bcount - request->donecount); - devstat_end_transaction_buf(&fdp->stats, bp); + bp->bio_resid += (bp->bio_bcount - request->donecount); + devstat_end_transaction_bio(&fdp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-fd.h b/sys/dev/ata/atapi-fd.h index b141625..d68474a 100644 --- a/sys/dev/ata/atapi-fd.h +++ b/sys/dev/ata/atapi-fd.h @@ -74,7 +74,7 @@ struct afd_softc { struct atapi_softc *atp; /* controller structure */ int32_t lun; /* logical device unit */ int32_t transfersize; /* max size of each transfer */ - struct buf_queue_head buf_queue; /* queue of i/o requests */ + struct bio_queue_head bio_queue; /* queue of i/o requests */ struct afd_header header; /* capabilities page info */ struct afd_cappage cap; /* capabilities page info */ struct disk disk; /* virtual drives */ diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index ff895d2..092891f 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -102,7 +102,7 @@ astattach(struct atapi_softc *atp) return -1; } bzero(stp, sizeof(struct ast_softc)); - bufq_init(&stp->buf_queue); + bioq_init(&stp->bio_queue); stp->atp = atp; stp->lun = ata_get_lun(&ast_lun_map); if (ast_sense(stp)) { @@ -410,45 +410,45 @@ astioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) } static void -aststrategy(struct buf *bp) +aststrategy(struct bio *bp) { - struct ast_softc *stp = bp->b_dev->si_drv1; + struct ast_softc *stp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - if (!(bp->b_iocmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { - bp->b_error = EPERM; - bp->b_ioflags |= BIO_ERROR; + if (!(bp->bio_cmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { + bp->bio_error = EPERM; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } /* check for != blocksize requests */ - if (bp->b_bcount % stp->blksize) { + if (bp->bio_bcount % stp->blksize) { printf("ast%d: bad request, must be multiple of %d\n", stp->lun, stp->blksize); - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } /* warn about transfers bigger than the device suggests */ - if (bp->b_bcount > stp->blksize * stp->cap.ctl) { + if (bp->bio_bcount > stp->blksize * stp->cap.ctl) { if ((stp->flags & F_CTL_WARN) == 0) { printf("ast%d: WARNING: CTL exceeded %ld>%d\n", - stp->lun, bp->b_bcount, stp->blksize * stp->cap.ctl); + stp->lun, bp->bio_bcount, stp->blksize * stp->cap.ctl); stp->flags |= F_CTL_WARN; } } s = splbio(); - bufq_insert_tail(&stp->buf_queue, bp); + bioq_insert_tail(&stp->bio_queue, bp); ata_start(stp->atp->controller); splx(s); } @@ -457,7 +457,7 @@ void ast_start(struct atapi_softc *atp) { struct ast_softc *stp = atp->driver; - struct buf *bp = bufq_first(&stp->buf_queue); + struct bio *bp = bioq_first(&stp->bio_queue); u_int32_t blkcount; int8_t ccb[16]; @@ -466,13 +466,13 @@ ast_start(struct atapi_softc *atp) bzero(ccb, sizeof(ccb)); - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) ccb[0] = ATAPI_READ; else ccb[0] = ATAPI_WRITE; - bufq_remove(&stp->buf_queue, bp); - blkcount = bp->b_bcount / stp->blksize; + bioq_remove(&stp->bio_queue, bp); + blkcount = bp->bio_bcount / stp->blksize; ccb[1] = 1; ccb[2] = blkcount>>16; @@ -481,27 +481,27 @@ ast_start(struct atapi_softc *atp) devstat_start_transaction(&stp->stats); - atapi_queue_cmd(stp->atp, ccb, bp->b_data, blkcount * stp->blksize, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 60, ast_done, bp); + atapi_queue_cmd(stp->atp, ccb, bp->bio_data, blkcount * stp->blksize, + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 60, ast_done, bp); } static int32_t ast_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct ast_softc *stp = request->device->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else { - if (!(bp->b_iocmd == BIO_READ)) + if (!(bp->bio_cmd == BIO_READ)) stp->flags |= F_DATA_WRITTEN; - bp->b_resid = bp->b_bcount - request->donecount; - ast_total += (bp->b_bcount - bp->b_resid); + bp->bio_resid = bp->bio_bcount - request->donecount; + ast_total += (bp->bio_bcount - bp->bio_resid); } - devstat_end_transaction_buf(&stp->stats, bp); + devstat_end_transaction_bio(&stp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-tape.h b/sys/dev/ata/atapi-tape.h index bccd665..1170579 100644 --- a/sys/dev/ata/atapi-tape.h +++ b/sys/dev/ata/atapi-tape.h @@ -154,7 +154,7 @@ struct ast_softc { #define F_ONSTREAM 0x0100 /* OnStream ADR device */ int32_t blksize; /* block size (512 | 1024) */ - struct buf_queue_head buf_queue; /* queue of i/o requests */ + struct bio_queue_head bio_queue; /* queue of i/o requests */ struct atapi_params *param; /* drive parameters table */ struct ast_cappage cap; /* capabilities page info */ struct devstat stats; /* devstat entry */ diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 760734d..92f8b61 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -764,9 +764,10 @@ ccdclose(dev, flags, fmt, p) } static void -ccdstrategy(bp) - struct buf *bp; +ccdstrategy(bip) + struct bio *bip; { + struct buf *bp = (struct buf *)bip; int unit = ccdunit(bp->b_dev); struct ccd_softc *cs = &ccd_softc[unit]; int s; @@ -795,7 +796,7 @@ ccdstrategy(bp) */ wlabel = cs->sc_flags & (CCDF_WLABEL|CCDF_LABELLING); if (ccdpart(bp->b_dev) != RAW_PART) { - if (bounds_check_with_label(bp, lp, wlabel) <= 0) + if (bounds_check_with_label(&bp->b_io, lp, wlabel) <= 0) goto done; } else { int pbn; /* in sc_secsize chunks */ @@ -838,7 +839,7 @@ ccdstrategy(bp) splx(s); return; done: - biodone(bp); + bufdone(bp); } static void @@ -1112,7 +1113,7 @@ ccdintr(cs, bp) if (bp->b_ioflags & BIO_ERROR) bp->b_resid = bp->b_bcount; devstat_end_transaction_buf(&cs->device_stats, bp); - biodone(bp); + bufdone(bp); } /* diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 948142c..c1b02b1 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -84,7 +84,6 @@ #include /* misuse a flag to identify format operation */ -#define B_FORMAT B_XXX /* configuration flags */ #define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */ @@ -863,7 +862,7 @@ fdc_attach(device_t dev) /* reset controller, turn motor off, clear fdout mirror reg */ fdout_wr(fdc, ((fdc->fdout = 0))); - bufq_init(&fdc->head); + bioq_init(&fdc->head); /* * Probe and attach any children. We should probably detect @@ -1447,7 +1446,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p) /* fdstrategy */ /****************************************************************************/ void -fdstrategy(struct buf *bp) +fdstrategy(struct bio *bp) { unsigned nblocks, blknum, cando; int s; @@ -1456,31 +1455,31 @@ fdstrategy(struct buf *bp) fd_p fd; size_t fdblk; - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd == 0) panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)", - (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev)); + (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev)); fdc = fd->fdc; if (fd->type == NO_TYPE) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; goto bad; }; fdblk = 128 << (fd->ft->secsize); - if (!(bp->b_flags & B_FORMAT)) { - if (bp->b_blkno < 0) { + if (!(bp->bio_cmd & BIO_FORMAT)) { + if (bp->bio_blkno < 0) { printf( "fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n", - fdu, (u_long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + fdu, (u_long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - if ((bp->b_bcount % fdblk) != 0) { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + if ((bp->bio_bcount % fdblk) != 0) { + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } @@ -1488,33 +1487,33 @@ fdstrategy(struct buf *bp) /* * Set up block calculations. */ - if (bp->b_blkno > 20000000) { + if (bp->bio_blkno > 20000000) { /* * Reject unreasonably high block number, prevent the * multiplication below from overflowing. */ - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk; + blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk; nblocks = fd->ft->size; - bp->b_resid = 0; - if (blknum + (bp->b_bcount / fdblk) > nblocks) { + bp->bio_resid = 0; + if (blknum + (bp->bio_bcount / fdblk) > nblocks) { if (blknum <= nblocks) { cando = (nblocks - blknum) * fdblk; - bp->b_resid = bp->b_bcount - cando; + bp->bio_resid = bp->bio_bcount - cando; if (cando == 0) goto bad; /* not actually bad but EOF */ } else { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } - bp->b_pblkno = bp->b_blkno; + bp->bio_pblkno = bp->bio_blkno; s = splbio(); - bufqdisksort(&fdc->head, bp); + bioqdisksort(&fdc->head, bp); untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */ /* Tell devstat we are starting on the transaction */ @@ -1647,15 +1646,15 @@ fdstate(fdc_p fdc) unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; - register struct buf *bp; + register struct bio *bp; struct fd_formb *finfo = NULL; size_t fdblk; bp = fdc->bp; if (bp == NULL) { - bp = bufq_first(&fdc->head); + bp = bioq_first(&fdc->head); if (bp != NULL) { - bufq_remove(&fdc->head, bp); + bioq_remove(&fdc->head, bp); fdc->bp = bp; } } @@ -1674,24 +1673,24 @@ fdstate(fdc_p fdc) TRACE1("[fdc%d IDLE]", fdc->fdcu); return (0); } - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); fdblk = 128 << fd->ft->secsize; if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); - read = bp->b_iocmd == BIO_READ; + read = bp->bio_cmd == BIO_READ; if (read) idf = ISADMA_READ; else idf = ISADMA_WRITE; - format = bp->b_flags & B_FORMAT; + format = bp->bio_cmd & BIO_FORMAT; if (format) { - finfo = (struct fd_formb *)bp->b_data; + finfo = (struct fd_formb *)bp->bio_data; fd->skip = (char *)&(finfo->fd_formb_cylno(0)) - (char *)finfo; } if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) { - blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk + + blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk + fd->skip/fdblk; b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads); } @@ -1830,8 +1829,8 @@ fdstate(fdc_p fdc) fd->track = b_cylinder; if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(idf, bp->b_data+fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmastart(idf, bp->bio_data+fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); head = sec / sectrac; @@ -1846,8 +1845,8 @@ fdstate(fdc_p fdc) /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; /* reset the beast */ return (retrier(fdc)); @@ -1887,11 +1886,11 @@ fdstate(fdc_p fdc) * * Umpf. */ - SET_BCDR(fdc, 1, bp->b_bcount, 0); + SET_BCDR(fdc, 1, bp->bio_bcount, 0); - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, - bp->b_bcount); + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, + bp->bio_bcount); } /* formatting */ @@ -1903,8 +1902,8 @@ fdstate(fdc_p fdc) /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -1922,8 +1921,8 @@ fdstate(fdc_p fdc) * the WRITE command is sent */ if (!read) - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, fdblk); } if (fd_cmd(fdc, 9, @@ -1940,8 +1939,8 @@ fdstate(fdc_p fdc) /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -1952,8 +1951,8 @@ fdstate(fdc_p fdc) * if this is a read, then simply await interrupt * before performing PIO */ - if (read && !fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip,fdblk)) { + if (read && !fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip,fdblk)) { fd->tohandle = timeout(fd_iotimeout, fdc, hz); return(0); /* will return later */ }; @@ -1970,7 +1969,7 @@ fdstate(fdc_p fdc) * actually perform the PIO read. The IOCOMPLETE case * removes the timeout for us. */ - (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk); + (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk); fdc->state = IOCOMPLETE; /* FALLTHROUGH */ case IOCOMPLETE: /* IO DONE, post-analyze */ @@ -1978,8 +1977,8 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) fdc->retry = 6; /* force a reset */ @@ -1992,8 +1991,8 @@ fdstate(fdc_p fdc) case IOTIMEDOUT: if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->status[0] & NE7_ST0_IC) { if ((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT && fdc->status[1] & NE7_ST1_OR) { @@ -2018,7 +2017,7 @@ fdstate(fdc_p fdc) } /* All OK */ fd->skip += fdblk; - if (!format && fd->skip < bp->b_bcount - bp->b_resid) { + if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) { /* set up next transfer */ fdc->state = DOSEEK; } else { @@ -2026,7 +2025,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fd->device_stats, bp); + devstat_end_transaction_bio(&fd->device_stats, bp); biodone(bp); fdc->fd = (fd_p) 0; fdc->fdu = -1; @@ -2137,14 +2136,14 @@ fdstate(fdc_p fdc) static int retrier(struct fdc_data *fdc) { - register struct buf *bp; + struct bio *bp; struct fd_data *fd; int fdu; bp = fdc->bp; /* XXX shouldn't this be cached somewhere? */ - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd->options & FDOPT_NORETRY) goto fail; @@ -2164,14 +2163,14 @@ retrier(struct fdc_data *fdc) default: fail: { - dev_t sav_b_dev = bp->b_dev; + dev_t sav_bio_dev = bp->bio_dev; /* Trick diskerr */ - bp->b_dev = makedev(major(bp->b_dev), - (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART); + bp->bio_dev = makedev(major(bp->bio_dev), + (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART); diskerr(bp, "hard error", LOG_PRINTF, fdc->fd->skip / DEV_BSIZE, (struct disklabel *)NULL); - bp->b_dev = sav_b_dev; + bp->bio_dev = sav_bio_dev; if (fdc->flags & FDC_STAT_VALID) { printf( @@ -2185,13 +2184,13 @@ retrier(struct fdc_data *fdc) else printf(" (No status)\n"); } - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EIO; - bp->b_resid += bp->b_bcount - fdc->fd->skip; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_resid += bp->bio_bcount - fdc->fd->skip; fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fdc->fd->device_stats, bp); + devstat_end_transaction_bio(&fdc->fd->device_stats, bp); biodone(bp); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; @@ -2231,8 +2230,8 @@ fdformat(dev, finfo, p) bzero((void *)bp, sizeof(struct buf)); BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS | B_FORMAT; - bp->b_iocmd = BIO_WRITE; + bp->b_flags = B_PHYS; + bp->b_iocmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a @@ -2261,7 +2260,7 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - biodone(bp); + biodone(&bp->b_io); /* XXX: HUH ? */ } if (bp->b_ioflags & BIO_ERROR) rv = bp->b_error; diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index 447ed46..2072ab5 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -190,7 +190,7 @@ ida_init(struct ida_softc *ida) SLIST_INIT(&ida->free_qcbs); STAILQ_INIT(&ida->qcb_queue); - bufq_init(&ida->buf_queue); + bioq_init(&ida->bio_queue); ida->qcbs = (struct ida_qcb *) malloc(IDA_QCB_MAX * sizeof(struct ida_qcb), M_DEVBUF, M_NOWAIT); @@ -358,9 +358,9 @@ ida_command(struct ida_softc *ida, int command, void *data, int datasize, } void -ida_submit_buf(struct ida_softc *ida, struct buf *bp) +ida_submit_buf(struct ida_softc *ida, struct bio *bp) { - bufq_insert_tail(&ida->buf_queue, bp); + bioq_insert_tail(&ida->bio_queue, bp); ida_construct_qcb(ida); ida_start(ida); } @@ -371,9 +371,9 @@ ida_construct_qcb(struct ida_softc *ida) struct ida_hardware_qcb *hwqcb; struct ida_qcb *qcb; bus_dmasync_op_t op; - struct buf *bp; + struct bio *bp; - bp = bufq_first(&ida->buf_queue); + bp = bioq_first(&ida->bio_queue); if (bp == NULL) return; /* no more buffers */ @@ -381,7 +381,7 @@ ida_construct_qcb(struct ida_softc *ida) if (qcb == NULL) return; /* out of resources */ - bufq_remove(&ida->buf_queue, bp); + bioq_remove(&ida->bio_queue, bp); qcb->buf = bp; qcb->flags = 0; @@ -389,7 +389,7 @@ ida_construct_qcb(struct ida_softc *ida) bzero(hwqcb, sizeof(struct ida_hdr) + sizeof(struct ida_req)); bus_dmamap_load(ida->buffer_dmat, qcb->dmamap, - (void *)bp->b_data, bp->b_bcount, ida_setup_dmamap, hwqcb, 0); + (void *)bp->bio_data, bp->bio_bcount, ida_setup_dmamap, hwqcb, 0); op = qcb->flags & DMA_DATA_IN ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE; bus_dmamap_sync(ida->buffer_dmat, qcb->dmamap, op); @@ -398,13 +398,13 @@ ida_construct_qcb(struct ida_softc *ida) * XXX */ { - struct id_softc *drv = (struct id_softc *)bp->b_driver1; + struct id_softc *drv = (struct id_softc *)bp->bio_driver1; hwqcb->hdr.drive = drv->unit; } - hwqcb->req.blkno = bp->b_pblkno; - hwqcb->req.bcount = howmany(bp->b_bcount, DEV_BSIZE); - hwqcb->req.command = bp->b_iocmd == BIO_READ ? CMD_READ : CMD_WRITE; + hwqcb->req.blkno = bp->bio_pblkno; + hwqcb->req.bcount = howmany(bp->bio_bcount, DEV_BSIZE); + hwqcb->req.command = bp->bio_cmd == BIO_READ ? CMD_READ : CMD_WRITE; STAILQ_INSERT_TAIL(&ida->qcb_queue, qcb, link.stqe); } @@ -519,7 +519,7 @@ ida_done(struct ida_softc *ida, struct ida_qcb *qcb) wakeup(qcb); } else { if (error) - qcb->buf->b_ioflags |= BIO_ERROR; + qcb->buf->bio_flags |= BIO_ERROR; id_intr(qcb->buf); } diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c index 3694f62..6f81c0d 100644 --- a/sys/dev/ida/ida_disk.c +++ b/sys/dev/ida/ida_disk.c @@ -149,32 +149,32 @@ idclose(dev_t dev, int flags, int fmt, struct proc *p) * be a multiple of a sector in length. */ static void -idstrategy(struct buf *bp) +idstrategy(struct bio *bp) { struct id_softc *drv; int s; - drv = idgetsoftc(bp->b_dev); + drv = idgetsoftc(bp->bio_dev); if (drv == NULL) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } /* * software write protect check */ - if (drv->flags & DRV_WRITEPROT && (bp->b_iocmd == BIO_WRITE)) { - bp->b_error = EROFS; + if (drv->flags & DRV_WRITEPROT && (bp->bio_cmd == BIO_WRITE)) { + bp->bio_error = EROFS; goto bad; } /* * If it's a null transfer, return immediately */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; - bp->b_driver1 = drv; + bp->bio_driver1 = drv; s = splbio(); devstat_start_transaction(&drv->stats); ida_submit_buf(drv->controller, bp); @@ -182,28 +182,28 @@ idstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed transfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } void -id_intr(struct buf *bp) +id_intr(struct bio *bp) { - struct id_softc *drv = (struct id_softc *)bp->b_driver1; + struct id_softc *drv = (struct id_softc *)bp->bio_driver1; - if (bp->b_ioflags & BIO_ERROR) - bp->b_error = EIO; + if (bp->bio_flags & BIO_ERROR) + bp->bio_error = EIO; else - bp->b_resid = 0; + bp->bio_resid = 0; - devstat_end_transaction_buf(&drv->stats, bp); + devstat_end_transaction_bio(&drv->stats, bp); biodone(bp); } diff --git a/sys/dev/ida/idavar.h b/sys/dev/ida/idavar.h index c2614ee..50335ab 100644 --- a/sys/dev/ida/idavar.h +++ b/sys/dev/ida/idavar.h @@ -103,7 +103,7 @@ struct ida_qcb { } link; bus_dmamap_t dmamap; bus_addr_t hwqcb_busaddr; - struct buf *buf; /* buf associated with qcb */ + struct bio *buf; /* bio associated with qcb */ }; struct ida_softc; @@ -154,7 +154,7 @@ struct ida_softc { struct ida_qcb *qcbs; /* kernel QCB array */ SLIST_HEAD(, ida_qcb) free_qcbs; STAILQ_HEAD(, ida_qcb) qcb_queue; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct ida_access cmd; }; @@ -192,9 +192,9 @@ extern int ida_init(struct ida_softc *ida); extern void ida_attach(struct ida_softc *ida); extern int ida_command(struct ida_softc *ida, int command, void *data, int datasize, int drive, int flags); -extern void ida_submit_buf(struct ida_softc *ida, struct buf *bp); +extern void ida_submit_buf(struct ida_softc *ida, struct bio *bp); extern void ida_intr(void *data); -extern void id_intr(struct buf *bp); +extern void id_intr(struct bio *bp); #endif /* _IDAVAR_H */ diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 70614d7..1bdc726 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -116,7 +116,7 @@ struct mcd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; short mode; @@ -141,7 +141,7 @@ static struct mcd_data { short curr_mode; struct mcd_read2 lastpb; short debug; - struct buf_queue_head head; /* head of buf queue */ + struct bio_queue_head head; /* head of bio queue */ struct mcd_mbx mbx; } mcd_data[NMCD]; @@ -250,7 +250,7 @@ int mcd_attach(struct isa_device *dev) cd->iobase = dev->id_iobase; cd->flags |= MCDINIT; mcd_soft_reset(unit); - bufq_init(&cd->head); + bioq_init(&cd->head); #ifdef NOTYET /* wire controller for interrupts and dma */ @@ -385,48 +385,48 @@ int mcdclose(dev_t dev, int flags, int fmt, struct proc *p) } void -mcdstrategy(struct buf *bp) +mcdstrategy(struct bio *bp) { struct mcd_data *cd; int s; - int unit = mcd_unit(bp->b_dev); + int unit = mcd_unit(bp->bio_dev); cd = mcd_data + unit; /* test validity */ /*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n", - bp,unit,bp->b_blkno,bp->b_bcount);*/ - if (unit >= NMCD || bp->b_blkno < 0) { + bp,unit,bp->bio_blkno,bp->bio_bcount);*/ + if (unit >= NMCD || bp->bio_blkno < 0) { printf("mcdstrategy: unit = %d, blkno = %ld, bcount = %ld\n", - unit, (long)bp->b_blkno, bp->b_bcount); + unit, (long)bp->bio_blkno, bp->bio_bcount); printf("mcd: mcdstratregy failure"); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } /* if device invalidated (e.g. media change, door open), error */ if (!(cd->flags & MCDVALID)) { MCD_TRACE("strategy: drive not valid\n"); - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* read only */ - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } /* no data to read */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; /* for non raw access, check partition limits */ - if (mcd_part(bp->b_dev) != RAW_PART) { + if (mcd_part(bp->bio_dev) != RAW_PART) { if (!(cd->flags & MCDLABEL)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* adjust transfer if necessary */ @@ -434,13 +434,13 @@ MCD_TRACE("strategy: drive not valid\n"); goto done; } } else { - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = 0; } /* queue it */ s = splbio(); - bufqdisksort(&cd->head, bp); + bioqdisksort(&cd->head, bp); splx(s); /* now check whether we can perform processing */ @@ -448,9 +448,9 @@ MCD_TRACE("strategy: drive not valid\n"); return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -459,7 +459,7 @@ static void mcd_start(int unit) { struct mcd_data *cd = mcd_data + unit; struct partition *p; - struct buf *bp; + struct bio *bp; int s = splbio(); if (cd->flags & MCDMBXBSY) { @@ -467,11 +467,11 @@ static void mcd_start(int unit) return; } - bp = bufq_first(&cd->head); + bp = bioq_first(&cd->head); if (bp != 0) { /* block found to process, dequeue */ /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ - bufq_remove(&cd->head, bp); + bioq_remove(&cd->head, bp); splx(s); } else { /* nothing to do */ @@ -485,10 +485,10 @@ static void mcd_start(int unit) return; } - p = cd->dlabel.d_partitions + mcd_part(bp->b_dev); + p = cd->dlabel.d_partitions + mcd_part(bp->bio_dev); cd->flags |= MCDMBXBSY; - if (cd->partflags[mcd_part(bp->b_dev)] & MCDREADRAW) + if (cd->partflags[mcd_part(bp->bio_dev)] & MCDREADRAW) cd->flags |= MCDREADRAW; cd->mbx.unit = unit; cd->mbx.port = cd->iobase; @@ -993,7 +993,7 @@ mcd_doread(int state, struct mcd_mbx *mbxin) int port = mbx->port; int com_port = mbx->port + mcd_command; int data_port = mbx->port + mcd_rdata; - struct buf *bp = mbx->bp; + struct bio *bp = mbx->bp; struct mcd_data *cd = mcd_data + unit; int rm,i,k; @@ -1086,11 +1086,11 @@ retry_mode: RDELAY_WAITMODE-mbx->count); modedone: /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip = 0; nextblock: - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum = (bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; MCD_TRACE("mcd_doread: read blknum=%d for bp=%p\n", @@ -1131,7 +1131,7 @@ retry_read: RDELAY_WAITREAD-mbx->count); got_it: /* data is ready */ - addr = bp->b_data + mbx->skip; + addr = bp->bio_data + mbx->skip; outb(port+mcd_ctl2,0x04); /* XXX */ for (i=0; isz; i++) @@ -1153,7 +1153,7 @@ retry_read: } /* return buffer */ - bp->b_resid = 0; + bp->bio_resid = 0; biodone(bp); cd->flags &= ~(MCDMBXBSY|MCDREADRAW); @@ -1184,8 +1184,8 @@ readerr: } harderr: /* invalidate the buffer */ - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); cd->flags &= ~(MCDMBXBSY|MCDREADRAW); diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 8b5ca80..44a7cef 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -81,7 +81,7 @@ static struct cdevsw md_cdevsw = { struct md_s { int unit; struct devstat stats; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct disk disk; dev_t dev; int busy; @@ -135,16 +135,16 @@ mdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } static void -mdstrategy(struct buf *bp) +mdstrategy(struct bio *bp) { struct md_s *sc; if (md_debug > 1) - printf("mdstrategy(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("mdstrategy(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; if (sc->type == MD_MALLOC) { mdstrategy_malloc(bp); } else { @@ -155,7 +155,7 @@ mdstrategy(struct buf *bp) static void -mdstrategy_malloc(struct buf *bp) +mdstrategy_malloc(struct bio *bp) { int s, i; struct md_s *sc; @@ -164,15 +164,15 @@ mdstrategy_malloc(struct buf *bp) unsigned secno, nsec, secval, uc; if (md_debug > 1) - printf("mdstrategy_malloc(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("mdstrategy_malloc(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; s = splbio(); - bufqdisksort(&sc->buf_queue, bp); + bioqdisksort(&sc->bio_queue, bp); if (sc->busy) { splx(s); @@ -182,25 +182,25 @@ mdstrategy_malloc(struct buf *bp) sc->busy++; while (1) { - bp = bufq_first(&sc->buf_queue); + bp = bioq_first(&sc->bio_queue); if (bp) - bufq_remove(&sc->buf_queue, bp); + bioq_remove(&sc->bio_queue, bp); splx(s); if (!bp) break; devstat_start_transaction(&sc->stats); - if (bp->b_iocmd == BIO_DELETE) + if (bp->bio_cmd == BIO_DELETE) dop = DEVSTAT_NO_DATA; - else if (bp->b_iocmd == BIO_READ) + else if (bp->bio_cmd == BIO_READ) dop = DEVSTAT_READ; else dop = DEVSTAT_WRITE; - nsec = bp->b_bcount / DEV_BSIZE; - secno = bp->b_pblkno; - dst = bp->b_data; + nsec = bp->bio_bcount / DEV_BSIZE; + secno = bp->bio_pblkno; + dst = bp->bio_data; while (nsec--) { if (secno < sc->nsecp) { @@ -218,15 +218,16 @@ mdstrategy_malloc(struct buf *bp) secval = 0; } if (md_debug > 2) - printf("%lx %p %p %d\n", bp->b_flags, secpp, secp, secval); + printf("%x %p %p %d\n", + bp->bio_flags, secpp, secp, secval); - if (bp->b_iocmd == BIO_DELETE) { + if (bp->bio_cmd == BIO_DELETE) { if (secpp) { if (secp) FREE(secp, M_MDSECT); *secpp = 0; } - } else if (bp->b_iocmd == BIO_READ) { + } else if (bp->bio_cmd == BIO_READ) { if (secp) { bcopy(secp, dst, DEV_BSIZE); } else if (secval) { @@ -271,8 +272,8 @@ mdstrategy_malloc(struct buf *bp) secno++; dst += DEV_BSIZE; } - bp->b_resid = 0; - devstat_end_transaction_buf(&sc->stats, bp); + bp->bio_resid = 0; + devstat_end_transaction_bio(&sc->stats, bp); biodone(bp); s = splbio(); } @@ -282,22 +283,22 @@ mdstrategy_malloc(struct buf *bp) static void -mdstrategy_preload(struct buf *bp) +mdstrategy_preload(struct bio *bp) { int s; struct md_s *sc; devstat_trans_flags dop; if (md_debug > 1) - printf("mdstrategy_preload(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("mdstrategy_preload(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; s = splbio(); - bufqdisksort(&sc->buf_queue, bp); + bioqdisksort(&sc->bio_queue, bp); if (sc->busy) { splx(s); @@ -307,26 +308,26 @@ mdstrategy_preload(struct buf *bp) sc->busy++; while (1) { - bp = bufq_first(&sc->buf_queue); + bp = bioq_first(&sc->bio_queue); if (bp) - bufq_remove(&sc->buf_queue, bp); + bioq_remove(&sc->bio_queue, bp); splx(s); if (!bp) break; devstat_start_transaction(&sc->stats); - if (bp->b_iocmd == BIO_DELETE) { + if (bp->bio_cmd == BIO_DELETE) { dop = DEVSTAT_NO_DATA; - } else if (bp->b_iocmd == BIO_READ) { + } else if (bp->bio_cmd == BIO_READ) { dop = DEVSTAT_READ; - bcopy(sc->pl_ptr + (bp->b_pblkno << DEV_BSHIFT), bp->b_data, bp->b_bcount); + bcopy(sc->pl_ptr + (bp->bio_pblkno << DEV_BSHIFT), bp->bio_data, bp->bio_bcount); } else { dop = DEVSTAT_WRITE; - bcopy(bp->b_data, sc->pl_ptr + (bp->b_pblkno << DEV_BSHIFT), bp->b_bcount); + bcopy(bp->bio_data, sc->pl_ptr + (bp->bio_pblkno << DEV_BSHIFT), bp->bio_bcount); } - bp->b_resid = 0; - devstat_end_transaction_buf(&sc->stats, bp); + bp->bio_resid = 0; + devstat_end_transaction_bio(&sc->stats, bp); biodone(bp); s = splbio(); } @@ -342,7 +343,7 @@ mdcreate(struct cdevsw *devsw) MALLOC(sc, struct md_s *,sizeof(*sc), M_MD, M_WAITOK); bzero(sc, sizeof(*sc)); sc->unit = mdunits++; - bufq_init(&sc->buf_queue); + bioq_init(&sc->bio_queue); devstat_add_entry(&sc->stats, "md", sc->unit, DEV_BSIZE, DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_OTHER, diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index 4bfc8b5..128576e 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -289,7 +289,7 @@ mlx_attach(struct mlx_softc *sc) */ TAILQ_INIT(&sc->mlx_work); TAILQ_INIT(&sc->mlx_freecmds); - bufq_init(&sc->mlx_bufq); + bioq_init(&sc->mlx_bioq); /* * Select accessor methods based on controller interface type. @@ -587,7 +587,7 @@ mlx_detach(device_t dev) * an operation which may add or delete system disks. (Call mlx_startup to * resume normal operation.) * - * Note that we can assume that the bufq on the controller is empty, as we won't + * Note that we can assume that the bioq on the controller is empty, as we won't * allow shutdown if any device is open. */ int @@ -686,14 +686,14 @@ mlx_intr(void *arg) * disk resource, then poke the disk resource to start as much work as it can. */ int -mlx_submit_buf(struct mlx_softc *sc, struct buf *bp) +mlx_submit_buf(struct mlx_softc *sc, struct bio *bp) { int s; debug_called(1); s = splbio(); - bufq_insert_tail(&sc->mlx_bufq, bp); + bioq_insert_tail(&sc->mlx_bioq, bp); sc->mlx_waitbufs++; splx(s); mlx_startio(sc); @@ -1701,14 +1701,14 @@ mlx_poll_command(struct mlx_command *mc) * controller. Leave a couple of slots free for emergencies. * * Must be called at splbio or in an equivalent fashion that prevents - * reentry or activity on the bufq. + * reentry or activity on the bioq. */ static void mlx_startio(struct mlx_softc *sc) { struct mlx_command *mc; struct mlxd_softc *mlxd; - struct buf *bp; + struct bio *bp; int blkcount; int driveno; int cmd; @@ -1723,7 +1723,7 @@ mlx_startio(struct mlx_softc *sc) for (;;) { /* see if there's work to be done */ - if ((bp = bufq_first(&sc->mlx_bufq)) == NULL) + if ((bp = bioq_first(&sc->mlx_bioq)) == NULL) break; /* get a command */ if ((mc = mlx_alloccmd(sc)) == NULL) @@ -1734,16 +1734,16 @@ mlx_startio(struct mlx_softc *sc) break; } /* get the buf containing our work */ - bufq_remove(&sc->mlx_bufq, bp); + bioq_remove(&sc->mlx_bioq, bp); sc->mlx_waitbufs--; splx(s); /* connect the buf to the command */ mc->mc_complete = mlx_completeio; mc->mc_private = bp; - mc->mc_data = bp->b_data; - mc->mc_length = bp->b_bcount; - if (bp->b_iocmd == BIO_READ) { + mc->mc_data = bp->bio_data; + mc->mc_length = bp->bio_bcount; + if (bp->bio_cmd == BIO_READ) { mc->mc_flags |= MLX_CMD_DATAIN; cmd = MLX_CMD_READSG; } else { @@ -1755,13 +1755,13 @@ mlx_startio(struct mlx_softc *sc) mlx_mapcmd(mc); /* build a suitable I/O command (assumes 512-byte rounded transfers) */ - mlxd = (struct mlxd_softc *)bp->b_dev->si_drv1; + mlxd = (struct mlxd_softc *)bp->bio_dev->si_drv1; driveno = mlxd->mlxd_drive - sc->mlx_sysdrive; - blkcount = (bp->b_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE; + blkcount = (bp->bio_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE; - if ((bp->b_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size) + if ((bp->bio_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size) device_printf(sc->mlx_dev, "I/O beyond end of unit (%u,%d > %u)\n", - bp->b_pblkno, blkcount, sc->mlx_sysdrive[driveno].ms_size); + bp->bio_pblkno, blkcount, sc->mlx_sysdrive[driveno].ms_size); /* * Build the I/O command. Note that the SG list type bits are set to zero, @@ -1770,7 +1770,7 @@ mlx_startio(struct mlx_softc *sc) if (sc->mlx_iftype == MLX_IFTYPE_2) { mlx_make_type1(mc, (cmd == MLX_CMD_WRITESG) ? MLX_CMD_WRITESG_OLD : MLX_CMD_READSG_OLD, blkcount & 0xff, /* xfer length low byte */ - bp->b_pblkno, /* physical block number */ + bp->bio_pblkno, /* physical block number */ driveno, /* target drive number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list (top 3 bits clear) */ @@ -1778,7 +1778,7 @@ mlx_startio(struct mlx_softc *sc) mlx_make_type5(mc, cmd, blkcount & 0xff, /* xfer length low byte */ (driveno << 3) | ((blkcount >> 8) & 0x07), /* target and length high 3 bits */ - bp->b_pblkno, /* physical block number */ + bp->bio_pblkno, /* physical block number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list (top 3 bits clear) */ } @@ -1802,12 +1802,12 @@ static void mlx_completeio(struct mlx_command *mc) { struct mlx_softc *sc = mc->mc_sc; - struct buf *bp = (struct buf *)mc->mc_private; - struct mlxd_softc *mlxd = (struct mlxd_softc *)bp->b_dev->si_drv1; + struct bio *bp = (struct bio *)mc->mc_private; + struct mlxd_softc *mlxd = (struct mlxd_softc *)bp->bio_dev->si_drv1; if (mc->mc_status != MLX_STATUS_OK) { /* could be more verbose here? */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; switch(mc->mc_status) { case MLX_STATUS_RDWROFFLINE: /* system drive has gone offline */ @@ -1820,7 +1820,7 @@ mlx_completeio(struct mlx_command *mc) device_printf(sc->mlx_dev, "I/O error - %s\n", mlx_diagnose_command(mc)); #if 0 device_printf(sc->mlx_dev, " b_bcount %ld blkcount %ld b_pblkno %d\n", - bp->b_bcount, bp->b_bcount / MLX_BLKSIZE, bp->b_pblkno); + bp->bio_bcount, bp->bio_bcount / MLX_BLKSIZE, bp->bio_pblkno); device_printf(sc->mlx_dev, " %13D\n", mc->mc_mailbox, " "); #endif break; diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index 5420326..50f20c5 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -165,26 +165,26 @@ mlxd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) * be a multiple of a sector in length. */ static void -mlxd_strategy(struct buf *bp) +mlxd_strategy(struct bio *bp) { - struct mlxd_softc *sc = (struct mlxd_softc *)bp->b_dev->si_drv1; + struct mlxd_softc *sc = (struct mlxd_softc *)bp->bio_dev->si_drv1; debug_called(1); /* bogus disk? */ if (sc == NULL) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } /* XXX may only be temporarily offline - sleep? */ if (sc->mlxd_drive->ms_state == MLX_SYSD_OFFLINE) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } /* do-nothing operation */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; devstat_start_transaction(&sc->mlxd_stats); @@ -192,13 +192,13 @@ mlxd_strategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed transfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -206,17 +206,17 @@ mlxd_strategy(struct buf *bp) void mlxd_intr(void *data) { - struct buf *bp = (struct buf *)data; - struct mlxd_softc *sc = (struct mlxd_softc *)bp->b_dev->si_drv1; + struct bio *bp = (struct bio *)data; + struct mlxd_softc *sc = (struct mlxd_softc *)bp->bio_dev->si_drv1; debug_called(1); - if (bp->b_ioflags & BIO_ERROR) - bp->b_error = EIO; + if (bp->bio_flags & BIO_ERROR) + bp->bio_error = EIO; else - bp->b_resid = 0; + bp->bio_resid = 0; - devstat_end_transaction_buf(&sc->mlxd_stats, bp); + devstat_end_transaction_bio(&sc->mlxd_stats, bp); biodone(bp); } diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h index cd0cd90..47a5136 100644 --- a/sys/dev/mlx/mlxvar.h +++ b/sys/dev/mlx/mlxvar.h @@ -134,7 +134,7 @@ struct mlx_softc struct mlx_command *mlx_busycmd[MLX_NSLOTS]; /* busy commands */ int mlx_busycmds; /* count of busy commands */ struct mlx_sysdrive mlx_sysdrive[MLX_MAXDRIVES]; /* system drives */ - struct buf_queue_head mlx_bufq; /* outstanding I/O operations */ + struct bio_queue_head mlx_bioq; /* outstanding I/O operations */ int mlx_waitbufs; /* number of bufs awaiting commands */ /* controller status */ @@ -237,7 +237,7 @@ struct mlxd_softc /* * Interface between driver core and disk driver (should be using a bus?) */ -extern int mlx_submit_buf(struct mlx_softc *sc, struct buf *bp); +extern int mlx_submit_buf(struct mlx_softc *sc, struct bio *bp); extern int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd, caddr_t addr, int32_t flag, struct proc *p); extern void mlxd_intr(void *data); diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 6863bf6..d0ae35e 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -104,7 +104,7 @@ struct scd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; }; @@ -128,7 +128,7 @@ static struct scd_data { struct ioc_play_msf last_play; short audio_status; - struct buf_queue_head head; /* head of buf queue */ + struct bio_queue_head head; /* head of bio queue */ struct scd_mbx mbx; } scd_data[NSCD]; @@ -213,7 +213,7 @@ scd_attach(struct isa_device *dev) cd->flags = SCDINIT; cd->audio_status = CD_AS_AUDIO_INVALID; - bufq_init(&cd->head); + bioq_init(&cd->head); make_dev(&scd_cdevsw, dkmakeminor(unit, 0, 0), UID_ROOT, GID_OPERATOR, 0640, "rscd%da", unit); @@ -310,56 +310,56 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p) } static void -scdstrategy(struct buf *bp) +scdstrategy(struct bio *bp) { struct scd_data *cd; int s; - int unit = scd_unit(bp->b_dev); + int unit = scd_unit(bp->bio_dev); cd = scd_data + unit; XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", - unit, (long)bp->b_blkno, bp->b_bcount)); + unit, (long)bp->bio_blkno, bp->bio_bcount)); - if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { + if (unit >= NSCD || bp->bio_blkno < 0 || (bp->bio_bcount % SCDBLKSIZE)) { printf("scd%d: strategy failure: blkno = %ld, bcount = %ld\n", - unit, (long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + unit, (long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } /* if device invalidated (e.g. media change, door open), error */ if (!(cd->flags & SCDVALID)) { printf("scd%d: media changed\n", unit); - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* read only */ - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } /* no data to read */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; if (!(cd->flags & SCDTOC)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* adjust transfer if necessary */ if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) goto done; - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = 0; /* queue it */ s = splbio(); - bufqdisksort(&cd->head, bp); + bioqdisksort(&cd->head, bp); splx(s); /* now check whether we can perform processing */ @@ -367,9 +367,9 @@ scdstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -378,7 +378,7 @@ static void scd_start(int unit) { struct scd_data *cd = scd_data + unit; - struct buf *bp; + struct bio *bp; struct partition *p; int s = splbio(); @@ -387,10 +387,10 @@ scd_start(int unit) return; } - bp = bufq_first(&cd->head); + bp = bioq_first(&cd->head); if (bp != 0) { /* block found to process, dequeue */ - bufq_remove(&cd->head, bp); + bioq_remove(&cd->head, bp); cd->flags |= SCDMBXBSY; splx(s); } else { @@ -399,7 +399,7 @@ scd_start(int unit) return; } - p = cd->dlabel.d_partitions + scd_part(bp->b_dev); + p = cd->dlabel.d_partitions + scd_part(bp->bio_dev); cd->mbx.unit = unit; cd->mbx.port = cd->iobase; @@ -793,7 +793,7 @@ scd_doread(int state, struct scd_mbx *mbxin) struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin; int unit = mbx->unit; int port = mbx->port; - struct buf *bp = mbx->bp; + struct bio *bp = mbx->bp; struct scd_data *cd = scd_data + unit; int reg,i; int blknum; @@ -837,14 +837,14 @@ trystat: mbx->sz = cd->blksize; /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip = 0; nextblock: if (!(cd->flags & SCDVALID)) goto changed; - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum = (bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum)); @@ -959,7 +959,7 @@ writeparam: got_data: /* data is ready */ - addr = bp->b_data + mbx->skip; + addr = bp->bio_data + mbx->skip; write_control(port, CBIT_DATA_READY_CLEAR); insb(port+IREG_DATA, addr, mbx->sz); @@ -1026,7 +1026,7 @@ got_param: } /* return buffer */ - bp->b_resid = 0; + bp->bio_resid = 0; biodone(bp); cd->flags &= ~SCDMBXBSY; @@ -1042,9 +1042,9 @@ readerr: } harderr: /* invalidate the buffer */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); cd->flags &= ~SCDMBXBSY; diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c index 8acdeb7..ae2bd3d 100644 --- a/sys/dev/vn/vn.c +++ b/sys/dev/vn/vn.c @@ -275,7 +275,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p) */ static void -vnstrategy(struct buf *bp) +vnstrategy(struct bio *bp) { int unit; struct vn_softc *vn; @@ -284,27 +284,27 @@ vnstrategy(struct buf *bp) struct uio auio; struct iovec aiov; - unit = dkunit(bp->b_dev); - vn = bp->b_dev->si_drv1; + unit = dkunit(bp->bio_dev); + vn = bp->bio_dev->si_drv1; if (vn == NULL) - vn = vnfindvn(bp->b_dev); + vn = vnfindvn(bp->bio_dev); IFOPT(vn, VN_DEBUG) printf("vnstrategy(%p): unit %d\n", bp, unit); if ((vn->sc_flags & VNF_INITED) == 0) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; IFOPT(vn, VN_LABELS) { if (vn->sc_slices != NULL && dscheck(bp, vn->sc_slices) <= 0) { /* XXX: Normal B_ERROR processing, instead ? */ - bp->b_flags |= B_INVAL; + bp->bio_flags |= B_INVAL; biodone(bp); return; } @@ -316,17 +316,17 @@ vnstrategy(struct buf *bp) * Check for required alignment. Transfers must be a valid * multiple of the sector size. */ - if (bp->b_bcount % vn->sc_secsize != 0 || - bp->b_blkno % (vn->sc_secsize / DEV_BSIZE) != 0) { - bp->b_error = EINVAL; - bp->b_flags |= B_INVAL; - bp->b_ioflags |= BIO_ERROR; + if (bp->bio_bcount % vn->sc_secsize != 0 || + bp->bio_blkno % (vn->sc_secsize / DEV_BSIZE) != 0) { + bp->bio_error = EINVAL; + /* XXX bp->b_flags |= B_INVAL; */ + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - pbn = bp->b_blkno / (vn->sc_secsize / DEV_BSIZE); - sz = howmany(bp->b_bcount, vn->sc_secsize); + pbn = bp->bio_blkno / (vn->sc_secsize / DEV_BSIZE); + sz = howmany(bp->bio_bcount, vn->sc_secsize); /* * If out of bounds return an error. If at the EOF point, @@ -334,9 +334,9 @@ vnstrategy(struct buf *bp) */ if (pbn < 0 || pbn >= vn->sc_size) { if (pbn != vn->sc_size) { - bp->b_error = EINVAL; - bp->b_flags |= B_INVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + /* XXX bp->b_flags |= B_INVAL; */ + bp->bio_flags |= BIO_ERROR; } biodone(bp); return; @@ -346,13 +346,13 @@ vnstrategy(struct buf *bp) * If the request crosses EOF, truncate the request. */ if (pbn + sz > vn->sc_size) { - bp->b_bcount = (vn->sc_size - pbn) * vn->sc_secsize; - bp->b_resid = bp->b_bcount; + bp->bio_bcount = (vn->sc_size - pbn) * vn->sc_secsize; + bp->bio_resid = bp->bio_bcount; } - bp->b_pblkno = pbn; + bp->bio_pblkno = pbn; } - if (vn->sc_vp && (bp->b_iocmd == BIO_DELETE)) { + if (vn->sc_vp && (bp->bio_cmd == BIO_DELETE)) { /* * Not handled for vnode-backed element yet. */ @@ -365,23 +365,23 @@ vnstrategy(struct buf *bp) * B_INVAL because (for a write anyway), the buffer is * still valid. */ - aiov.iov_base = bp->b_data; - aiov.iov_len = bp->b_bcount; + aiov.iov_base = bp->bio_data; + aiov.iov_len = bp->bio_bcount; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; - auio.uio_offset = (vm_ooffset_t)bp->b_pblkno * vn->sc_secsize; + auio.uio_offset = (vm_ooffset_t)bp->bio_pblkno * vn->sc_secsize; auio.uio_segflg = UIO_SYSSPACE; - if(bp->b_iocmd == BIO_READ) + if(bp->bio_cmd == BIO_READ) auio.uio_rw = UIO_READ; else auio.uio_rw = UIO_WRITE; - auio.uio_resid = bp->b_bcount; + auio.uio_resid = bp->bio_bcount; auio.uio_procp = curproc; if (!VOP_ISLOCKED(vn->sc_vp, NULL)) { isvplocked = 1; vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); } - if(bp->b_iocmd == BIO_READ) + if(bp->bio_cmd == BIO_READ) error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred); else error = VOP_WRITE(vn->sc_vp, &auio, 0, vn->sc_cred); @@ -389,11 +389,11 @@ vnstrategy(struct buf *bp) VOP_UNLOCK(vn->sc_vp, 0, curproc); isvplocked = 0; } - bp->b_resid = auio.uio_resid; + bp->bio_resid = auio.uio_resid; if (error) { - bp->b_error = error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; } biodone(bp); } else if (vn->sc_object) { @@ -404,17 +404,19 @@ vnstrategy(struct buf *bp) * * Note: if we pre-reserved swap, BIO_DELETE is disabled */ +#if 0 KASSERT((bp->b_bufsize & (vn->sc_secsize - 1)) == 0, ("vnstrategy: buffer %p too small for physio", bp)); +#endif - if ((bp->b_iocmd == BIO_DELETE) && TESTOPT(vn, VN_RESERVE)) { + if ((bp->bio_cmd == BIO_DELETE) && TESTOPT(vn, VN_RESERVE)) { biodone(bp); } else { vm_pager_strategy(vn->sc_object, bp); } } else { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EINVAL; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EINVAL; biodone(bp); } } -- cgit v1.1