preallocate CPU usage - pre4

Matt McCutchen matt at
Mon Nov 19 02:48:03 GMT 2007

On Sun, 2007-11-18 at 18:10 -0700, Rob Bosch wrote:
> Matt, I have absolutely no programming skills for developing my own
> program!  I'd be happy to compile and test a program however.  

Attached is the C++ source for a simple program "allocate" to allocate a
file.  Call the program like "./allocate thefile 77000000000".

> Are you going to put the fix for the preallocate patch in the 3.0 next
> pre-release or release?  

That's Wayne's job.

I notice that the Linux kernel 2.6.23 has gained a system call
"fallocate" that preallocates at the filesystem level like Cygwin's
implementation of posix_fallocate; thus, preallocation may become (at
least slightly) helpful on Linux.  Unfortunately, neither ext2 nor
reiserfs supports this call yet, at least in the kernel on my computer;
I hope support will be added soon.

My computer's glibc seems to implement posix_fallocate to first attempt
fallocate and force allocation the slow/dumb way if that fails.
However, rsync probably wants to allocate if it can be done the fast way
and otherwise not bother.  To achieve this, rsync should call fallocate
if available, otherwise posix_fallocate if on Cygwin, otherwise nothing
at all; or if Cygwin adds fallocate as a synonym for its (good)
posix_fallocate, rsync can just call fallocate if available.

-------------- next part --------------
A non-text attachment was scrubbed...
Type: text/x-c++src
Size: 1091 bytes
Desc: not available
Url :

More information about the rsync mailing list