qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 05/10] dma-helpers: add dma_buf_read and dma_buf


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 05/10] dma-helpers: add dma_buf_read and dma_buf_write
Date: Thu, 11 Aug 2011 16:24:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 08/11/2011 03:29 PM, Stefan Hajnoczi wrote:
>
>  What do you think about passing the residual bytes for short transfers?
>    Should I look into updating BlockDriverCompletionFunc, or is the approach
>  of patch 2 okay?  If I have an excuse to learn more about Coccinelle, that
>  can be fun.:)
The bdrv_aio_readv() and bdrv_aio_writev() functions don't have the
concept of residual bytes.  They only work on fully completed I/O
operations.  If there is an error they pass -errno.

But if a transfer was split due to failure of cpu_physical_memory_map, and only the second part fails, you can have a short transfer and you need to pass residual bytes back. The only way out of this is to make a bounce buffer as big as all the unmappable parts of the S/G list, which is undesirable of course. So the residual bytes are a general DMA concept, not specific to SCSI.

Therefore I don't think BlockDriverCompletionFunc is the right type
to add residual bytes to.

Right, I would rather update BlockDriverCompletionFunc to pass the AIOCB as a third parameter, and store the residual bytes in the DMAAIOCB (with a getter that the completion function can use).

Paolo



reply via email to

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