From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgED1-0004do-IV for qemu-devel@nongnu.org; Mon, 20 Oct 2014 10:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgECs-0000s4-Th for qemu-devel@nongnu.org; Mon, 20 Oct 2014 10:45:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgECs-0000rU-NC for qemu-devel@nongnu.org; Mon, 20 Oct 2014 10:45:10 -0400 Date: Mon, 20 Oct 2014 16:45:04 +0200 From: Kevin Wolf Message-ID: <20141020144504.GO3585@noname.redhat.com> References: <1409348463-16627-1-git-send-email-mreitz@redhat.com> <1409348463-16627-4-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1409348463-16627-4-git-send-email-mreitz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 03/11] qcow2: Split qcow2_check_refcounts() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, =?iso-8859-1?Q?Beno=EEt?= Canet Am 29.08.2014 um 23:40 hat Max Reitz geschrieben: > Put the code for calculating the reference counts and comparing them > during qemu-img check into own functions. >=20 > Signed-off-by: Max Reitz > Reviewed-by: Beno=EEt Canet > +static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *= res, > + BdrvCheckMode fix, uint16_t **refcount_= table, > + int64_t *nb_clusters) [..] > + return check_refblocks(bs, res, fix, refcount_table, nb_clusters); > +} At first I wanted to comment that it would make more sense to call check_refblocks() from the main function qcow2_check_refcounts(). Now I see that you call it here because it also increases the refcounts for the refblocks. The only thing we could consider here is to split the function into a counting part that is called in calculate_refcounts() and a checking part that is called in qcow2_check_refcounts(). I'll leave that to you, though. Reviewed-by: Kevin Wolf