From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpguT-0001Zy-Az for qemu-devel@nongnu.org; Sat, 15 Nov 2014 12:13:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpguN-0001HZ-Ta for qemu-devel@nongnu.org; Sat, 15 Nov 2014 12:13:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpguN-0001HV-M9 for qemu-devel@nongnu.org; Sat, 15 Nov 2014 12:13:11 -0500 Message-ID: <546789A0.6060907@redhat.com> Date: Sat, 15 Nov 2014 10:13:04 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415970374-16811-1-git-send-email-mreitz@redhat.com> <1415970374-16811-11-git-send-email-mreitz@redhat.com> In-Reply-To: <1415970374-16811-11-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3dWJg55CQg7vCfHkLCJI7aiq4OkrXuvVK" Subject: Re: [Qemu-devel] [PATCH v2 10/21] qcow2: refcount_order parameter for qcow2_create2 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) --3dWJg55CQg7vCfHkLCJI7aiq4OkrXuvVK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/14/2014 06:06 AM, Max Reitz wrote: > Add a refcount_order parameter to qcow2_create2(), use that value for > the image header and for calculating the size required for > preallocation. >=20 > For now, always pass 4. >=20 > Signed-off-by: Max Reitz > --- > block/qcow2.c | 41 ++++++++++++++++++++++++++++++----------- > 1 file changed, 30 insertions(+), 11 deletions(-) >=20 > @@ -1811,6 +1811,13 @@ static int qcow2_create2(const char *filename, i= nt64_t total_size, > int64_t meta_size =3D 0; > uint64_t nreftablee, nrefblocke, nl1e, nl2e; > int64_t aligned_total_size =3D align_offset(total_size, cluste= r_size); > + int refblock_bits, refblock_size; > + /* refcount entry size in bytes */ > + double rces =3D (1 << refcount_order) / 8.; > + Maybe worth a comment that absolute precision is not necessary, and that we are okay that the result gets us to within a fraction of a percent of the right value. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --3dWJg55CQg7vCfHkLCJI7aiq4OkrXuvVK 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 iQEcBAEBCAAGBQJUZ4mgAAoJEKeha0olJ0NqoU0H/20ph/x/1HMel0Jg/d382XTw mIuCle9oXhRarej7eRRRtXUNjhYQekxTLkuOaDGBOb0lYTveslJLnFG+5IUBIipN H9p/FvkMGFiHnWS6wqi9A82EWQQSsB/F4DqnvMbrGZPGpREjQeY6dqhci3D7m8Gn H0ckCpXIy0ArA363Fsw85UjY3an2riA2IM/jtTbr+emQf5GWvsPQPbXhNhvCQ6gx ZrQBKnv2e+o3XfrjCOg0tIpB+JUEnBeU1WI0PrYPwhAeF+jh101OdBHoMvcitCmp 8o+iExmjl0jbYDMOJxXwMqKWHeL5idEpX0IrwHhcI1LVhY9cE6mOedfO9dXT6JA= =DVFm -----END PGP SIGNATURE----- --3dWJg55CQg7vCfHkLCJI7aiq4OkrXuvVK--