++dit(bf(--preallocate)) This tells the receiver to allocate each destination
++file to its eventual size before writing data to the file. Rsync will only use
++the real filesystem-level preallocation support provided by Linux's
++bf(fallocate)(2) system call or Cygwin's bf(posix_fallocate)(3), not the slow
++glibc implementation that writes a zero byte into each block.
++
++Without this option, larger files may not be entirely contiguous on the
++filesystem, but with this option rsync will probably copy more slowly. If the
++destination is not an extent-supporting filesystem (such as ext4, xfs, NTFS,
++etc.), this option may have no positive effect at all.
++
+ dit(bf(-n, --dry-run)) This makes rsync perform a trial run that doesn't
+ make any changes (and produces mostly the same output as a real run). It
+ is most commonly used in combination with the bf(-v, --verbose) and/or
+diff --git a/syscall.c b/syscall.c
+--- a/syscall.c
++++ b/syscall.c
+@@ -29,6 +29,10 @@
+ #include <sys/attr.h>
+ #endif
+
++#if defined HAVE_SYS_FALLOCATE && !defined HAVE_FALLOCATE
++#include <sys/syscall.h>
++#endif
++
+ extern int dry_run;
+ extern int am_root;
+ extern int am_sender;
+@@ -325,3 +329,25 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
+ return lseek(fd, offset, whence);
+ #endif
+ }
++
++#ifdef SUPPORT_PREALLOCATION
++int do_fallocate(int fd, OFF_T offset, OFF_T length)
++{
++#ifdef FALLOC_FL_KEEP_SIZE
++#define DO_FALLOC_OPTIONS FALLOC_FL_KEEP_SIZE
++#else
++#define DO_FALLOC_OPTIONS 0
++#endif
++ RETURN_ERROR_IF(dry_run, 0);
++ RETURN_ERROR_IF_RO_OR_LO;
++#if defined HAVE_FALLOCATE
++ return fallocate(fd, DO_FALLOC_OPTIONS, offset, length);
++#elif defined HAVE_SYS_FALLOCATE
++ return syscall(SYS_fallocate, fd, DO_FALLOC_OPTIONS, (loff_t)offset, (loff_t)length);
++#elif defined HAVE_EFFICIENT_POSIX_FALLOCATE
++ return posix_fallocate(fd, offset, length);
++#else
++#error Coding error in SUPPORT_PREALLOCATION logic.
++#endif
++}
++#endif
+diff --git a/t_stub.c b/t_stub.c
+--- a/t_stub.c
++++ b/t_stub.c
+@@ -22,6 +22,7 @@