[libvirt] [PATCH v2 1/3] virfile: Refactor safezero, introduce virFileFdPosixFallocate

Daniel P. Berrange berrange at redhat.com
Fri Aug 22 14:46:11 UTC 2014


On Mon, Aug 11, 2014 at 04:30:19PM -0400, John Ferlan wrote:
> Currently the safezero() function uses build conditionals to choose either
> the posix_fallocate() or mmap() with a fallback to safewrite() in order to
> preallocate a file.
> 
> This patch will modify the logic in order to allow fallbacks in the
> event that posix_fallocate() or the ftruncate()and mmap() doesn't work
> properly. The fallback will be to use the slow safewrite of zero filled
> buffers to the file.

Have you actually encountered failing of posix_fallocate() in the
real world ?  It is supposed to automatically fallback to the
equivalent of writing zeros if the filesystem / kernel does not
support it, so we should not have todo runtime fallback ourselves.
The existance of fallback is the main distinction between the
posix_fallocate() and fallocate() system calls.

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 :|




More information about the libvir-list mailing list