From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ky8gM-00017T-HJ for qemu-devel@nongnu.org; Thu, 06 Nov 2008 12:30:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ky8gK-000161-Fh for qemu-devel@nongnu.org; Thu, 06 Nov 2008 12:30:09 -0500 Received: from [199.232.76.173] (port=59368 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ky8gK-00015o-6l for qemu-devel@nongnu.org; Thu, 06 Nov 2008 12:30:08 -0500 Received: from ns.suse.de ([195.135.220.2]:43085 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ky8gK-0003ve-8G for qemu-devel@nongnu.org; Thu, 06 Nov 2008 12:30:08 -0500 Message-ID: <49132A40.7030105@suse.de> Date: Thu, 06 Nov 2008 18:32:48 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] qcow2: Clean-up update_cluster_refcount(). References: <20081106165212.380421945@bull.net> <1225990557.6576.11.camel@frecb07144> In-Reply-To: <1225990557.6576.11.camel@frecb07144> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laurent Vivier Laurent Vivier schrieb: > pi=C3=A8ce jointe document texte brut > (0001-Clean-up-update_cluster_refcount.patch) > Move some parts to alloc_refcount_block() and block cache > checking to load_refcount_block(). >=20 > Signed-off-by: Laurent Vivier > --- > block-qcow2.c | 71 +++++++++++++++++++++++++++++++++++--------------= --------- > 1 file changed, 43 insertions(+), 28 deletions(-) >=20 > Index: qemu/block-qcow2.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- qemu.orig/block-qcow2.c 2008-11-06 16:34:46.000000000 +0100 > +++ qemu/block-qcow2.c 2008-11-06 16:40:27.000000000 +0100 > @@ -2169,6 +2169,10 @@ static int load_refcount_block(BlockDriv > { > BDRVQcowState *s =3D bs->opaque; > int ret; > + > + if (refcount_block_offset =3D=3D s->refcount_block_cache_offset) > + return 0; > + > ret =3D bdrv_pread(s->hd, refcount_block_offset, s->refcount_block= _cache, > s->cluster_size); > if (ret !=3D s->cluster_size) > @@ -2189,11 +2193,8 @@ static int get_refcount(BlockDriverState > refcount_block_offset =3D s->refcount_table[refcount_table_index]; > if (!refcount_block_offset) > return 0; > - if (refcount_block_offset !=3D s->refcount_block_cache_offset) { > - /* better than nothing: return allocated if read error */ > - if (load_refcount_block(bs, refcount_block_offset) < 0) > - return 1; > - } > + if (load_refcount_block(bs, refcount_block_offset) < 0) > + return 1; Please retain the comment saying that 1 is not the correct value but we default to allocated for safety if the block could not be read. I don't think this is obvious. Otherwise the patch looks fine to me. Kevin