From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>, Eric Blake <eblake@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Denis V . Lunev" <den@openvz.org>
Subject: Re: [Qemu-devel] [PATCH 3/7] qcow2: Make perform_cow() call do_perform_cow() twice
Date: Fri, 26 May 2017 10:11:29 +0200 [thread overview]
Message-ID: <20170526081129.GA7211@noname.str.redhat.com> (raw)
In-Reply-To: <b3659d971731e5ef832399400a0f14daa580fce4.1495536228.git.berto@igalia.com>
Am 23.05.2017 um 13:22 hat Alberto Garcia geschrieben:
> Instead of calling perform_cow() twice with a different COW region
> each time, call it just once and make perform_cow() handle both
> regions.
>
> This patch simply moves code around. The next one will do the actual
> reordering of the COW operations.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> block/qcow2-cluster.c | 38 +++++++++++++++++++++++---------------
> 1 file changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index 6757875ec9..59a0ffba1a 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -414,6 +414,10 @@ static int coroutine_fn do_perform_cow(BlockDriverState *bs,
> struct iovec iov;
> int ret;
>
> + if (bytes == 0) {
> + return 0;
> + }
> +
> iov.iov_len = bytes;
> iov.iov_base = qemu_try_blockalign(bs, iov.iov_len);
> if (iov.iov_base == NULL) {
> @@ -751,31 +755,40 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs,
> return cluster_offset;
> }
>
> -static int perform_cow(BlockDriverState *bs, QCowL2Meta *m, Qcow2COWRegion *r)
> +static int perform_cow(BlockDriverState *bs, QCowL2Meta *m)
> {
> BDRVQcow2State *s = bs->opaque;
> + Qcow2COWRegion *start = &m->cow_start;
> + Qcow2COWRegion *end = &m->cow_end;
> int ret;
>
> - if (r->nb_bytes == 0) {
> + if (start->nb_bytes == 0 && end->nb_bytes == 0) {
> return 0;
> }
With this change, it can now happen that we call do_perform_cow() with
bytes == 0. Maybe it would be better for do_perform_cow() to check bytes
first so that it doesn't bdrv_co_preadv/pwritev() for 0 bytes?
Kevin
next prev parent reply other threads:[~2017-05-26 8:11 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 11:22 [Qemu-devel] [PATCH 0/7] qcow2: Reduce the number of I/O ops when doing COW Alberto Garcia
2017-05-23 11:22 ` [Qemu-devel] [PATCH 1/7] qcow2: Remove unused Error in do_perform_cow() Alberto Garcia
2017-05-23 20:21 ` Eric Blake
2017-05-24 9:48 ` Alberto Garcia
2017-05-23 11:22 ` [Qemu-devel] [PATCH 2/7] qcow2: Use unsigned int for both members of Qcow2COWRegion Alberto Garcia
2017-05-23 11:22 ` [Qemu-devel] [PATCH 3/7] qcow2: Make perform_cow() call do_perform_cow() twice Alberto Garcia
2017-05-26 8:11 ` Kevin Wolf [this message]
2017-05-26 9:10 ` Alberto Garcia
2017-05-26 10:08 ` Kevin Wolf
2017-05-23 11:22 ` [Qemu-devel] [PATCH 4/7] qcow2: Split do_perform_cow() into _read(), _encrypt() and _write() Alberto Garcia
2017-05-23 11:23 ` [Qemu-devel] [PATCH 5/7] qcow2: Allow reading both COW regions with only one request Alberto Garcia
2017-05-23 11:23 ` [Qemu-devel] [PATCH 6/7] qcow2: Pass a QEMUIOVector to do_perform_cow_{read, write}() Alberto Garcia
2017-05-23 11:23 ` [Qemu-devel] [PATCH 7/7] qcow2: Merge the writing of the COW regions with the guest data Alberto Garcia
[not found] ` <5925B107.1060404@virtuozzo.com>
2017-05-24 16:43 ` Anton Nefedov
2017-05-24 19:05 ` Alberto Garcia
2017-05-26 10:12 ` Kevin Wolf
2017-05-26 14:09 ` Alberto Garcia
2017-05-23 14:36 ` [Qemu-devel] [PATCH 0/7] qcow2: Reduce the number of I/O ops when doing COW Eric Blake
2017-05-24 14:20 ` Alberto Garcia
2017-05-24 16:09 ` Anton Nefedov
2017-05-24 16:20 ` Alberto Garcia
2017-05-24 16:26 ` Anton Nefedov
2017-05-25 11:48 ` Alberto Garcia
2017-05-25 14:35 ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2017-05-26 10:17 ` [Qemu-devel] " Kevin Wolf
2017-05-26 12:47 ` Anton Nefedov
2017-05-26 13:08 ` Alberto Garcia
2017-05-26 13:32 ` Anton Nefedov
2017-05-26 13:38 ` Alberto Garcia
2017-06-07 11:44 ` Alberto Garcia
2017-06-07 11:59 ` Kevin Wolf
2017-06-07 12:13 ` Alberto Garcia
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=20170526081129.GA7211@noname.str.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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).