From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnwG4-0004Iv-2m for qemu-devel@nongnu.org; Mon, 10 Nov 2014 16:12:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnwFz-0007U3-4h for qemu-devel@nongnu.org; Mon, 10 Nov 2014 16:12:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnwFy-0007T2-R3 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 16:12:15 -0500 Message-ID: <54612A27.7000801@redhat.com> Date: Mon, 10 Nov 2014 14:12:07 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415627159-15941-1-git-send-email-mreitz@redhat.com> <1415627159-15941-6-git-send-email-mreitz@redhat.com> In-Reply-To: <1415627159-15941-6-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qK020bWNR4trxtohbajAWIqAMCb2PuHlq" Subject: Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qK020bWNR4trxtohbajAWIqAMCb2PuHlq Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/10/2014 06:45 AM, Max Reitz wrote: > qcow2_alloc_bytes() may reuse a cluster multiple times, in which case > the refcount is increased accordingly. However, if this would lead to a= n > overflow the function should instead just not reuse this cluster and > allocate a new one. So if recount_order is 1 (2 bits per refcount, max refcount of 4), and we encounter the same cluster 6 times (say by 5 back-to-back internal snapshots), does this code optimize to only 2 clusters (both with refcount 3) or does it result in each of the last 3 clusters spilling to its own 1-ref cluster for a total of 4 clusters? Short of Benoit's work on deduplication, is there even a way to avoid inefficient use of spilled clusters? But I guess answering that can be a separate patch; inefficiency is annoying, but not technically wrong and therefore not a reason to reject this one. >=20 > Signed-off-by: Max Reitz > --- > block/qcow2-refcount.c | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --qK020bWNR4trxtohbajAWIqAMCb2PuHlq 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUYSonAAoJEKeha0olJ0NqPbIIAKSWzExAO2xb/5z9WToGPqap 0cEEE377nZlOMhmsGV2dJwuvPkbZIFr0+bFqcb7e0CeDe3v2nweE6mTik4nZqUVB c8l0xcYq4iXYfowlsPRbLrkmMpgYWjst1cj7FwDnWfluCH0mFt4GmqAAJLV3OxZO 6joA5/G/uTxelTn43eF02nIXPcR+ZKkUgM86g1HrnhAEDyHekjkebLt7xCRZU87i 2hAo1r2WDClwQAWb/bTgUkilQunUwQFj5uV6AfPH35khAUvFEFRIbKcE0jjhawrd +O76DB8SlI8fQ7W8lr5XPqEeeUR9/T0hIWSNxMD6r9wrPGm85xLMxY99mqKZEno= =LFoj -----END PGP SIGNATURE----- --qK020bWNR4trxtohbajAWIqAMCb2PuHlq--