From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoBqi-00071j-Sq for qemu-devel@nongnu.org; Fri, 01 May 2015 10:23:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YoBqe-00045T-Qe for qemu-devel@nongnu.org; Fri, 01 May 2015 10:23:28 -0400 Date: Fri, 1 May 2015 15:23:21 +0100 From: Stefan Hajnoczi Message-ID: <20150501142321.GB2386@stefanha-thinkpad.redhat.com> References: <9b9c36f8c567da1f9561828380e8aa42c08b7efd.1430388393.git.berto@igalia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9zSXsLTf0vkW971A" Content-Disposition: inline In-Reply-To: <9b9c36f8c567da1f9561828380e8aa42c08b7efd.1430388393.git.berto@igalia.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 1/6] qcow2: use one single memory block for the L2/refcount cache tables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, qemu-block@nongnu.org --9zSXsLTf0vkW971A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 30, 2015 at 01:11:40PM +0300, Alberto Garcia wrote: > Qcow2Cache *qcow2_cache_create(BlockDriverState *bs, int num_tables) > { > BDRVQcowState *s =3D bs->opaque; > Qcow2Cache *c; > - int i; > =20 > c =3D g_new0(Qcow2Cache, 1); > c->size =3D num_tables; > + c->table_size =3D s->cluster_size; This assumes c->table_size meets bs' memory alignment requirements. The following would be safer: c->table_size =3D QEMU_ALIGN_UP(c->table_size, bdrv_opt_mem_align(bs->file)= ); --9zSXsLTf0vkW971A Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVQ4xZAAoJEJykq7OBq3PIt3IH/jwEoGfViRDFW82iMZFyvlD3 oX3bU8PFaDDHvR43/g6ISdJ6AwjLkDY1KQCJ5X7XqxODQ1O8ibLQblrdBtsPik7L dzhJ3PMhzsai+G7cv2D7pXBr81iO5vYq2Jt1cu6qKiL94OvN6wQNpYCIbla8MzZ/ kIpBrlWd9q5dpH1YiWem/mHCG7cmaaM7JUwZYmJ+jeINpYyC4doXxADPZB2+oTuo 2pk6f+JFR2E2NAos49USYhOFou094zmY69PIseJwI/G/bAhhMpng5Z+mHbbEVzkS jZuh1YUJHBwmefoouV878Zczivny8bV92B546WePsdNIcegSEhmFG2oJIqOEK38= =2nny -----END PGP SIGNATURE----- --9zSXsLTf0vkW971A--