Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JU3A1-0005mu-Ap for qemu-devel@nongnu.org; Tue, 26 Feb 2008 12:00:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JU39y-0005lo-Sc for qemu-devel@nongnu.org; Tue, 26 Feb 2008 12:00:08 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JU39y-0005lb-IS for qemu-devel@nongnu.org; Tue, 26 Feb 2008 12:00:06 -0500 Received: from smtp02.citrix.com ([66.165.176.63]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JU39x-0000RX-U3 for qemu-devel@nongnu.org; Tue, 26 Feb 2008 12:00:06 -0500 Received: from mariner.uk.xensource.com (mariner.uk.xensource.com [172.31.17.38]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m1QGv40T013233 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 26 Feb 2008 08:57:06 -0800 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1JU370-0005Qb-54 for qemu-devel@nongnu.org; Tue, 26 Feb 2008 16:57:02 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18372.17630.149348.378169@mariner.uk.xensource.com> Date: Tue, 26 Feb 2008 16:57:02 +0000 Subject: Re: [Qemu-devel] [PATCH] ide.c make write cacheing controllable by guest In-Reply-To: <20080226124956.GA13669@shareable.org> References: <18371.1341.577787.909764@mariner.uk.xensource.com> <20080225205040.GA18613@shareable.org> <18372.748.889104.623158@mariner.uk.xensource.com> <20080226124956.GA13669@shareable.org> From: Ian Jackson Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Jamie Lokier writes ("Re: [Qemu-devel] [PATCH] ide.c make write cacheing controllable by guest"): > I'm imagining that fdatasync() will flush the necessary metadata, > including file size, when a file is extended. As would O_DSYNC. Do you have a reference to support this supposition ? SuSv3's specification for fdatasync is (astonishingly!) even vaguer and less meaningful than that for fsync. The closest I've come to finding answers are these: HP-UX 11i's fdatasync manpage: fdatasync() causes all modified data and file attributes of fildes required to retrieve the data to be written to disk. The glibc info manual: Sometimes it is not even necessary to write all data associated with a file descriptor. E.g., in database files which do not change in size it is enough to write all the file content data to the device. The Solaris manpage says that fdatasync does the same as O_DSYNC, and it calls the service "synchronized I/O data integrity completion" which is defined by the `Programming Interfaces Guide' to include this: * For writes, the operation has been completed, or diagnosed if unsuccessful. The write operation succeeds when the data specified in the write request is successfully transferred. Furthermore, all file system information required to retrieve the data must be successfully transferred. But then the next bullet point is this: * File attributes that are not necessary for data retrieval are not transferred prior to returning to the calling process. which says `are not transferred' when it ought to say `are not necessarily transferred' so it may be unwise to rely on the precise wording. I looked at various other manpages but they all say useless things like `metadata such as modification time' which leaves open the question of whether the file size is included. If the size is supposed to be included then the OS is required to keep a flag to say whether the file has been extended so that it knows that the next fdatasync ought really to be an fsync and write the inode too. (In a traditional filesystem structure.) Or perhaps fsck needs to extend the file as necessary to include the data blocks past the nominal end of file. This seems like rather a minefield. Ian.