preallocate CPU usage - pre4

Matt McCutchen
Sun, 18 Nov 2007 18:45:26 -0000

On Mon, 2007-11-05 at 06:25 -0700, Rob Bosch wrote:
> When I use the preallocate patch and create a 77GB file using the function
I
> get a CPU spike on the server-side.

I don't think reproducing the CPU spike on Linux will be meaningful
because Linux treats posix_fallocate differently from Cygwin: Cygwin
just reserves space for the file while Linux actually writes a byte into
every disk block of the file.  We need to figure out why rsync on your
Cygwin is giving a different result from Corinna's Cygwin.

I did notice that the preallocation code incorrectly uses 32-bit ints
for some file offsets; it should use OFF_Ts.  The attached patch fixes
this.  However, the mistake didn't affect the main call to
posix_fallocate, so it doesn't explain the problem you are having.

Here are two things I suggest that you try:

1. Strace rsync and make sure posix_fallocate is getting called with the
correct arguments.

2. Write your own program that allocates a 77GB file with
posix_fallocate and see if the same thing happens.

Matt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: preallocate-off-t.diff
Type: text/x-patch
Size: 850 bytes
Desc: not available