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
diff --git a/receiver.c b/receiver.c
index 24cf212..aded8d3 100644
--- a/receiver.c
+++ b/receiver.c
@@ -177,7 +177,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
char *map = NULL;
#ifdef SUPPORT_PREALLOCATION
- int preallocated_len = 0;
+ OFF_T preallocated_len = 0;
if (preallocate_files && fd != -1 && total_size > 0) {
/* Preallocate enough space for file's eventual length if
diff --git a/util.c b/util.c
index 4c7238d..2bc7844 100644
--- a/util.c
+++ b/util.c
@@ -274,8 +274,8 @@ int copy_file(const char *source, const char *dest, int ofd,
char buf[1024 * 8];
int len; /* Number of bytes read into `buf'. */
#ifdef SUPPORT_PREALLOCATION
- int preallocated_len = 0;
- int offset = 0;
+ OFF_T preallocated_len = 0;
+ OFF_T offset = 0;
#endif
if ((ifd = do_open(source, O_RDONLY, 0)) < 0) {
--
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html