From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiEmw-0002rf-F4 for qemu-devel@nongnu.org; Mon, 31 Aug 2009 17:51:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiEmr-0002pK-UJ for qemu-devel@nongnu.org; Mon, 31 Aug 2009 17:51:46 -0400 Received: from [199.232.76.173] (port=58460 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiEmr-0002pH-Ly for qemu-devel@nongnu.org; Mon, 31 Aug 2009 17:51:41 -0400 Received: from mail2.shareable.org ([80.68.89.115]:59512) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MiEmr-00008L-95 for qemu-devel@nongnu.org; Mon, 31 Aug 2009 17:51:41 -0400 Date: Mon, 31 Aug 2009 22:51:38 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH 2/4] block: use fdatasync instead of fsync Message-ID: <20090831215138.GA24318@shareable.org> References: <20090831201627.GA4811@lst.de> <20090831201709.GB4874@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090831201709.GB4874@lst.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org 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); I believe fsync was used because of uncertainty about whether fdatasync reliably flushes the necessary metadata to access the data on all hosts, after things like writing to holes and extending a file. I'm still not sure if fdatasync provides that guarantee on Linux. -- Jamie