Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] win32-aio: Fix vectored reads

2013-01-17 Thread Kevin Wolf
Am 17.01.2013 09:33, schrieb Michael Tokarev:
> 17.01.2013 00:19, Kevin Wolf пишет:
>> Copying data in the right direction really helps a lot!
>>
>> Cc: qemu-sta...@nongnu.org
>> Signed-off-by: Kevin Wolf 
>> ---
>>   block/win32-aio.c |2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/block/win32-aio.c b/block/win32-aio.c
>> index 46a5db7..53b82e6 100644
>> --- a/block/win32-aio.c
>> +++ b/block/win32-aio.c
>> @@ -84,7 +84,7 @@ static void win32_aio_process_completion(QEMUWin32AIOState 
>> *s,
>>   int i;
>>
>>   for (i = 0; i < qiov->niov; ++i) {
>> -memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len);
>> +memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
>>   p += qiov->iov[i].iov_len;
>>   }
>>   g_free(waiocb->buf);
> 
> Actually this is just
> 
> iov_from_buf(qiov->iov, qiov->niov, 0, waiocb->buf, -1);

True. Let's keep fix and cleanup separate, though. Feel free to send a
cleanup patch on top of this.

By the way, I think qiov->size instead of -1 would be nicer.

> Or is it iov_to_buf() ? :)

The corrected version is from.

Kevin



Re: [Qemu-devel] [Qemu-stable] [PATCH 1/2] win32-aio: Fix vectored reads

2013-01-17 Thread Michael Tokarev

17.01.2013 00:19, Kevin Wolf пишет:

Copying data in the right direction really helps a lot!

Cc: qemu-sta...@nongnu.org
Signed-off-by: Kevin Wolf 
---
  block/win32-aio.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block/win32-aio.c b/block/win32-aio.c
index 46a5db7..53b82e6 100644
--- a/block/win32-aio.c
+++ b/block/win32-aio.c
@@ -84,7 +84,7 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s,
  int i;

  for (i = 0; i < qiov->niov; ++i) {
-memcpy(p, qiov->iov[i].iov_base, qiov->iov[i].iov_len);
+memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
  p += qiov->iov[i].iov_len;
  }
  g_free(waiocb->buf);


Actually this is just

   iov_from_buf(qiov->iov, qiov->niov, 0, waiocb->buf, -1);

Or is it iov_to_buf() ? :)

Thanks,

/mjt