From: Stefano Stabellini Subject: Re: [PATCH 1/3] qemu-xen-traditional: use O_DIRECT to open disk images for IDE [and 1 more messages] Date: Fri, 30 Mar 2012 10:46:24 +0100 Message-ID: References: <1332514289-28129-1-git-send-email-stefano.stabellini@eu.citrix.com> <20337.63345.79209.977387@mariner.uk.xensource.com> <1332925851.7702.9.camel@zakaz.uk.xensource.com> <20340.28608.642720.913130@mariner.uk.xensource.com> <20340.41716.915705.558140@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20340.41716.915705.558140@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: "Zhang, Yang Z" , "xen-devel@lists.xensource.com" , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 29 Mar 2012, Ian Jackson wrote: > Stefano Stabellini writes ("Re: [Xen-devel] [PATCH 1/3] qemu-xen-traditional: use O_DIRECT to open disk images for IDE"): > > On Thu, 29 Mar 2012, Ian Jackson wrote: > > > Ian Campbell writes ("Re: [Xen-devel] [PATCH 1/3] qemu-xen-traditional: use O_DIRECT to open disk images for IDE"): > > > So I think qemu-xen-unstable the use of write-back cacheing for > > > bdrv_write is correct. (Apart from the wrinkle that the emulated > > > drive cache, write_cache, is enabled by default - but I wouldn't be > > > surprised if that accurately emulated the behaviour of real disks.) > > > > You have missed my other emails on this thread about other disk formats > > and related bug reports. > > I guess you mean this, which I had read: > > Stefano Stabellini writes ("Re: [Xen-devel] [PATCH 1/3] qemu-xen-traditional: use O_DIRECT to open disk images for IDE"): > > On Wed, 28 Mar 2012, Ian Campbell wrote: > > > I think it is possible that we've incorrectly determined that > > > BDRV_O_CACHE has issues with correctness? > > > > Following the latest disk cache thread on qemu-devel > > (http://marc.info/?l=qemu-devel&m=127434799425483) it looks like some > > image formats are unsafe with BDRV_O_CACHE_WB: > > I'm not convinced that this bug applies to the approach taken in > qemu-xen-unstable, because in qemu-xen-unstable we always call > bdrv_flush at an appropriate point, and bdrv_flush is plumbed through > by qcow_aio_flush to a flush of the underlying device. I think it does. Here is an example: In qemu-xen you can easily have this sequence of calls: bdrv_co_writev -> qcow2_co_writev -> qcow2_alloc_cluster_offset -> get_cluster_table -> qcow2_grow_l1_table -> bdrv_pwrite_sync In qemu-xen-traditional they would become: qcow_aio_write_cb -> alloc_cluster_offset -> get_cluster_table -> grow_l1_table -> bdrv_pwrite The key piece of information is that bdrv_pwrite_sync issues a bdrv_flush if the file was opened as WB, while bdrv_pwrite does not.