From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXc1V-0004Cx-Vp for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:59:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXc1R-000475-2r for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:59:09 -0500 Received: from [199.232.76.173] (port=54475 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXc1Q-00046b-OD for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:59:04 -0500 Received: from mail-qy0-f199.google.com ([209.85.221.199]:65246) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXc1P-0004uL-Et for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:59:03 -0500 Received: by qyk37 with SMTP id 37so2905333qyk.18 for ; Wed, 20 Jan 2010 06:59:02 -0800 (PST) Message-ID: <4B571A30.70906@codemonkey.ws> Date: Wed, 20 Jan 2010 08:58:56 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] block: fix cache flushing in bdrv_commit References: <20100112124923.GA19631@lst.de> <4B4E56B8.6000701@codemonkey.ws> <4B4EF01B.4090302@redhat.com> <20100117113230.GB18966@lst.de> In-Reply-To: <20100117113230.GB18966@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: Kevin Wolf , qemu-devel@nongnu.org On 01/17/2010 05:32 AM, Christoph Hellwig wrote: > 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 > Applied. Thanks. Regards, Anthony Liguori > 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; > } > > /* > > > >