[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/27] block/qcow: use buffer-based io
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 18/27] block/qcow: use buffer-based io |
Date: |
Tue, 30 Apr 2019 17:42:35 +0200 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Stefano Garzarella <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/block/qcow.c b/block/qcow.c
index 10d2cf14b3..1bb8fd05e2 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -631,7 +631,6 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState
*bs, uint64_t offset,
int offset_in_cluster;
int ret = 0, n;
uint64_t cluster_offset;
- QEMUIOVector hd_qiov;
uint8_t *buf;
void *orig_buf;
@@ -663,11 +662,10 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState
*bs, uint64_t offset,
if (!cluster_offset) {
if (bs->backing) {
/* read from the base image */
- qemu_iovec_init_buf(&hd_qiov, buf, n);
qemu_co_mutex_unlock(&s->lock);
/* qcow2 emits this on bs->file instead of bs->backing */
BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING_AIO);
- ret = bdrv_co_preadv(bs->backing, offset, n, &hd_qiov, 0);
+ ret = bdrv_co_pread(bs->backing, offset, n, buf, 0);
qemu_co_mutex_lock(&s->lock);
if (ret < 0) {
break;
@@ -688,11 +686,10 @@ static coroutine_fn int qcow_co_preadv(BlockDriverState
*bs, uint64_t offset,
ret = -EIO;
break;
}
- qemu_iovec_init_buf(&hd_qiov, buf, n);
qemu_co_mutex_unlock(&s->lock);
BLKDBG_EVENT(bs->file, BLKDBG_READ_AIO);
- ret = bdrv_co_preadv(bs->file, cluster_offset + offset_in_cluster,
- n, &hd_qiov, 0);
+ ret = bdrv_co_pread(bs->file, cluster_offset + offset_in_cluster,
+ n, buf, 0);
qemu_co_mutex_lock(&s->lock);
if (ret < 0) {
break;
@@ -731,7 +728,6 @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState
*bs, uint64_t offset,
int offset_in_cluster;
uint64_t cluster_offset;
int ret = 0, n;
- QEMUIOVector hd_qiov;
uint8_t *buf;
void *orig_buf;
@@ -776,11 +772,10 @@ static coroutine_fn int qcow_co_pwritev(BlockDriverState
*bs, uint64_t offset,
}
}
- qemu_iovec_init_buf(&hd_qiov, buf, n);
qemu_co_mutex_unlock(&s->lock);
BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
- ret = bdrv_co_pwritev(bs->file, cluster_offset + offset_in_cluster,
- n, &hd_qiov, 0);
+ ret = bdrv_co_pwrite(bs->file, cluster_offset + offset_in_cluster,
+ n, buf, 0);
qemu_co_mutex_lock(&s->lock);
if (ret < 0) {
break;
@@ -1056,7 +1051,6 @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t
offset,
uint64_t bytes, QEMUIOVector *qiov)
{
BDRVQcowState *s = bs->opaque;
- QEMUIOVector hd_qiov;
z_stream strm;
int ret, out_len;
uint8_t *buf, *out_buf;
@@ -1122,9 +1116,8 @@ qcow_co_pwritev_compressed(BlockDriverState *bs, uint64_t
offset,
}
cluster_offset &= s->cluster_offset_mask;
- qemu_iovec_init_buf(&hd_qiov, out_buf, out_len);
BLKDBG_EVENT(bs->file, BLKDBG_WRITE_COMPRESSED);
- ret = bdrv_co_pwritev(bs->file, cluster_offset, out_len, &hd_qiov, 0);
+ ret = bdrv_co_pwrite(bs->file, cluster_offset, out_len, out_buf, 0);
if (ret < 0) {
goto fail;
}
--
2.20.1
- [Qemu-devel] [PULL 15/27] qcow2: Fix error handling in the compression code, (continued)
- [Qemu-devel] [PULL 15/27] qcow2: Fix error handling in the compression code, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 13/27] qemu-img: Make create hint at protocol options, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 11/27] qcow2: Fix full preallocation with external data file, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 09/27] qcow2: Avoid COW during metadata preallocation, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 04/27] vmdk: Set vmdk parent backing_format to vmdk, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 03/27] vpc: unlock Coroutine lock to make IO submit Concurrently, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 14/27] qcow2: Fix qcow2_make_empty() with external data file, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 20/27] block/parallels: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 16/27] block: introduce byte-based io helpers, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 21/27] block/backup: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 18/27] block/qcow: use buffer-based io,
Kevin Wolf <=
- [Qemu-devel] [PULL 22/27] block/commit: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 17/27] block/qcow2: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 25/27] commit: Make base read-only if there is an early failure, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 19/27] block/qed: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 08/27] qemu-img: Saner printing of large file sizes, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 23/27] block/stream: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 24/27] qemu-img: use buffer-based io, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 01/27] tests/qemu-iotests: Fix output of qemu-io related tests, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 26/27] iotests: Check that images are in read-only mode after block-commit, Kevin Wolf, 2019/04/30
- [Qemu-devel] [PULL 27/27] block/qed: add missed coroutine_fn markers, Kevin Wolf, 2019/04/30