From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KyN1G-0006HP-2f for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:48:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KyN1E-0006Gz-OI for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:48:41 -0500 Received: from [199.232.76.173] (port=57982 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KyN1E-0006Gt-MB for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:48:40 -0500 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:39457) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KyN1E-0000wP-Ln for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:48:40 -0500 Subject: Re: [Qemu-devel] [PATCH 1/4] qcow2: Clean-up update_cluster_refcount(). From: Laurent Vivier In-Reply-To: <49132A40.7030105@suse.de> References: <20081106165212.380421945@bull.net> <1225990557.6576.11.camel@frecb07144> <49132A40.7030105@suse.de> Content-Type: text/plain; charset=UTF-8 Date: Fri, 07 Nov 2008 09:48:35 +0100 Message-Id: <1226047715.4046.8.camel@frecb07144> Mime-Version: 1.0 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: Kevin Wolf Le jeudi 06 novembre 2008 =C3=A0 18:32 +0100, Kevin Wolf a =C3=A9crit : > 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_blo= ck_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; >=20 > 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. I totally agree with you, but it's just a code move, I don't want to change anything except the line numbers. I think this kind of change must have its own patch. Regards, Laurent --=20 ------------------ Laurent.Vivier@bull.net ------------------ "Tout ce qui est impossible reste =C3=A0 accomplir" Jules Verne "Things are only impossible until they're not" Jean-Luc Picard