Skip to content
Snippets Groups Projects
Commit a4072543 authored by Vladimir Sementsov-Ogievskiy's avatar Vladimir Sementsov-Ogievskiy Committed by Kevin Wolf
Browse files

block/parallels: use buffer-based io


Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 696e8cb2
No related branches found
No related tags found
No related merge requests found
...@@ -220,20 +220,18 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, ...@@ -220,20 +220,18 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
if (bs->backing) { if (bs->backing) {
int64_t nb_cow_sectors = to_allocate * s->tracks; int64_t nb_cow_sectors = to_allocate * s->tracks;
int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS; int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS;
QEMUIOVector qiov = void *buf = qemu_blockalign(bs, nb_cow_bytes);
QEMU_IOVEC_INIT_BUF(qiov, qemu_blockalign(bs, nb_cow_bytes),
nb_cow_bytes);
ret = bdrv_co_preadv(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE,
nb_cow_bytes, &qiov, 0); nb_cow_bytes, buf, 0);
if (ret < 0) { if (ret < 0) {
qemu_vfree(qemu_iovec_buf(&qiov)); qemu_vfree(buf);
return ret; return ret;
} }
ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE, ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE,
nb_cow_bytes, &qiov, 0); nb_cow_bytes, buf, 0);
qemu_vfree(qemu_iovec_buf(&qiov)); qemu_vfree(buf);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment