From patchwork Tue Feb 19 15:45:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 221715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 392E42C0099 for ; Wed, 20 Feb 2013 02:45:31 +1100 (EST) Received: from localhost ([::1]:55536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7pNp-0006pu-EE for incoming@patchwork.ozlabs.org; Tue, 19 Feb 2013 10:45:29 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7pNe-0006pm-HA for qemu-devel@nongnu.org; Tue, 19 Feb 2013 10:45:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7pNb-0000qI-Ly for qemu-devel@nongnu.org; Tue, 19 Feb 2013 10:45:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7pNb-0000qA-E2 for qemu-devel@nongnu.org; Tue, 19 Feb 2013 10:45:15 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1JFjExK000748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Feb 2013 10:45:14 -0500 Received: from localhost (ovpn-112-41.ams2.redhat.com [10.36.112.41]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1JFjDjS008508; Tue, 19 Feb 2013 10:45:14 -0500 From: Stefan Hajnoczi To: Date: Tue, 19 Feb 2013 16:45:01 +0100 Message-Id: <1361288706-13929-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1361288706-13929-1-git-send-email-stefanha@redhat.com> References: <1361288706-13929-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 1/6] qcow2: flush refcount cache correctly in alloc_refcount_block() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org update_refcount() affects the refcount cache, it does not write to disk. Therefore bdrv_flush(bs->file) does nothing. We need to flush the refcount cache in order to write out the refcount updates! Signed-off-by: Stefan Hajnoczi --- block/qcow2-refcount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index bc1784c..05b5ec9 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -237,7 +237,7 @@ static int alloc_refcount_block(BlockDriverState *bs, goto fail_block; } - bdrv_flush(bs->file); + qcow2_cache_flush(bs, s->refcount_block_cache); /* Initialize the new refcount block only after updating its refcount, * update_refcount uses the refcount cache itself */