[PATCH 1/2] block/parallels: Fix buffer-based write call

Hanna Reitz posted 2 patches 3 years, 6 months ago
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, "Denis V. Lunev" <den@openvz.org>, Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
[PATCH 1/2] block/parallels: Fix buffer-based write call
Posted by Hanna Reitz 3 years, 6 months ago
Commit a4072543ccdddbd241d5962d9237b8b41fd006bf has changed the I/O here
from working on a local one-element I/O vector to just using the buffer
directly (using the bdrv_co_pread()/bdrv_co_pwrite() helper functions
introduced shortly before).

However, it only changed the bdrv_co_preadv() call to bdrv_co_pread() -
the subsequent bdrv_co_pwritev() call stayed this way, and so still
expects a QEMUIOVector pointer instead of a plain buffer.  We must
change that to be a bdrv_co_pwrite() call.

Fixes: a4072543ccdddbd241d5962d ("block/parallels: use buffer-based io")
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
 block/parallels.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/parallels.c b/block/parallels.c
index 8b235b9505..a229c06f25 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -241,8 +241,8 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
             return ret;
         }
 
-        ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE,
-                              nb_cow_bytes, buf, 0);
+        ret = bdrv_co_pwrite(bs->file, s->data_end * BDRV_SECTOR_SIZE,
+                             nb_cow_bytes, buf, 0);
         qemu_vfree(buf);
         if (ret < 0) {
             return ret;
-- 
2.35.3
Re: [PATCH 1/2] block/parallels: Fix buffer-based write call
Posted by Vladimir Sementsov-Ogievskiy 3 years, 6 months ago
On 7/14/22 16:28, Hanna Reitz wrote:
> Commit a4072543ccdddbd241d5962d9237b8b41fd006bf has changed the I/O here
> from working on a local one-element I/O vector to just using the buffer
> directly (using the bdrv_co_pread()/bdrv_co_pwrite() helper functions
> introduced shortly before).
> 
> However, it only changed the bdrv_co_preadv() call to bdrv_co_pread() -
> the subsequent bdrv_co_pwritev() call stayed this way, and so still
> expects a QEMUIOVector pointer instead of a plain buffer.  We must
> change that to be a bdrv_co_pwrite() call.
> 
> Fixes: a4072543ccdddbd241d5962d ("block/parallels: use buffer-based io")
> Signed-off-by: Hanna Reitz<hreitz@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

-- 
Best regards,
Vladimir
Re: [PATCH 1/2] block/parallels: Fix buffer-based write call
Posted by Denis V. Lunev 3 years, 6 months ago
On 14.07.2022 15:28, Hanna Reitz wrote:
> Commit a4072543ccdddbd241d5962d9237b8b41fd006bf has changed the I/O here
> from working on a local one-element I/O vector to just using the buffer
> directly (using the bdrv_co_pread()/bdrv_co_pwrite() helper functions
> introduced shortly before).
>
> However, it only changed the bdrv_co_preadv() call to bdrv_co_pread() -
> the subsequent bdrv_co_pwritev() call stayed this way, and so still
> expects a QEMUIOVector pointer instead of a plain buffer.  We must
> change that to be a bdrv_co_pwrite() call.
>
> Fixes: a4072543ccdddbd241d5962d ("block/parallels: use buffer-based io")
> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
> ---
>   block/parallels.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/parallels.c b/block/parallels.c
> index 8b235b9505..a229c06f25 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -241,8 +241,8 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
>               return ret;
>           }
>   
> -        ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE,
> -                              nb_cow_bytes, buf, 0);
> +        ret = bdrv_co_pwrite(bs->file, s->data_end * BDRV_SECTOR_SIZE,
> +                             nb_cow_bytes, buf, 0);
>           qemu_vfree(buf);
>           if (ret < 0) {
>               return ret;
Reviewed-by: Denis V. Lunev <den@openvz.org>