On Thu, Aug 11, 2011 at 1:10 PM, Paolo Bonzini <pbonz...@redhat.com> wrote:
> On 08/11/2011 09:58 AM, Stefan Hajnoczi wrote:
>>
>> On Thu, Aug 04, 2011 at 07:14:43PM +0200, Paolo Bonzini wrote:
>>>
>>> These helpers do a full transfer from an in-memory buffer to
>>> target memory, with full support for MMIO areas.  It will be used to
>>> store
>>> the reply of an emulated command into a QEMUSGList provided by the
>>> adapter.
>>>
>>> Signed-off-by: Paolo Bonzini<pbonz...@redhat.com>
>>> ---
>>>  cutils.c      |    8 +++---
>>>  dma-helpers.c |   63
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>  dma.h         |    5 ++++
>>>  3 files changed, 72 insertions(+), 4 deletions(-)
>>
>> I don't understand this patch.  If we have a memory buffer that needs to
>> be transferred to target memory, then there is no need for bounce
>> buffers or cpu_physical_memory_map().
>>
>> Can we use cpu_physical_memory_rw() on each sglist element instead?  No
>> -EAGAIN necessary because the memory buffer already acts as the local
>> bounce buffer.
>
> Doh, you're obviously right.  I don't know what I was thinking. :)
>
> 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.  Therefore I don't
think BlockDriverCompletionFunc is the right type to add residual
bytes to.

It seems that residual bytes are a SCSI layer concept that the block
layer does not deal with.

Stefan

Reply via email to