From: Wayne Davison Date: Sun, 2 Jun 2013 19:37:48 +0000 (-0700) Subject: Avoid preallocation on inplace file that is already long enough. X-Git-Tag: v3.1.0pre1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ab8e166f44940dad79e8b80ae0b960336efa10c;p=thirdparty%2Frsync.git Avoid preallocation on inplace file that is already long enough. --- diff --git a/receiver.c b/receiver.c index 5ba370ba..622f462a 100644 --- a/receiver.c +++ b/receiver.c @@ -241,7 +241,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, OFF_T preallocated_len = 0; #endif - if (preallocate_files && fd != -1 && total_size > 0) { + if (preallocate_files && fd != -1 && total_size > 0 && (!inplace || total_size > size_r)) { /* Try to preallocate enough space for file's eventual length. Can * reduce fragmentation on filesystems like ext4, xfs, and NTFS. */ if (do_fallocate(fd, 0, total_size) == 0) {