static int vtblk_resume(device_t dev) { struct vtblk_softc *sc; sc = device_get_softc(dev); VTBLK_LOCK(sc); /* XXX BMV: virtio_reinit(), etc needed here? */ sc->vtblk_flags &= ~VTBLK_FLAG_SUSPEND; vtblk_startio(sc); VTBLK_UNLOCK(sc); return (0); }
static int vtblk_resume(device_t dev) { struct vtblk_softc *sc; sc = device_get_softc(dev); lwkt_serialize_enter(&sc->vtblk_slz); /* XXX BMV: virtio_reinit(), etc needed here? */ sc->vtblk_flags &= ~VTBLK_FLAG_SUSPEND; #if 0 /* XXX Resume IO? */ vtblk_startio(sc); #endif lwkt_serialize_exit(&sc->vtblk_slz); 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; }