From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2L8u-00078R-0W for qemu-devel@nongnu.org; Mon, 16 May 2016 12:13:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2L8p-0006h9-FT for qemu-devel@nongnu.org; Mon, 16 May 2016 12:13:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2L8o-0006h0-VS for qemu-devel@nongnu.org; Mon, 16 May 2016 12:13:11 -0400 References: <1463227273-27523-1-git-send-email-den@openvz.org> <1463227273-27523-3-git-send-email-den@openvz.org> From: Eric Blake Message-ID: <5739F195.5010102@redhat.com> Date: Mon, 16 May 2016 10:13:09 -0600 MIME-Version: 1.0 In-Reply-To: <1463227273-27523-3-git-send-email-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="am5vXCqxLs6fuOxVMrEpp26efJ0QCLCub" Subject: Re: [Qemu-devel] [PATCH 2/6] block: split write_zeroes always List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , qemu-devel@nongnu.org Cc: Kevin Wolf This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --am5vXCqxLs6fuOxVMrEpp26efJ0QCLCub Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/14/2016 06:01 AM, Denis V. Lunev wrote: > We should split requests even if they are less than write_zeroes_alignm= ent. > For example we can have the following request: > offset 62k > size 4k > write_zeroes_alignment 64k > Original code will send 1 request covering 2 qcow2 clusters. One cluste= r > could be zeroed as a whole, another could not be. In this case we will = have > both 2 clusters allocated. >=20 > After the patch 2 requests to qcow2 layer will be sent and thus only on= e > cluster will be allocated. Grammar suggestion: The original code sent 1 request covering 2 qcow2 clusters, and resulted in both clusters being allocated. But by splitting the request, we can cater to the case where one of the two clusters can be zeroed as a whole, for only 1 cluster allocated after the operation. >=20 > Signed-off-by: Denis V. Lunev > CC: Kevin Wolf > --- > block/io.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > num -=3D sector_num % bs->bl.write_zeroes_alignment; > - } else if ((sector_num + num) % bs->bl.write_zeroes_alignm= ent !=3D 0) { > + } else if (num > bs->bl.write_zeroes_alignment && > + (sector_num + num) % bs->bl.write_zeroes_alignment= !=3D 0) { Alignment looks off. Also, if it were me, I'd write 'a % b' rather than 'a % b !=3D 0'. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --am5vXCqxLs6fuOxVMrEpp26efJ0QCLCub Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXOfGVAAoJEKeha0olJ0NqfqIH/A1OQj7IG3zS7BMQnFZMBBgZ +ZAG+cbaOapZN68KgLMsEMwjlMYYTNjKnsUy+wppcUv4pW6JX1PFQ2I/vbnlHVml cxZyiro2HfYjNW+4C61fpmGnnQGftO33hl0YEb6NCDnmSec4sAcsNu4jDM46IsO0 +2tiw4MzB0IoJwe8X3qIWfE1f8iP3LhJ+WXna71joPrA/cKzh9aw5i8mDpBwSIeq F69OKTpGgfXE+wt7EAfDqNDuuUgRVyJAvoS0vCfXbuUDROqDPAFuzCgDpUDvEeIO 67g4NC9JGvkuVhkw/Xz6HPXXM9FPaqPaR/I57VYsBFDnBEjJ0QQgCJzLmjaeHFI= =4Bi2 -----END PGP SIGNATURE----- --am5vXCqxLs6fuOxVMrEpp26efJ0QCLCub--