From: Kevin Wolf <kwolf@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Speed up comparing empty/zero images
Date: Mon, 18 Jan 2016 14:32:13 +0100 [thread overview]
Message-ID: <20160118133213.GA4558@noname.redhat.com> (raw)
In-Reply-To: <1452674261-27904-1-git-send-email-famz@redhat.com>
Am 13.01.2016 um 09:37 hat Fam Zheng geschrieben:
> Two empty raw files are always compared by actually reading data even if
> there is no data, because BDRV_BLOCK_ZERO is considered "allocated" in
> bdrv_is_allocated_above(). That is inefficient.
>
> Use bdrv_get_block_status_above() for more information, and skip the
> consecutive zero sectors.
>
> This brings a huge speed up in comparing sparse/empty raw images:
>
> $ qemu-img create a 1G
>
> $ time ~/build/master/bin/qemu-img compare a a
> Images are identical.
>
> real 0m6.583s
> user 0m0.191s
> sys 0m6.367s
>
> $ time qemu-img compare a a
> Images are identical.
>
> real 0m0.033s
> user 0m0.003s
> sys 0m0.031s
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
Thanks, applied to the block branch.
Kevin
prev parent reply other threads:[~2016-01-18 13:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 8:37 [Qemu-devel] [PATCH] qemu-img: Speed up comparing empty/zero images Fam Zheng
2016-01-13 12:29 ` Paolo Bonzini
2016-01-18 13:32 ` Kevin Wolf [this message]
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=20160118133213.GA4558@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=qemu-block@nongnu.org \
--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 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).