From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxJgo-0002lU-Hw for qemu-devel@nongnu.org; Wed, 27 Sep 2017 17:16:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxJgn-0006gz-MT for qemu-devel@nongnu.org; Wed, 27 Sep 2017 17:16:18 -0400 References: <20170913160333.23622-1-eblake@redhat.com> <20170913160333.23622-16-eblake@redhat.com> From: John Snow Message-ID: <88ce047a-c351-6b5b-4dac-3cc6fb07f02e@redhat.com> Date: Wed, 27 Sep 2017 17:16:09 -0400 MIME-Version: 1.0 In-Reply-To: <20170913160333.23622-16-eblake@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 15/23] qemu-img: Add find_nonzero() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: kwolf@redhat.com, famz@redhat.com, qemu-block@nongnu.org, Max Reitz On 09/13/2017 12:03 PM, Eric Blake wrote: > During 'qemu-img compare', when we are checking that an allocated > portion of one file is all zeros, we don't need to waste time > computing how many additional sectors after the first non-zero > byte are also non-zero. Create a new helper find_nonzero() to do > the check for a first non-zero sector, and rebase > check_empty_sectors() to use it. > > The new interface intentionally uses bytes in its interface, even > though it still crawls the buffer a sector at a time; it is robust > to a partial sector at the end of the buffer. > > Signed-off-by: Eric Blake Reviewed-by: John Snow