From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKc72-00056Z-2k for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:22:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKc70-00055K-37 for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:22:35 -0500 Received: from [199.232.76.173] (port=53873 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKc6z-00055G-Qq for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:22:33 -0500 Received: from mail-ew0-f21.google.com ([209.85.219.21]:61374) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LKc6z-0002S8-8z for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:22:33 -0500 Received: by ewy14 with SMTP id 14so9714144ewy.10 for ; Wed, 07 Jan 2009 09:22:31 -0800 (PST) Message-ID: <4964E4D1.7010405@codemonkey.ws> Date: Wed, 07 Jan 2009 11:22:25 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <4964E38A.5050204@suse.de> In-Reply-To: <4964E38A.5050204@suse.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH][RESEND] qcow2: Fix cluster allocation Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org Kevin Wolf wrote: > When allocating multiple clusters at once, the qcow2 implementation > tries to find as many physically contiguous clusters as possible to > allow larger writes. This search includes allocated clusters which are > in the right place and still free clusters. If the range to allocate > spans clusters in patterns like "10 allocated, then 10 free, then again > 10 allocated" it is only checked that the chunks of allocated clusters > are contiguous for themselves. > > However, what is actually needed is to have _all_ allocated clusters > contiguous, starting at the first cluster of the allocation and spanning > multiple such chunks. This patch changes the check so that each offset > is not compared to the offset of the first cluster in its own chunk but > to the first cluster in the whole allocation. > > I haven't seen it happen, but without this fix data corruption on qcow2 > images is possible. > > Signed-off-by: Kevin Wolf > Acked-by: Gleb Natapov > Applied. Thanks. Regards, Anthony Liguori