From: Paolo Bonzini <pbonzini@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qcow2: Simplify calculation for COW area at the end
Date: Tue, 12 Jun 2012 16:00:45 +0200 [thread overview]
Message-ID: <4FD74B8D.9090800@redhat.com> (raw)
In-Reply-To: <1339508835-15108-1-git-send-email-kwolf@redhat.com>
Il 12/06/2012 15:47, Kevin Wolf ha scritto:
> copy_sectors() always uses the sum (cluster_offset + n_start) or
> (start_sect + n_start), so if some value is added to both cluster_offset
> and start_sect, and subtracted from n_start, it's cancelled out anyway.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/qcow2-cluster.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index 9aee9fc..763b724 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -640,11 +640,10 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
> }
>
> if (m->nb_available & (s->cluster_sectors - 1)) {
> - uint64_t end = m->nb_available & ~(uint64_t)(s->cluster_sectors - 1);
> cow = true;
> qemu_co_mutex_unlock(&s->lock);
> - ret = copy_sectors(bs, start_sect + end, cluster_offset + (end << 9),
> - m->nb_available - end, s->cluster_sectors);
> + ret = copy_sectors(bs, start_sect, cluster_offset,
> + m->nb_available, s->cluster_sectors);
Do you need to add end to s->cluster_sectors too, so that "start_sect +
n_end" and "n_end - n_start" remain the same?
Paolo
next prev parent reply other threads:[~2012-06-12 14:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 13:47 [Qemu-devel] [PATCH] qcow2: Simplify calculation for COW area at the end Kevin Wolf
2012-06-12 14:00 ` Paolo Bonzini [this message]
2012-06-12 14:21 ` Kevin Wolf
2012-06-12 14:31 ` Paolo Bonzini
2012-06-12 14:37 ` Kevin Wolf
2012-06-12 14:39 ` Paolo Bonzini
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=4FD74B8D.9090800@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.