From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL9uv-0005Ye-Vl for qemu-devel@nongnu.org; Mon, 18 Jan 2016 08:32:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL9uv-0001Lp-3i for qemu-devel@nongnu.org; Mon, 18 Jan 2016 08:32:21 -0500 Date: Mon, 18 Jan 2016 14:32:13 +0100 From: Kevin Wolf Message-ID: <20160118133213.GA4558@noname.redhat.com> References: <1452674261-27904-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452674261-27904-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qemu-img: Speed up comparing empty/zero images List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org 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 Thanks, applied to the block branch. Kevin