From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvkCu-0000nV-FJ for qemu-devel@nongnu.org; Tue, 02 Dec 2014 04:57:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvkCn-0002FC-Ie for qemu-devel@nongnu.org; Tue, 02 Dec 2014 04:57:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvkCn-0002F6-AI for qemu-devel@nongnu.org; Tue, 02 Dec 2014 04:57:13 -0500 Message-ID: <547D8CF5.3020209@redhat.com> Date: Tue, 02 Dec 2014 10:57:09 +0100 From: Max Reitz MIME-Version: 1.0 References: <1416503198-17031-1-git-send-email-mreitz@redhat.com> <1416503198-17031-8-git-send-email-mreitz@redhat.com> <20141128111100.GC13631@stefanha-thinkpad.redhat.com> In-Reply-To: <20141128111100.GC13631@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 07/22] qcow2: Helper function for refcount modification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On 2014-11-28 at 12:11, Stefan Hajnoczi wrote: > On Thu, Nov 20, 2014 at 06:06:23PM +0100, Max Reitz wrote: >> @@ -1711,7 +1746,7 @@ static int calculate_refcounts(BlockDriverState *bs, BdrvCheckResult *res, >> static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res, >> BdrvCheckMode fix, bool *rebuild, >> int64_t *highest_cluster, >> - uint16_t *refcount_table, int64_t nb_clusters) >> + void *refcount_table, int64_t nb_clusters) >> { >> BDRVQcowState *s = bs->opaque; >> int64_t i, refcount1, refcount2; > An -ERANGE qcow2_get_refcount() return value is treated as a check error > here and we won't be able to rebuild the refcount blocks: > > refcount1 = qcow2_get_refcount(bs, i); > if (refcount1 < 0) { > fprintf(stderr, "Can't get refcount for cluster %" PRId64 ": %s\n", > i, strerror(-refcount1)); > res->check_errors++; > continue; > } > > We should allow rebuilding refcount blocks, -ERANGE is just another > corrupted refcount. Right, hopefully this will be fixed by implementing your proposal for changing "uint64_t qcow2_get_refcount(...)" to "int qcow2_get_refcount(..., uint64_t *)" etc.. Max