From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvX3z-0000vN-VA for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:46:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvX3y-00056C-KF for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:46:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12651) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvX3y-00055x-CQ for qemu-devel@nongnu.org; Wed, 16 Jan 2013 12:46:10 -0500 Message-ID: <50F6E75D.1050707@redhat.com> Date: Wed, 16 Jan 2013 10:46:05 -0700 From: Eric Blake MIME-Version: 1.0 References: <1358353497-5292-1-git-send-email-benoit@irqsave.net> <1358353497-5292-21-git-send-email-benoit@irqsave.net> In-Reply-To: <1358353497-5292-21-git-send-email-benoit@irqsave.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2NWLHHCDVEMDBSPQCBRKJ" Subject: Re: [Qemu-devel] [RFC V5 20/36] qcow2: Drop hash for a given cluster when dedup makes refcount > 2^16/2. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2NWLHHCDVEMDBSPQCBRKJ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/16/2013 09:24 AM, Beno=C3=AEt Canet wrote: > A new physical cluster with the same hash value will be used for furthe= r > occurence of this hash. s/occurence/occurrence/ > --- > block/qcow2-dedup.c | 32 ++++++++++++++++++++++++++++++++ > block/qcow2-refcount.c | 3 +++ > block/qcow2.h | 4 ++++ > 3 files changed, 39 insertions(+) >=20 > +++ b/block/qcow2-refcount.c > @@ -489,6 +489,9 @@ int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDr= iverState *bs, > ret =3D -EINVAL; > goto fail; > } > + if (s->has_dedup && deduplication && refcount >=3D 0xFFFF/2) {= > + qcow2_dedup_refcount_half_max_reached(bs, cluster_index); You are hardcoding to a width of 16 bits; however, version 3 makes the refcount field variable-sized: 96 - 99: refcount_order Describes the width of a reference count block entry (width in bits =3D 1 << refcount_order). For version 2 images, the order is always assumed to be 4 (i.e. the width is 16 bits). Hmm, what happens if refcount_order is 0 to disable reference counting? That setting is valid for creating a qcow2 file that can't be used for internal snapshots. But it also interferes with dedup; so you probably want to add some additional requirements in the spec (patch 1/36) that when dedup is in use, refcount_order must be a minimum value (or require that it be exactly 4, for a width of 16 bits). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2NWLHHCDVEMDBSPQCBRKJ 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.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ9uddAAoJEKeha0olJ0NqPYcH/331wQiLN1bOKrzTg1Fo2r9A yeN+mQcZKc9Y95d2EnykiecsAzWwfVz463tUTY9s2LyBXFkHRMuw9cZJ8nwxr/GN 7532g+4oRqEtEX+i8wTFpp+OSMO1mxIspE0eq+RpyOTksdEtF+6vjiETaOcuKAkE cEtbAqPpcNpIr/YgaeQsUVuIzt7CTRKSovJRVeQq9Qqz2Kt4bPb2pEMA2i2XTxKU DGETgj3xrjzovFLNUafLHmjmV/TGcFomeiZhhOW2OOSq0LPLF1HCacM2entBLvPU EimU5AAeMZ6Tlxd+GgetYS/qUGH4rJHq28wedw3NN/4kC1+QUyZa5oAjxr2sewo= =SEj+ -----END PGP SIGNATURE----- ------enig2NWLHHCDVEMDBSPQCBRKJ--