From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KyN4F-0007Pm-Eh for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:51:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KyN4D-0007Oo-Fa for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:51:46 -0500 Received: from [199.232.76.173] (port=58112 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KyN4D-0007Oj-8R for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:51:45 -0500 Received: from ns.suse.de ([195.135.220.2]:40833 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 1KyN4D-000274-0e for qemu-devel@nongnu.org; Fri, 07 Nov 2008 03:51:45 -0500 Message-ID: <49140247.5090508@suse.de> Date: Fri, 07 Nov 2008 09:54:31 +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> <49132A40.7030105@suse.de> <1226047715.4046.8.camel@frecb07144> In-Reply-To: <1226047715.4046.8.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: Laurent Vivier Cc: qemu-devel@nongnu.org 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_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; >> Please retain the comment saying that 1 is not the correct value but w= e >> default to allocated for safety if the block could not be read. I don'= 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. No, it's a move which drops a comment and it shouldn't do that. ;-) > - /* better than nothing: return allocated if read error */ Kevin