From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NUkmC-0004AS-8J for qemu-devel@nongnu.org; Tue, 12 Jan 2010 12:43:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NUkm7-00049G-2z for qemu-devel@nongnu.org; Tue, 12 Jan 2010 12:43:31 -0500 Received: from [199.232.76.173] (port=59211 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NUkm7-00049C-0N for qemu-devel@nongnu.org; Tue, 12 Jan 2010 12:43:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11570) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NUkm6-0003rn-7q for qemu-devel@nongnu.org; Tue, 12 Jan 2010 12:43:26 -0500 Message-ID: <4B4CB47C.7090206@redhat.com> Date: Tue, 12 Jan 2010 18:42:20 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/2] block: flush backing_hd in the right place References: <20100112124923.GA19631@lst.de> In-Reply-To: <20100112124923.GA19631@lst.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org Am 12.01.2010 13:49, schrieb Christoph Hellwig: > > The backing device is only modified from bdrv_commit. So instead of > flushing it every time bdrv_flush is called for the front-end device > only flush it after we're written data to it in bdrv_commit. > > Signed-off-by: Christoph Hellwig > > Index: qemu/block.c > =================================================================== > --- qemu.orig/block.c 2010-01-12 11:34:35.549024986 +0100 > +++ qemu/block.c 2010-01-12 11:43:28.965006129 +0100 > @@ -623,6 +623,12 @@ int bdrv_commit(BlockDriverState *bs) > if (drv->bdrv_make_empty) > return drv->bdrv_make_empty(bs); > > + /* > + * Make sure all data we wrote to the backing device is actually > + * stable on disk. > + */ > + if (bs->backing_hd) > + bdrv_flush(bs->backing_hd); > return 0; > } Format drivers with a bdrv_make_empty return before the flush, so it won't work for qcow1. Looks good otherwise. If it has done a bdrv_make_empty we might also want to flush bs? Kevin