From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWqTP-0006lG-Rm for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:12:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWqTL-0006iN-6i for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:12:47 -0500 Received: from [199.232.76.173] (port=51042 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWqTK-0006iG-Op for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:12:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28781) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWqTK-0001c0-Cv for qemu-devel@nongnu.org; Mon, 18 Jan 2010 07:12:42 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0ICCfoK001930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Jan 2010 07:12:41 -0500 From: Kevin Wolf Date: Mon, 18 Jan 2010 13:11:34 +0100 Message-Id: <1263816696-24122-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1263816696-24122-1-git-send-email-kwolf@redhat.com> References: <1263816696-24122-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 08/10] qcow2: Allow updating no refcounts List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf There's absolutely no problem with updating the refcounts of 0 clusters. At least snapshot code is doing this and would fail once the result of update_refcount isn't ignored any more. Signed-off-by: Kevin Wolf --- block/qcow2-refcount.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index a84620f..3dfadf1 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -284,8 +284,10 @@ static int update_refcount(BlockDriverState *bs, printf("update_refcount: offset=%" PRId64 " size=%" PRId64 " addend=%d\n", offset, length, addend); #endif - if (length <= 0) + if (length < 0) { return -EINVAL; + } + start = offset & ~(s->cluster_size - 1); last = (offset + length - 1) & ~(s->cluster_size - 1); for(cluster_offset = start; cluster_offset <= last; -- 1.6.2.5