From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jgw0A-0007uL-Im for qemu-devel@nongnu.org; Wed, 02 Apr 2008 01:59:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jgw08-0007sX-P3 for qemu-devel@nongnu.org; Wed, 02 Apr 2008 01:59:14 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jgw08-0007s6-E9 for qemu-devel@nongnu.org; Wed, 02 Apr 2008 01:59:12 -0400 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jgw08-0000TS-2T for qemu-devel@nongnu.org; Wed, 02 Apr 2008 01:59:12 -0400 Received: from mail2.shareable.org ([80.68.89.115]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JglTv-00064T-6l for qemu-devel@nongnu.org; Tue, 01 Apr 2008 14:45:15 -0400 Date: Tue, 1 Apr 2008 19:45:02 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH] Asynchronous reliable and configurable cache flush Message-ID: <20080401184501.GA26813@shareable.org> References: <18418.28291.689482.198484@mariner.uk.xensource.com> <200804011846.25975.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200804011846.25975.paul@codesourcery.com> 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 Cc: Ian Jackson Paul Brook wrote: > > @@ -1021,6 +1031,13 @@ static void ide_write_dma_cb(void *opaque, int ret) > >   > >      /* end of transfer ? */ > >      if (s->nsector == 0) { > > +       if (!s->write_cache) { > > +           ret = bdrv_flush(s->bs); > > +           if (ret != 0) { > > +               ide_dma_error(s); > > +               return; > > +           } > > +       } > > By my reading this is adding a synchronous flush to the end of an > async write operation, which in practice makes the whole operation > synchronous. Looks that way to me too. It might be simplest to open the device with O_DSYNC when !s->write_cache and user actually wants fdatasync, so that async write can be used. I suspect every platform with useful Posix AIO has O_DSYNC. Otherwise, chaining where the completion of aio_write triggers aio_fsync instead of reporting completion to the guest? -- Jamie