On Fri, Aug 22, 2014 at 01:25:56PM +0100, Richard W.M. Jones wrote: > > 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() will itself fallback to writing zeros to disk if the filesystem can't do the fast allocation method. So I can't see any reason to have separate options for this. Just have a preallocation=full option which - at compile time - chooses between posix_fallocate and write(). This is what we've done in libvirt for many years now and no one has ever asked for more http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/util/virfile.c;h=b6f5e3f2cbbcc6768d764009b238b2349bee3fee;hb=HEAD#l1037 We actually try to use mmap() before going to write() since that is slightly faster. http://log.amitshah.net/2009/03/comparison-of-file-systems-and-speeding-up-applications/ Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|