From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jyckv-0003eC-8o for qemu-devel@nongnu.org; Tue, 20 May 2008 21:04:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jyckt-0003dv-NB for qemu-devel@nongnu.org; Tue, 20 May 2008 21:04:36 -0400 Received: from [199.232.76.173] (port=48087 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jyckt-0003ds-Ka for qemu-devel@nongnu.org; Tue, 20 May 2008 21:04:35 -0400 Received: from mail2.shareable.org ([80.68.89.115]:55664) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jyckt-000713-4e for qemu-devel@nongnu.org; Tue, 20 May 2008 21:04:35 -0400 Date: Wed, 21 May 2008 02:04:33 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] Re: [PATCH][v2] Align file accesses with cache=off (O_DIRECT) Message-ID: <20080521010433.GB595@shareable.org> References: <1211283126.4314.70.camel@frecb07144> <48332AB9.3010707@codemonkey.ws> <20080520223602.GE27853@shareable.org> <200805202352.17807.paul@codesourcery.com> <483373BA.6090108@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <483373BA.6090108@codemonkey.ws> 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: Blue Swirl , Laurent Vivier , Kevin Wolf Anthony Liguori wrote: > Paul Brook wrote: > >>When sector-aligned guest offsets are converted to sector-unaligned > >>writes (e.g. due to qcow2 etc.), that property is no longer satisfied, > >>and power failure of the host disk can cause more damage than the > >>guest is designed to be resistant to. > >> > > > >Seems like the easiest solution would be to have qcow always align its > >writes. > >We don't do on the fly compression, so it should be fairly easy to make > >this happen with minimal overhead. > > > > That's not sufficient. O_DIRECT imposes not only offset alignment > requirements but also requirements on the buffer being read to. Most of > the code in QEMU does not properly align the read/write buffers. The offset when reading is not so important. And of course, can't be guaranteed with qcow2 - as the sector being read may be compressed. For writing, if the memory isn't suitably aligned for the _transformed_ offset, you can either transform it differently, or copy the memory to somewhere with the right offset first. -- Jamie