block/commit: 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>
This commit is contained in:
Vladimir Sementsov-Ogievskiy 2019-04-22 17:58:36 +03:00 committed by Kevin Wolf
parent 607dbdc4e0
commit 08b6261f34

View File

@ -48,16 +48,15 @@ static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base,
void *buf)
{
int ret = 0;
QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes);
assert(bytes < SIZE_MAX);
ret = blk_co_preadv(bs, offset, qiov.size, &qiov, 0);
ret = blk_co_pread(bs, offset, bytes, buf, 0);
if (ret < 0) {
return ret;
}
ret = blk_co_pwritev(base, offset, qiov.size, &qiov, 0);
ret = blk_co_pwrite(base, offset, bytes, buf, 0);
if (ret < 0) {
return ret;
}