From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jyat5-000542-1z for qemu-devel@nongnu.org; Tue, 20 May 2008 19:04:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jyat4-000512-1u for qemu-devel@nongnu.org; Tue, 20 May 2008 19:04:54 -0400 Received: from [199.232.76.173] (port=59041 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jyat3-00050n-Lv for qemu-devel@nongnu.org; Tue, 20 May 2008 19:04:53 -0400 Received: from ecfrec.frec.bull.fr ([129.183.4.8]:33960) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jyat3-00063G-8I for qemu-devel@nongnu.org; Tue, 20 May 2008 19:04:53 -0400 Subject: Re: [Qemu-devel] Re: [PATCH][v2] Align file accesses with cache=off (O_DIRECT) From: Laurent Vivier In-Reply-To: <20080520223602.GE27853@shareable.org> References: <1211283126.4314.70.camel@frecb07144> <48332AB9.3010707@codemonkey.ws> <20080520223602.GE27853@shareable.org> Content-Type: text/plain; charset=utf-8 Date: Wed, 21 May 2008 01:04:47 +0200 Message-Id: <1211324687.4217.8.camel@frecb07144> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: Blue Swirl , qemu-devel@nongnu.org, Kevin Wolf Le mardi 20 mai 2008 =C3=A0 23:36 +0100, Jamie Lokier a =C3=A9crit : > Anthony Liguori wrote: > > >This patch implements wrappers for raw_pread and raw_pwrite which al= ign > > >all file accesses and make qcow(2) work with cache=3Doff. This metho= d > > >might not be the most performant one (compared to fixing qcow, qcow2= and > > >everything else that might be using unaligned accesses), but unalign= ed > > >accesses don't happen that frequently and with this patch really all > > >image accesses should be covered." >=20 > It's a useful patch. >=20 > One little esoteric consequence you might want to document. >=20 > This occurs when a guest is running something like a database or > journalling filesystem, and is reliant on the host disk's integrity > properties. >=20 > One property of disks is that if you overwrite a sector and the're > power loss, when read later that sector might be corrupt. Even if the > new data is the same as the old data with only some bytes changed, > some of the _unchanged_ bytes may be corrupt by this. >=20 > When it writes to sector-aligned offset, there is a possibility that > the guest is depending on power failure not causing corruption of > neighouring sectors. This is typical with some kinds of journalling. >=20 > 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. Sector unaligned guest offset are converted to sector aligned offset. Sector aligned guest offset are written as is. And as we use O_DIRECT and aligned offset and data count I think we increase disk integrity (regarding the case without O_DIRECT and without aligned access...), so we should document the case without O_DIRECT use, not the case with O_DIRECT use... Regards, Laurent --=20 ------------- Laurent.Vivier@bull.net --------------- "The best way to predict the future is to invent it." - Alan Kay