qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/7] scsi-disk: introduce dma_readv and dma_writ


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 4/7] scsi-disk: introduce dma_readv and dma_writev
Date: Mon, 23 May 2016 10:09:41 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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 <address@hidden>
> ---
>  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 <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]