From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnw3g-00013P-MY for qemu-devel@nongnu.org; Mon, 10 Nov 2014 15:59:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xnw3b-00029n-OJ for qemu-devel@nongnu.org; Mon, 10 Nov 2014 15:59:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnw3b-00029c-Fg for qemu-devel@nongnu.org; Mon, 10 Nov 2014 15:59:27 -0500 Message-ID: <54612727.6030900@redhat.com> Date: Mon, 10 Nov 2014 13:59:19 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415627159-15941-1-git-send-email-mreitz@redhat.com> <1415627159-15941-4-git-send-email-mreitz@redhat.com> In-Reply-To: <1415627159-15941-4-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DArUWLXo4DhLtK4mSwjqLwICKf2LkMHgS" Subject: Re: [Qemu-devel] [PATCH 03/21] qcow2: Use 64 bits for refcount values 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) --DArUWLXo4DhLtK4mSwjqLwICKf2LkMHgS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/10/2014 06:45 AM, Max Reitz wrote: > Refcounts may have a width of up to 64 bit, so qemu should use the same= s/bit/bits/ > width to represent refcount values internally. >=20 > Signed-off-by: Max Reitz > --- > block/qcow2-cluster.c | 9 ++++++--- > block/qcow2-refcount.c | 37 ++++++++++++++++++++----------------- > block/qcow2.h | 7 ++++--- > 3 files changed, 30 insertions(+), 23 deletions(-) >=20 > diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c > index df0b2c9..ab43902 100644 > --- a/block/qcow2-cluster.c > +++ b/block/qcow2-cluster.c > @@ -1640,7 +1640,7 @@ static int expand_zero_clusters_in_l1(BlockDriver= State *bs, uint64_t *l1_table, > for (i =3D 0; i < l1_size; i++) { > uint64_t l2_offset =3D l1_table[i] & L1E_OFFSET_MASK; > bool l2_dirty =3D false; > - int l2_refcount; > + int64_t l2_refcount; You may want to mention in the commit message that you choose a signed type to allow negative for errors, and therefore we really allow only up to 63 useful bits. Or even mention that this is okay because no one can feasibly generate an image with more than 2^63 refs to the same cluster (there isn't that much storage or time to do such a task in our lifetime...) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DArUWLXo4DhLtK4mSwjqLwICKf2LkMHgS 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 iQEcBAEBCAAGBQJUYScnAAoJEKeha0olJ0Nq3QQH/iFfGTmtihtYjjxVegZJR/XL gglaCg5W/5VVzDTcSt9PASj/tklkexjFo1Xpy5VFB4ts2jl6bNBzi9qZxCKKU426 GPySn1824xuW431KDAG7wKqiRuvoKKFnvrBH7T5QDKZM/IJZlDALsivrD6xbSt2U yNC64fh5QAG1T/FzRgNr5QjP6fDFeAYVW7Gp2aBt6gpkTrXUaDEgsA65i8qEEUqw YSz01RZpI0Ejzd/Fks9Wsap72ptS+duRIhdL40WMHaBE5l6Io5QCN+EbkKAPMxWI AD0l/5vHr7k2nUkUzDZX1mxJNqsW+JWM9iulCUM3CRHxjv8IPrwFZmoEfjg0gAo= =hEkp -----END PGP SIGNATURE----- --DArUWLXo4DhLtK4mSwjqLwICKf2LkMHgS--