From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKcIK-0007C7-4b for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:34:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKcII-00079f-Cs for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:34:15 -0500 Received: from [199.232.76.173] (port=39821 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKcII-00079D-7l for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:34:14 -0500 Received: from qw-out-1920.google.com ([74.125.92.147]:23606) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LKcIH-00049m-OT for qemu-devel@nongnu.org; Wed, 07 Jan 2009 12:34:13 -0500 Received: by qw-out-1920.google.com with SMTP id 5so3865817qwc.4 for ; Wed, 07 Jan 2009 09:34:13 -0800 (PST) Message-ID: <4964E78F.1010206@codemonkey.ws> Date: Wed, 07 Jan 2009 11:34:07 -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