From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiDJU-0003tM-Aj for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:17:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiDJP-0003rE-EC for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:17:15 -0400 Received: from [199.232.76.173] (port=51909 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiDJP-0003r8-8C for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:17:11 -0400 Received: from verein.lst.de ([213.95.11.210]:33974) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1MiDJO-0001DJ-RM for qemu-devel@nongnu.org; Mon, 31 Aug 2009 16:17:11 -0400 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 n7VKH9VL004917 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 31 Aug 2009 22:17:09 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id n7VKH96j004916 for qemu-devel@nongnu.org; Mon, 31 Aug 2009 22:17:09 +0200 Date: Mon, 31 Aug 2009 22:17:09 +0200 From: Christoph Hellwig Message-ID: <20090831201709.GB4874@lst.de> References: <20090831201627.GA4811@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090831201627.GA4811@lst.de> Subject: [Qemu-devel] [PATCH 2/4] block: use fdatasync instead of fsync List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org If we are flushing the caches for our image files we only care about the data (including the metadata required for accessing it) but not things like timestamp updates. So use fdatasync instead of fsync to implement the flush operations. Signed-off-by: Christoph Hellwig Index: qemu/block/cow.c =================================================================== --- qemu.orig/block/cow.c 2009-06-07 16:18:21.942938914 -0300 +++ qemu/block/cow.c 2009-08-31 16:49:55.509043084 -0300 @@ -258,7 +258,7 @@ static int cow_create(const char *filena static void cow_flush(BlockDriverState *bs) { BDRVCowState *s = bs->opaque; - fsync(s->fd); + fdatasync(s->fd); } static QEMUOptionParameter cow_create_options[] = { Index: qemu/block/raw-posix.c =================================================================== --- qemu.orig/block/raw-posix.c 2009-08-29 14:17:23.039370199 -0300 +++ qemu/block/raw-posix.c 2009-08-31 16:49:55.513071598 -0300 @@ -723,7 +723,7 @@ static int raw_create(const char *filena static void raw_flush(BlockDriverState *bs) { BDRVRawState *s = bs->opaque; - fsync(s->fd); + fdatasync(s->fd); }