From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50321 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOTQR-0008B9-V0 for qemu-devel@nongnu.org; Tue, 15 Jun 2010 06:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOTQM-0007P6-Hn for qemu-devel@nongnu.org; Tue, 15 Jun 2010 06:31:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35944) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOTQM-0007P0-BD for qemu-devel@nongnu.org; Tue, 15 Jun 2010 06:31:18 -0400 Message-ID: <4C175664.7050107@redhat.com> Date: Tue, 15 Jun 2010 12:31:00 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/2] qcow2: Simplify image creation References: <1276526595-32658-1-git-send-email-kwolf@redhat.com> <1276526595-32658-2-git-send-email-kwolf@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, quintela@redhat.com Am 15.06.2010 12:14, schrieb Stefan Hajnoczi: > On Mon, Jun 14, 2010 at 3:43 PM, Kevin Wolf wrote: >> Instead of doing lots of magic for setting up initial refcount blocks and stuff >> create a minimal (inconsistent) image, open it and initialize the rest with >> regular qcow2 functions. > > Nice idea. > >> + ret = bdrv_pwrite(bs, 0, &header, sizeof(header)); >> + if (ret < 0) { >> + return ret; >> + } > > The bs is not closed on error. Right, will fix the missing bdrv_delete here and in other cases. > Also, this function will leave a > partially created file on disk if it fails. As did the old one, and the bdrv_create functions of most other formats behave the same. We could implement a bdrv_remove to remove that file again, but it would be ununsed except for these very unlikely error cases. If you can't access the disk, usually the bdrv_create_file would fail already. Kevin