Received: from eggs.gnu.org ([2001:4830:134:3::10]:47350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W45NE-0004Fc-8e for qemu-devel@nongnu.org; Fri, 17 Jan 2014 04:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W45N5-0000yx-SJ for qemu-devel@nongnu.org; Fri, 17 Jan 2014 04:05:56 -0500 Received: from mail-ea0-x22d.google.com ([2a00:1450:4013:c01::22d]:36452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W45N5-0000ym-Lf for qemu-devel@nongnu.org; Fri, 17 Jan 2014 04:05:47 -0500 Received: by mail-ea0-f173.google.com with SMTP id o10so1560922eaj.18 for ; Fri, 17 Jan 2014 01:05:46 -0800 (PST) Date: Fri, 17 Jan 2014 17:05:36 +0800 From: Stefan Hajnoczi Message-ID: <20140117090536.GE31039@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [RFC PATCH v4 0/4] qemu-img: add preallocation=full List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Kevin Wolf , Fam Zheng , Peter Lieven , qemu-devel@nongnu.org On Fri, Dec 27, 2013 at 11:05:50AM +0800, Hu Tao wrote: > This series implements full image preallocation to create a non-sparse image > file at creation time, both for raw and qcow2 format. The purpose is to avoid > performance deterioration of the guest cause by sparse image. > > v4: - remove bdrv_preallocate and make preallocation a bdrv_create_file option > - prealloc_mode -> PreallocMode and add it to QAPI > - fix return value in raw_preallocate2 > > Hu Tao (4): > qapi: introduce PreallocMode > raw,qcow2: don't convert file size to sector size > raw-posix: Add full image preallocation option > qcow2: Add full image preallocation option > > block/qcow2.c | 64 +++++++++++++++++++++++++++++++++++++++++++++---------- > block/raw-posix.c | 50 +++++++++++++++++++++++++++++++++++++++++-- > qapi-schema.json | 12 +++++++++++ > 3 files changed, 113 insertions(+), 13 deletions(-) I've thought more about the lack of progress information during posix_fallocate(3). Users creating 10s or 100s of GB images may have to wait for a long time if posix_fallocate(3) is implemented in userspace (effectively dd if=/dev/zero of=vm.img). But I think adding preallocate=full is a good starting point. Modern file systems implement it efficiently so the wait time should be negligible. If creating images takes too long we could consider a fancier interface later. I left comments on specific patches.