[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/27] qemu-img: use qemu_iovec_init_buf
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 12/27] qemu-img: use qemu_iovec_init_buf |
Date: |
Fri, 22 Feb 2019 14:07:41 +0000 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Use new qemu_iovec_init_buf() instead of
qemu_iovec_init_external( ... , 1), which simplifies the code.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Message-Id: <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qemu-img.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 25288c4d18..7853935049 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1670,7 +1670,6 @@ static int coroutine_fn convert_co_read(ImgConvertState
*s, int64_t sector_num,
{
int n, ret;
QEMUIOVector qiov;
- struct iovec iov;
assert(nb_sectors <= s->buf_sectors);
while (nb_sectors > 0) {
@@ -1686,9 +1685,7 @@ static int coroutine_fn convert_co_read(ImgConvertState
*s, int64_t sector_num,
bs_sectors = s->src_sectors[src_cur];
n = MIN(nb_sectors, bs_sectors - (sector_num - src_cur_offset));
- iov.iov_base = buf;
- iov.iov_len = n << BDRV_SECTOR_BITS;
- qemu_iovec_init_external(&qiov, &iov, 1);
+ qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS);
ret = blk_co_preadv(
blk, (sector_num - src_cur_offset) << BDRV_SECTOR_BITS,
@@ -1712,7 +1709,6 @@ static int coroutine_fn convert_co_write(ImgConvertState
*s, int64_t sector_num,
{
int ret;
QEMUIOVector qiov;
- struct iovec iov;
while (nb_sectors > 0) {
int n = nb_sectors;
@@ -1740,9 +1736,7 @@ static int coroutine_fn convert_co_write(ImgConvertState
*s, int64_t sector_num,
(s->compressed &&
!buffer_is_zero(buf, n * BDRV_SECTOR_SIZE)))
{
- iov.iov_base = buf;
- iov.iov_len = n << BDRV_SECTOR_BITS;
- qemu_iovec_init_external(&qiov, &iov, 1);
+ qemu_iovec_init_buf(&qiov, buf, n << BDRV_SECTOR_BITS);
ret = blk_co_pwritev(s->target, sector_num << BDRV_SECTOR_BITS,
n << BDRV_SECTOR_BITS, &qiov, flags);
--
2.20.1
- [Qemu-devel] [PULL 11/27] block/vmdk: use qemu_iovec_init_buf, (continued)
- [Qemu-devel] [PULL 11/27] block/vmdk: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 07/27] block/parallels: use QEMU_IOVEC_INIT_BUF, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 03/27] block/block-backend: use QEMU_IOVEC_INIT_BUF, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 01/27] block: enhance QEMUIOVector structure, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 13/27] migration/block: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 09/27] block/qcow2: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 08/27] block/qcow: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 10/27] block/qed: use qemu_iovec_init_buf, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 14/27] tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 15/27] hw/ide: drop iov field from IDEState, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 12/27] qemu-img: use qemu_iovec_init_buf,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 22/27] virtio-blk: set config size depending on the features enabled, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 16/27] hw/ide: drop iov field from IDEBufferedRequest, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 25/27] tests/virtio-blk: add virtio_blk_fix_dwz_hdr() function, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 18/27] virtio-blk: add acct_failed param to virtio_blk_handle_rw_error(), Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 26/27] tests/virtio-blk: add test for WRITE_ZEROES command, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 17/27] hw/ide: drop iov field from IDEDMA, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 20/27] virtio-blk: add "discard" and "write-zeroes" properties, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 21/27] virtio-net: make VirtIOFeature usable for other virtio devices, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 19/27] virtio-blk: add host_features field in VirtIOBlock, Stefan Hajnoczi, 2019/02/22
- [Qemu-devel] [PULL 23/27] virtio-blk: add DISCARD and WRITE_ZEROES features, Stefan Hajnoczi, 2019/02/22