From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdPGu-000330-76 for qemu-devel@nongnu.org; Wed, 21 Dec 2011 11:44:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RdPGp-0002LH-LI for qemu-devel@nongnu.org; Wed, 21 Dec 2011 11:44:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RdPGp-0002L6-9S for qemu-devel@nongnu.org; Wed, 21 Dec 2011 11:43:59 -0500 Message-ID: <4EF20CCB.4060306@redhat.com> Date: Wed, 21 Dec 2011 09:43:55 -0700 From: Eric Blake MIME-Version: 1.0 References: <1324483240-31726-1-git-send-email-stefanha@linux.vnet.ibm.com> <1324483240-31726-2-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1324483240-31726-2-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig29D295607CF29BBFCE70E31B" Subject: Re: [Qemu-devel] [PATCH v3 1/6] cutils: extract buffer_is_zero() from qemu-img.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Marcelo Tosatti , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig29D295607CF29BBFCE70E31B Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/21/2011 09:00 AM, Stefan Hajnoczi wrote: > The qemu-img.c:is_not_zero() function checks if a buffer contains all > zeroes. This function will come in handy for zero-detection in the > block layer, so clean it up and move it to cutils.c. >=20 > Note that the function now returns true if the buffer is all zeroes. > This avoids the double-negatives (i.e. !is_not_zero()) that the old > function can cause in callers. Are there plans to improve the efficiency of buffer_is_zero to take advantage of metadata about sparseness? That is, there are cases where we can use metadata to prove a region of a file is sparse, without having to read every byte within that region. Now that this series is giving QED special metadata that marks a zero cluster, it is faster to query if that metadata exists denoting a zero cluster than it is to read the entire cluster and check for non-zero. Likewise, with regular files, the kernel provides lseek(SEEK_HOLE) (or the older, lower-level, ioctl(FS_IOC_FIEMAP)); which at least GNU coreutils is using for efficient sparse detection in source files. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig29D295607CF29BBFCE70E31B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJO8gzLAAoJEKeha0olJ0NqdT0IAJmzUN40CmxpMGiZNHD2kXJL SbiQOOemjsaAffqFV5E4FCiBUrh0uWB8e3jX2NVebi05CFmasoQ8yPfqUaO2NNgy QZ1ERHJtRN/vKNORdji7u1zdfqGbgerx5wcbVXbBBgV0wRNGuJsz3jdNc94f4zZ8 7veLGJ9AWnClfAOtqDI6Gv2YqVRXiXevp6Wui0T0MHVqYWuDBu06gIX+ncVfz5KM UcJVGB9RrTXGH/lLjJhCOgLxNSbQuPYcAwykuKwYpLid/y0Ysn6y12clY2LooXsT SYawTCrKzYrtgyfDoPElmA1Nk411QpOJDjfb0HxqH+vkE2Ni9t4j/w5ddVxaZ4w= =lssb -----END PGP SIGNATURE----- --------------enig29D295607CF29BBFCE70E31B--