From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKorw-0004j8-JA for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKorr-0003CY-Qg for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:27:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKorr-0003CU-I8 for qemu-devel@nongnu.org; Fri, 22 Aug 2014 09:26:59 -0400 Date: Fri, 22 Aug 2014 14:26:53 +0100 From: "Richard W.M. Jones" Message-ID: <20140822132653.GI1302@redhat.com> References: <20140728084846.GH31917@G08FNSTD100614.fnst.cn.fujitsu.com> <20140822122556.GJ14001@redhat.com> <20140822131331.GN32377@noname.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140822131331.GN32377@noname.redhat.com> Subject: Re: [Qemu-devel] [PATCH v12 0/6] qcow2, raw: add preallocation=full and preallocation=falloc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Hu Tao , Max Reitz , qemu-devel@nongnu.org, Stefan Hajnoczi , Yasunori Goto On Fri, Aug 22, 2014 at 03:13:31PM +0200, Kevin Wolf wrote: > Am 22.08.2014 um 14:25 hat Richard W.M. Jones geschrieben: > > > > On Mon, Jul 28, 2014 at 04:48:46PM +0800, Hu Tao wrote: > > > ping... > > > > > > All the 6 patches have reviewed-by now. > > > > > > On Fri, Jul 11, 2014 at 02:09:57PM +0800, Hu Tao wrote: > > > > This series adds two preallocation mode to qcow2 and raw: > > > > > > > > Option preallocation=full preallocates disk space for image by writing > > > > zeros to disk, this ensures disk space in any cases. > > > > > > > > Option preallocation=falloc preallocates disk space by calling > > > > posix_fallocate(). This is faster than preallocation=full. > > > > Sorry if this was discussed before, but why would anyone use > > preallocation=full if preallocation=falloc was possible? > > > > Shouldn't preallocation=full simply use posix_fallocate if it's > > available, and fall back to writing zeroes if not? > > posix_fallocate() is basically metadata preallocation on the file > system level. If any lower levels involve allocations as well, does > posix_fallocate() allocate them there? It's a good question. >>From observation of ext4 using libguestfs, the answer is (surprisingly to me) no. Writing zeroes won't necessarily allocate either -- eg. if detect_zeroes is enabled, or lots of other exotic storage schemes that look into what you're writing. I think my point still stands however. There's no point giving callers an option. QEmu should do the best possible job. It is the only agent in a position to know how best to fully allocate the backing file. Rich. $ guestfish -N fs:ext4:1G -m /dev/sda1 Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell > fallocate64 /test 100M > ll / total 102424 drwxr-xr-x 3 root root 4096 Aug 22 13:22 . drwxr-xr-x 19 root root 4096 Aug 22 13:21 .. drwx------ 2 root root 16384 Aug 22 13:21 lost+found -rw-r--r-- 1 root root 104857600 Aug 22 13:22 test > exit $ du -sh test1.img 33M test1.img -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v