From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: dgilbert@redhat.com, quintela@redhat.com, jsnow@redhat.com,
den@openvz.org, fam@euphon.net, stefanha@redhat.com,
mreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com
Subject: [Qemu-devel] [PATCH v4 07/17] block/parallels: use QEMU_IOVEC_INIT_BUF
Date: Mon, 18 Feb 2019 17:09:16 +0300 [thread overview]
Message-ID: <20190218140926.333779-8-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20190218140926.333779-1-vsementsov@virtuozzo.com>
Use new QEMU_IOVEC_INIT_BUF() instead of
qemu_iovec_init_external( ... , 1), which simplifies the code.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/parallels.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/block/parallels.c b/block/parallels.c
index cc9445879d..15bc97b759 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -220,23 +220,20 @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
if (bs->backing) {
int64_t nb_cow_sectors = to_allocate * s->tracks;
int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS;
- QEMUIOVector qiov;
- struct iovec iov = {
- .iov_len = nb_cow_bytes,
- .iov_base = qemu_blockalign(bs, nb_cow_bytes)
- };
- qemu_iovec_init_external(&qiov, &iov, 1);
+ QEMUIOVector qiov =
+ 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,
nb_cow_bytes, &qiov, 0);
if (ret < 0) {
- qemu_vfree(iov.iov_base);
+ qemu_vfree(qemu_iovec_buf(&qiov));
return ret;
}
ret = bdrv_co_pwritev(bs->file, s->data_end * BDRV_SECTOR_SIZE,
nb_cow_bytes, &qiov, 0);
- qemu_vfree(iov.iov_base);
+ qemu_vfree(qemu_iovec_buf(&qiov));
if (ret < 0) {
return ret;
}
--
2.18.0
next prev parent reply other threads:[~2019-02-18 14:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 14:09 [Qemu-devel] [PATCH v4 00/17] block: local qiov helper Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 01/17] block: enhance QEMUIOVector structure Vladimir Sementsov-Ogievskiy
2019-02-18 20:19 ` Eric Blake
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 02/17] block/io: use qemu_iovec_init_buf Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 03/17] block/block-backend: use QEMU_IOVEC_INIT_BUF Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 04/17] block/backup: use qemu_iovec_init_buf Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 05/17] block/commit: use QEMU_IOVEC_INIT_BUF Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 06/17] block/stream: " Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` Vladimir Sementsov-Ogievskiy [this message]
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 08/17] block/qcow: use qemu_iovec_init_buf Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 09/17] block/qcow2: " Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 10/17] block/qed: " Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 11/17] block/vmdk: " Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 12/17] qemu-img: " Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 13/17] migration/block: " Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 14/17] tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 15/17] hw/ide: drop iov field from IDEState Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 16/17] hw/ide: drop iov field from IDEBufferedRequest Vladimir Sementsov-Ogievskiy
2019-02-18 14:09 ` [Qemu-devel] [PATCH v4 17/17] hw/ide: drop iov field from IDEDMA Vladimir Sementsov-Ogievskiy
2019-02-20 16:42 ` [Qemu-devel] [PATCH v4 00/17] block: local qiov helper Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190218140926.333779-8-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=den@openvz.org \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).