From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KyNYM-0006W4-IO for qemu-devel@nongnu.org; Fri, 07 Nov 2008 04:22:54 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KyNYK-0006VT-AX for qemu-devel@nongnu.org; Fri, 07 Nov 2008 04:22:52 -0500 Received: from [199.232.76.173] (port=49302 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KyNYJ-0006VG-Qx for qemu-devel@nongnu.org; Fri, 07 Nov 2008 04:22:51 -0500 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:53845) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KyNYJ-0006TV-MZ for qemu-devel@nongnu.org; Fri, 07 Nov 2008 04:22:52 -0500 Subject: Re: [Qemu-devel] [PATCH 1/4] qcow2: Clean-up update_cluster_refcount(). From: Laurent Vivier In-Reply-To: <49140247.5090508@suse.de> References: <20081106165212.380421945@bull.net> <1225990557.6576.11.camel@frecb07144> <49132A40.7030105@suse.de> <1226047715.4046.8.camel@frecb07144> <49140247.5090508@suse.de> Content-Type: text/plain; charset=utf-8 Date: Fri, 07 Nov 2008 10:22:47 +0100 Message-Id: <1226049767.4046.10.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: Kevin Wolf Cc: qemu-devel@nongnu.org Le vendredi 07 novembre 2008 =C3=A0 09:54 +0100, Kevin Wolf a =C3=A9crit = : > Laurent Vivier schrieb: > > 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(). > >>> > >>> Signed-off-by: Laurent Vivier > >>> --- > >>> block-qcow2.c | 71 +++++++++++++++++++++++++++++++++++----------= ------------- > >>> 1 file changed, 43 insertions(+), 28 deletions(-) > >>> > >>> 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_offse= t) > >>> + return 0; > >>> + > >>> ret =3D bdrv_pread(s->hd, refcount_block_offset, s->refcount_b= lock_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_ind= ex]; > >>> 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 do= n't > >> think this is obvious. > >=20 > > I totally agree with you, but it's just a code move, I don't want to > > change anything except the line numbers. > >=20 > > I think this kind of change must have its own patch. >=20 > No, it's a move which drops a comment and it shouldn't do that. ;-) >=20 > > - /* better than nothing: return allocated if read error */ Oops... 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