On 05/23/2016 06:54 AM, Paolo Bonzini wrote: > These are replacements for blk_aio_preadv and blk_aio_pwritev that allow > customization of the data path. They reuse the DMA helpers' DMAIOFunc > callback type, so that the same function can be used in either the > QEMUSGList or the bounce-buffered case. > > This customization will be needed in the next patch to do zero-copy > SG_IO on scsi-block. > > Signed-off-by: Paolo Bonzini <[email protected]> > --- > hw/scsi/scsi-disk.c | 63 > +++++++++++++++++++++++++++++++++++++++++++---------- > 1 file changed, 52 insertions(+), 11 deletions(-) >
>
> +static
> +BlockAIOCB *scsi_dma_readv(int64_t offset, QEMUIOVector *iov,
> + BlockCompletionFunc *cb, void *cb_opaque,
> + void *opaque)
> +{
> + SCSIDiskReq *r = opaque;
> + SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
DO_UPCAST() is poorly named, and I've been trying to reduce its use in
the tree; can we use container_of() instead?
> + return blk_aio_preadv(s->qdev.conf.blk, offset, iov, 0, cb, cb_opaque);
> +}
> +
> +static
> +BlockAIOCB *scsi_dma_writev(int64_t offset, QEMUIOVector *iov,
> + BlockCompletionFunc *cb, void *cb_opaque,
> + void *opaque)
> +{
> + SCSIDiskReq *r = opaque;
> + SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
> + return blk_aio_pwritev(s->qdev.conf.blk, offset, iov, 0, cb, cb_opaque);
Are we ever going to want to pass flags (such as BDRV_REQ_FUA) on to
blk_aio_pwritev(), which would imply a flags argument to
scsi_dma_writev()? But it doesn't have to happen now, so it's not
holding up my review.
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
