From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jyclp-00044C-U3 for qemu-devel@nongnu.org; Tue, 20 May 2008 21:05:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jyclo-00043j-Qu for qemu-devel@nongnu.org; Tue, 20 May 2008 21:05:33 -0400 Received: from [199.232.76.173] (port=43361 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jyclo-00043g-Kc for qemu-devel@nongnu.org; Tue, 20 May 2008 21:05:32 -0400 Received: from yw-out-1718.google.com ([74.125.46.156]:34658) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jycln-000777-Cg for qemu-devel@nongnu.org; Tue, 20 May 2008 21:05:32 -0400 Received: by yw-out-1718.google.com with SMTP id 6so1610859ywa.82 for ; Tue, 20 May 2008 18:05:24 -0700 (PDT) Message-ID: <4833754C.8090302@codemonkey.ws> Date: Tue, 20 May 2008 20:05:16 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH][v2] Align file accesses with cache=off (O_DIRECT) References: <1211283126.4314.70.camel@frecb07144> <48332AB9.3010707@codemonkey.ws> <20080520223602.GE27853@shareable.org> <200805202352.17807.paul@codesourcery.com> <483373BA.6090108@codemonkey.ws> In-Reply-To: <483373BA.6090108@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. For instance, the kernel loading code passes a buffer on the stack to bdrv_read(). That's a problem with the current patch honestly, we should not rely on callers to align buffers. bdrv_read()/bdrv_aio_read()/bdrv_pread() all should be tolerant of unaligned buffers if we're going to support O_DIRECT. Regards, Anthony Liguori > Regards, > > Anthony Liguori > >> Paul >> >> >> >