From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNlQh-0005zW-Ry for qemu-devel@nongnu.org; Thu, 14 Jul 2016 14:32:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNlQg-0004jO-Rv for qemu-devel@nongnu.org; Thu, 14 Jul 2016 14:32:11 -0400 References: <1468515565-81313-1-git-send-email-vsementsov@virtuozzo.com> From: Eric Blake Message-ID: <5787DAA3.3020005@redhat.com> Date: Thu, 14 Jul 2016 12:32:03 -0600 MIME-Version: 1.0 In-Reply-To: <1468515565-81313-1-git-send-email-vsementsov@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qiUbvMcrpwBwn5wsM91kNqJCg3QhuE8DX" Subject: Re: [Qemu-devel] [PATCH v2] qcow2: do not allocate extra memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: mreitz@redhat.com, kwolf@redhat.com, stefanha@redhat.com, den@openvz.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qiUbvMcrpwBwn5wsM91kNqJCg3QhuE8DX From: Eric Blake To: Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: mreitz@redhat.com, kwolf@redhat.com, stefanha@redhat.com, den@openvz.org Message-ID: <5787DAA3.3020005@redhat.com> Subject: Re: [PATCH v2] qcow2: do not allocate extra memory References: <1468515565-81313-1-git-send-email-vsementsov@virtuozzo.com> In-Reply-To: <1468515565-81313-1-git-send-email-vsementsov@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/14/2016 10:59 AM, Vladimir Sementsov-Ogievskiy wrote: > There are no needs to allocate more than one cluster, as we set > avail_out for deflate to one cluster. >=20 > Zlib docs (http://www.zlib.net/manual.html) says: > "deflate compresses as much data as possible, and stops when the input > buffer becomes empty or the output buffer becomes full." >=20 > So, deflate will not write more than avail_out to output buffer. If > there is no enough space in output buffer for compressed data (it may b= e s/no/not/ > larger than input data) deflate just returns Z_OK. (if all data is > compressed and written to output buffer deflate returns Z_STREAM_END). >=20 > Signed-off-by: Vladimir Sementsov-Ogievskiy > --- Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --qiUbvMcrpwBwn5wsM91kNqJCg3QhuE8DX 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/ iQEcBAEBCAAGBQJXh9qjAAoJEKeha0olJ0Nq9hkIAIzAr0wKtCcKbmEf+XcFpGBU MGcO5hfZRBPCqrod4cj4OCoPMIBuj4zv8Z+F9f6vfVs4tpm0S07AQbCi2C20fSp+ g0gK4D90fWckdCsF7Jdg2z932Wgn7g4BIeNk4/uzzF2NiIdZkAfH0OZnUUatHNsT KPjgzActASuuq3W+u5vvDUmBWuVOWfg/PSJqG49VwSqTz5z+zZQU0pVzLYH/1hCQ mwEv8mYCOfM2mRgLYSrKBICgoCz78s5+PN0KEcKX8VpdvfsPyOZtTEluWazWCofM 6sREx9p6+EZo2cpQmEXoy9Z0hUahPr2BffhP+soiXhm88zjeT37Z3n+M36XHyNg= =pIAZ -----END PGP SIGNATURE----- --qiUbvMcrpwBwn5wsM91kNqJCg3QhuE8DX--