[libvirt] [PATCH] Use posix_fallocate() to allocate disk space

Amit Shah amit.shah at redhat.com
Wed Mar 4 13:58:03 UTC 2009

On (Wed) Mar 04 2009 [12:55:22], Daniel P. Berrange wrote:
> On Mon, Mar 02, 2009 at 03:02:11PM +0530, Amit Shah wrote:
> > 
> > Inspite of this if some feedback is needed for a non-extents-based file
> > system, a run-time probe for the underlying file system can be made and
> > we could default to a chunk-based allocation in that case.
> These results are quite impressive. It is better by orders of magnitude
> for modern filesystems, and even on ext3 it has a slight edge. So I'm
> inclined to say we should use posix_fallocate() by default at all
> times. 
> When we introduce the API for incremental feedback, we could do something
> like call fallocate() in 1GB chunks so we can get some reasonable amount
> of feedback while still keeping it very fast & well allocated on disk. 

Oh btw fallocate() seems to be an O(1) operation (at least on new file
systems). Allocating a 5G file also gave me 0s:few microseconds delay.

> And of course, just fallocate() the whole thing upfront if the user does
> not provide a callback for requesting feedback.


More information about the libvir-list mailing list