aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-04-22 17:58:34 +0300
committerKevin Wolf <kwolf@redhat.com>2019-04-30 15:29:00 +0200
commita4072543ccdddbd241d5962d9237b8b41fd006bf (patch)
treea76d30219d91ce22dcdfed51dbfede7b485d7141 /block
parent696e8cb292074c28ced30b4a11d51dc8b3087db4 (diff)
downloadqemu-a4072543ccdddbd241d5962d9237b8b41fd006bf.zip
qemu-a4072543ccdddbd241d5962d9237b8b41fd006bf.tar.gz
qemu-a4072543ccdddbd241d5962d9237b8b41fd006bf.tar.bz2
block/parallels: use buffer-based io
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/parallels.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/block/parallels.c b/block/parallels.c
index 15bc97b..2747400 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -220,20 +220,18 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
if (bs->backing) {
int64_t nb_cow_sectors = to_allocate * s->tracks;
int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS;
- QEMUIOVector qiov =
- QEMU_IOVEC_INIT_BUF(qiov, qemu_blockalign(bs, nb_cow_bytes),
- nb_cow_bytes);
+ void *buf = qemu_blockalign(bs, nb_cow_bytes);
- ret = bdrv_co_preadv(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE,
- nb_cow_bytes, &qiov, 0);
+ ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE,
+ nb_cow_bytes, buf, 0);
if (ret < 0) {
- qemu_vfree(qemu_iovec_buf(&qiov));
+ qemu_vfree(buf);
return ret;
}
ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE,
- nb_cow_bytes, &qiov, 0);
- qemu_vfree(qemu_iovec_buf(&qiov));
+ nb_cow_bytes, buf, 0);
+ qemu_vfree(buf);
if (ret < 0) {
return ret;
}