[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 7/9] qcow2: qcow2_co_preadv: skip using hd_qiov w
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH v3 7/9] qcow2: qcow2_co_preadv: skip using hd_qiov when possible |
Date: |
Tue, 8 Jan 2019 20:06:53 +0300 |
qemu_iovec_memset has @offset parameter, so using hd_qiov for it is not
needed.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/qcow2.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index e650528af7..d6ef606d89 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1887,18 +1887,13 @@ static coroutine_fn int
qcow2_co_preadv(BlockDriverState *bs, uint64_t offset,
goto fail;
}
- offset_in_cluster = offset_into_cluster(s, offset);
-
- qemu_iovec_reset(&hd_qiov);
- qemu_iovec_concat(&hd_qiov, qiov, bytes_done, cur_bytes);
-
if (ret == QCOW2_CLUSTER_ZERO_PLAIN ||
ret == QCOW2_CLUSTER_ZERO_ALLOC ||
(ret == QCOW2_CLUSTER_UNALLOCATED && !bs->backing))
{
/* No sense in releasing the lock */
- qemu_iovec_memset(&hd_qiov, 0, 0, cur_bytes);
+ qemu_iovec_memset(qiov, bytes_done, 0, cur_bytes);
bytes -= cur_bytes;
offset += cur_bytes;
@@ -1906,6 +1901,11 @@ static coroutine_fn int qcow2_co_preadv(BlockDriverState
*bs, uint64_t offset,
continue;
}
+ offset_in_cluster = offset_into_cluster(s, offset);
+
+ qemu_iovec_reset(&hd_qiov);
+ qemu_iovec_concat(&hd_qiov, qiov, bytes_done, cur_bytes);
+
qemu_co_mutex_unlock(&s->lock);
switch (ret) {
--
2.18.0
- [Qemu-devel] [PATCH v3 4/9] qcow2-threads: qcow2_co_do_compress: protect queuing by mutex, (continued)
[Qemu-devel] [PATCH v3 7/9] qcow2: qcow2_co_preadv: skip using hd_qiov when possible,
Vladimir Sementsov-Ogievskiy <=
[Qemu-devel] [PATCH v3 1/9] qcow2.h: add missing include, Vladimir Sementsov-Ogievskiy, 2019/01/08
[Qemu-devel] [PATCH v3 9/9] qcow2: do encryption in threads, Vladimir Sementsov-Ogievskiy, 2019/01/08
Re: [Qemu-devel] [PATCH v3 0/9] qcow2: encryption threads, no-reply, 2019/01/23
[Qemu-devel] ping Re: [PATCH v3 0/9] qcow2: encryption threads, Vladimir Sementsov-Ogievskiy, 2019/01/28