From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MidoU-0001nT-B1 for qemu-devel@nongnu.org; Tue, 01 Sep 2009 20:35:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MidoP-0001f1-LJ for qemu-devel@nongnu.org; Tue, 01 Sep 2009 20:35:01 -0400 Received: from [199.232.76.173] (port=42400 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MidoP-0001el-EA for qemu-devel@nongnu.org; Tue, 01 Sep 2009 20:34:57 -0400 Received: from mail2.shareable.org ([80.68.89.115]:54109) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MidoO-0005Tz-RN for qemu-devel@nongnu.org; Tue, 01 Sep 2009 20:34:57 -0400 Date: Wed, 2 Sep 2009 01:34:54 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH 2/4] block: use fdatasync instead of fsync Message-ID: <20090902003454.GE1321@shareable.org> References: <20090831201627.GA4811@lst.de> <20090831201709.GB4874@lst.de> <20090901160409.GA22629@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090901160409.GA22629@lst.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: Blue Swirl , qemu-devel@nongnu.org Christoph Hellwig wrote: > On Tue, Sep 01, 2009 at 06:59:46PM +0300, Blue Swirl wrote: > > On Mon, Aug 31, 2009 at 11:17 PM, Christoph Hellwig wrote: > > > > > > 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. > > > > > - ?? ??fsync(s->fd); > > > + ?? ??fdatasync(s->fd); > > > > There is no fdatasync outside of Linux, not in OpenBSD and mingw32 at > > least. But you could add a probe for it to configure. > > Oh, okay. Kinda sad that people still don't implement useful inteface > that have been in Posix for a long time. fdatasync is common among the big commercial unixes which were still being actively developed a few years ago, but fsync is universal - it's very old. Neither OpenBSD nor FreeBSD have fdatasync. mingw32 is a thin wrapper around Windows. Windows as far as I can tell doesn't have an equivalent of fdatasync, although it does have an equivalent of O_DIRECT|O_SYNC (but documentation contradicts itself regarding whether the combination flushes metadata on each write). -- Jamie