From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUXDo-00017C-Kh for qemu-devel@nongnu.org; Tue, 23 Apr 2013 03:01:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUXDm-0004yJ-34 for qemu-devel@nongnu.org; Tue, 23 Apr 2013 03:01:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUXDl-0004xl-QD for qemu-devel@nongnu.org; Tue, 23 Apr 2013 03:00:58 -0400 Date: Tue, 23 Apr 2013 09:00:54 +0200 From: Stefan Hajnoczi Message-ID: <20130423070054.GB6447@stefanha-thinkpad.redhat.com> References: <1366596479-22212-1-git-send-email-famz@redhat.com> <1366596479-22212-4-git-send-email-famz@redhat.com> <20130422140627.GH21317@stefanha-thinkpad.redhat.com> <20130423005202.GB8905@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130423005202.GB8905@localhost.localdomain> Subject: Re: [Qemu-devel] [PATCH v2 3/5] vmdk: Add option to create zeroed-grain image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org, kwolf@redhat.com On Tue, Apr 23, 2013 at 08:52:02AM +0800, Fam Zheng wrote: > On Mon, 04/22 16:06, Stefan Hajnoczi wrote: > > On Mon, Apr 22, 2013 at 10:07:57AM +0800, Fam Zheng wrote: > > > Add image create option "zeroed-grain" to enable zeroed-grain GTE > > > feature of vmdk sparse extents. When this option is on, header version > > > of newly created extent will be 2 and VMDK4_FLAG_ZG flag bit will be > > > set. > > > Signed-off-by: Fam Zheng > > > --- > > > block/vmdk.c | 22 +++++++++++++++++----- > > > 1 file changed, 17 insertions(+), 5 deletions(-) > > > > Is there a way to upgrade an image file to use zeroed-grain GTEs once > > the file has been created? > > > > Yes. We have discussed this on IRC. > > Here's how we do it: > - If file version is 2 and zeroed-grain GTE bit set in header, we can > support bdrv_co_write_zeroes (this patch series implemented). > - If the file version is 2, we can enable zeroed-grain flag in header > on bdrv_co_write_zeroes, and use zeroed-grain GTE. (need another > patch to update the header). > - Otherwize, -ENOTSUP > > For background, here's how vmware uses this feature: > - On shrinking a *child* disk (e.g.: vmware-vdiskmanager -k > child.vmdk), if the child cluster is filled with zero, then the image > version is upgraded to 2 and zeroed-grian flag is set, and > zeroed-grain GTE is used to clear out the cluster, no need to take > care of parent cluster allocation and actual data at all. That's > where the efficiency comes. The question is when QEMU should upgrade images. It's safest to avoid silently increasing the image file's version requirements. But it would be nice to allow upgrading if the users wishes to do that. It doesn't need to be solved in this patch series. Stefan