From patchwork Sun Jan 17 11:32:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 43022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8ECEDB7CE4 for ; Sun, 17 Jan 2010 22:41:32 +1100 (EST) Received: from localhost ([127.0.0.1]:57814 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWTOF-0001T0-7m for incoming@patchwork.ozlabs.org; Sun, 17 Jan 2010 06:33:55 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWTN8-0001Sd-HC for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:32:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWTN2-0001Rb-H8 for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:32:45 -0500 Received: from [199.232.76.173] (port=51576 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWTN2-0001RY-Bd for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:32:40 -0500 Received: from verein.lst.de ([213.95.11.210]:57776) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NWTN1-0004uO-NB for qemu-devel@nongnu.org; Sun, 17 Jan 2010 06:32:40 -0500 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id o0HBWVWY019209 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sun, 17 Jan 2010 12:32:31 +0100 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id o0HBWUxG019208; Sun, 17 Jan 2010 12:32:30 +0100 Date: Sun, 17 Jan 2010 12:32:30 +0100 From: Christoph Hellwig To: Kevin Wolf Message-ID: <20100117113230.GB18966@lst.de> References: <20100112124923.GA19631@lst.de> <4B4E56B8.6000701@codemonkey.ws> <4B4EF01B.4090302@redhat.com> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <4B4EF01B.4090302@redhat.com> User-Agent: Mutt/1.3.28i X-Spam-Score: 0 () X-Scanned-By: MIMEDefang 2.39 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Christoph Hellwig , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] block: fix cache flushing in bdrv_commit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Thu, Jan 14, 2010 at 11:21:15AM +0100, Kevin Wolf wrote: > Anthony, you seem to have missed the v2 patch that considered my review > comments. Can you please apply the diff between v1 and v2 on top? Here is the differences in patch form: --- From: Christoph Hellwig Subject: block: fix cache flushing in bdrv_commit As pointed out by Kevin Wolf the previous patch returned early if we there is a bdrv_make_empty method and it missed a cache flush for the frontend device after the bdev_make_empty call. This patch fixes it up. Signed-off-by: Christoph Hellwig Index: qemu/block.c =================================================================== --- qemu.orig/block.c 2010-01-17 12:27:03.589006970 +0100 +++ qemu/block.c 2010-01-17 12:27:55.718008519 +0100 @@ -589,6 +589,7 @@ int bdrv_commit(BlockDriverState *bs) BlockDriver *drv = bs->drv; int64_t i, total_sectors; int n, j; + int ret = 0; unsigned char sector[512]; if (!drv) @@ -620,8 +621,10 @@ int bdrv_commit(BlockDriverState *bs) } } - if (drv->bdrv_make_empty) - return drv->bdrv_make_empty(bs); + if (drv->bdrv_make_empty) { + ret = drv->bdrv_make_empty(bs); + bdrv_flush(bs); + } /* * Make sure all data we wrote to the backing device is actually @@ -629,7 +632,7 @@ int bdrv_commit(BlockDriverState *bs) */ if (bs->backing_hd) bdrv_flush(bs->backing_hd); - return 0; + return ret; } /*