void ida_submit_buf(struct ida_softc *ida, struct bio *bio) { bioqdisksort(&ida->bio_queue, bio); ida_construct_qcb(ida); ida_start(ida); }
static int ipsd_strategy(struct dev_strategy_args *ap) { cdev_t dev = ap->a_head.a_dev; struct bio *bio = ap->a_bio; ipsdisk_softc_t *dsc; dsc = dev->si_drv1; DEVICE_PRINTF(8, dsc->dev, "in strategy\n"); bio->bio_driver_info = dsc; devstat_start_transaction(&dsc->stats); lockmgr(&dsc->sc->queue_lock, LK_EXCLUSIVE|LK_RETRY); bioqdisksort(&dsc->sc->bio_queue, bio); ips_start_io_request(dsc->sc); lockmgr(&dsc->sc->queue_lock, LK_RELEASE); return(0); }
static int vtblk_strategy(struct dev_strategy_args *ap) { struct vtblk_softc *sc; cdev_t dev = ap->a_head.a_dev; sc = dev->si_drv1; struct bio *bio = ap->a_bio; struct buf *bp = bio->bio_buf; if (sc == NULL) { vtblk_finish_bio(bio, EINVAL); return EINVAL; } /* * Fail any write if RO. Unfortunately, there does not seem to * be a better way to report our readonly'ness to GEOM above. * * XXX: Is that true in DFly? */ if (sc->vtblk_flags & VTBLK_FLAG_READONLY && (bp->b_cmd == BUF_CMD_READ || bp->b_cmd == BUF_CMD_FLUSH)) { vtblk_finish_bio(bio, EROFS); return (EINVAL); } lwkt_serialize_enter(&sc->vtblk_slz); if ((sc->vtblk_flags & VTBLK_FLAG_DETACH) == 0) { devstat_start_transaction(&sc->stats); bioqdisksort(&sc->vtblk_bioq, bio); vtblk_startio(sc); } else { vtblk_finish_bio(bio, ENXIO); } lwkt_serialize_exit(&sc->vtblk_slz); return 0; }
static void mcdstrategy(struct bio *bp) { struct mcd_softc *sc; int s; sc = (struct mcd_softc *)bp->bio_dev->si_drv1; /* test validity */ /*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n", bp,unit,bp->bio_blkno,bp->bio_bcount);*/ if (bp->bio_blkno < 0) { device_printf(sc->dev, "strategy failure: blkno = %ld, bcount = %ld\n", (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 (!(sc->data.flags & MCDVALID)) { device_printf(sc->dev, "media changed\n"); bp->bio_error = EIO; goto bad; } /* read only */ if (!(bp->bio_cmd == BIO_READ)) { bp->bio_error = EROFS; goto bad; } /* no data to read */ if (bp->bio_bcount == 0) goto done; if (!(sc->data.flags & MCDTOC)) { bp->bio_error = EIO; goto bad; } bp->bio_pblkno = bp->bio_blkno; bp->bio_resid = 0; /* queue it */ s = splbio(); bioqdisksort(&sc->data.head, bp); splx(s); /* now check whether we can perform processing */ mcd_start(sc); return; bad: bp->bio_flags |= BIO_ERROR; done: bp->bio_resid = bp->bio_bcount; biodone(bp); return; }