Received: from eggs.gnu.org ([2001:4830:134:3::10]:38084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypa66-00015P-RL for qemu-devel@nongnu.org; Tue, 05 May 2015 06:29:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypa61-0004u0-SS for qemu-devel@nongnu.org; Tue, 05 May 2015 06:29:06 -0400 Date: Tue, 5 May 2015 11:28:58 +0100 From: Stefan Hajnoczi Message-ID: <20150505102858.GC3149@stefanha-thinkpad.redhat.com> References: <9b9c36f8c567da1f9561828380e8aa42c08b7efd.1430388393.git.berto@igalia.com> <20150501142321.GB2386@stefanha-thinkpad.redhat.com> <20150504105813.GD3676@noname.str.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vOmOzSkFvhd7u8Ms" Content-Disposition: inline In-Reply-To: <20150504105813.GD3676@noname.str.redhat.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: Kevin Wolf Cc: qemu-block@nongnu.org, Alberto Garcia , qemu-devel@nongnu.org, Stefan Hajnoczi --vOmOzSkFvhd7u8Ms Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 04, 2015 at 12:58:13PM +0200, Kevin Wolf wrote: > Am 01.05.2015 um 16:23 hat Stefan Hajnoczi geschrieben: > > 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; > >=20 > > This assumes c->table_size meets bs' memory alignment requirements. The > > following would be safer: > >=20 > > c->table_size =3D QEMU_ALIGN_UP(c->table_size, bdrv_opt_mem_align(bs->f= ile)); >=20 > You can't just access more than one cluster. You might be caching data > and later write it back when it's stale. I don't mean I/O alignment, just memory alignment (i.e. the start address of the data buffer in memory). Stefan --vOmOzSkFvhd7u8Ms Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVSJtqAAoJEJykq7OBq3PI3BAH/1w0feRiW00Sr7IoNz0xdgB/ F4D1Cd4h4+MycGvBes06Lz4Hi6IveMXJlj7KUovGFW6nhrfTcKiqcVHLS7D9oUAP op0ifaOecyZUWIQRv+kXjS6tx1J0jVrJNlQCNSgItnU1se2sTuUfkJ2PdYsJxYpj heSPyhirbm4M4NpyqyMkHy7qOvGa2ok0SK9OJTnqji5lFcNxOJ1f+Aj2xUXTyxxv uW9qwCTShxAhWcM58T3lEegY15ntVEKv62E9+PWJ3cEgljbeE9x1gbXteRX+N0xs NX1NJNDqONGxLCZRzCTNF767XOu7APIS7IUYsQbz2QHPN1Nom3KVwpKyJGkmiYY= =/w9I -----END PGP SIGNATURE----- --vOmOzSkFvhd7u8Ms--