From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFKnc-0008P6-6o for qemu-devel@nongnu.org; Thu, 28 Apr 2011 02:34:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFKnb-0003q5-Cl for qemu-devel@nongnu.org; Thu, 28 Apr 2011 02:34:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFKnb-0003q0-4Q for qemu-devel@nongnu.org; Thu, 28 Apr 2011 02:34:03 -0400 Message-ID: <4DB90AEA.2090206@redhat.com> Date: Thu, 28 Apr 2011 08:36:26 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <4DB7880C.4090302@fnarfbargle.com> <4DB7DA44.4030008@fnarfbargle.com> <4DB7EAAC.3080402@redhat.com> <4DB81E16.5010408@fnarfbargle.com> <4DB8209A.7070400@redhat.com> <4DB821EE.8010706@fnarfbargle.com> <4DB8CBB8.9050002@fnarfbargle.com> In-Reply-To: <4DB8CBB8.9050002@fnarfbargle.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Qemu-img convert with -B List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Brad Campbell Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Brad Campbell Am 28.04.2011 04:06, schrieb Brad Campbell: > On 27/04/11 22:02, Brad Campbell wrote: >> On 27/04/11 21:56, Kevin Wolf wrote: >> >>> When you don't have a backing file, leaving an cluster unallocated means >>> that it's zero. When you have a backing file, it could be anything. So >>> if qemu-img convert wanted to save this space, it would have to read >>> from the backing file and leave the cluster unallocated if it reads as >>> zero. >>> >>> This is something that qemu-img doesn't do today. >> > > This passes cursory testing, but I'm just wondering if this is along the > right lines? I haven't checked all details, but it looks like what I would have done. (Though something is wrong with your indentations, I suspect that the patch wouldn't apply) > @@ -939,9 +957,16 @@ out: > free_option_parameters(create_options); > free_option_parameters(param); > qemu_free(buf); > + if (buf3) { > + qemu_free(buf3); > + } qemu_free (and the libc free, too) work just fine with NULL, so the check isn't needed. Kevin