./configure (optional if already run)
make
-based-on: 8695bcc2b140b2518254234659a03b96f04055fc
+based-on: 5fcf20ee9d8abf7aae8578354f82c6f500822e06
diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -25,6 +25,7 @@
- #include "latest-year.h"
+@@ -24,6 +24,7 @@
+ #include "ifuncs.h"
#include <popt.h>
+extern int direct_io;
extern int module_id;
extern int local_server;
extern int sanitize_paths;
-@@ -975,6 +976,8 @@ static struct poptOption long_options[] = {
+@@ -763,6 +764,8 @@ static struct poptOption long_options[] = {
{"partial-dir", 0, POPT_ARG_STRING, &partial_dir, 0, 0, 0 },
{"delay-updates", 0, POPT_ARG_VAL, &delay_updates, 1, 0, 0 },
{"no-delay-updates", 0, POPT_ARG_VAL, &delay_updates, 0, 0, 0 },
diff --git a/rsync.1.md b/rsync.1.md
--- a/rsync.1.md
+++ b/rsync.1.md
-@@ -409,6 +409,7 @@ detailed description below for a complete description.
+@@ -434,6 +434,7 @@ has its own detailed description later in this manpage.
--partial keep partially transferred files
--partial-dir=DIR put a partially transferred file into DIR
--delay-updates put all updated files into place at end
--prune-empty-dirs, -m prune empty directory chains from file-list
--numeric-ids don't map uid/gid values by user/group name
--usermap=STRING custom username mapping
-@@ -3012,6 +3013,16 @@ your home directory (remove the '=' for that).
- update algorithm that is even more atomic (it uses `--link-dest` and a
- parallel hierarchy of files).
+@@ -3339,6 +3340,17 @@ expand it.
+ update algorithm that is even more atomic (it uses [`--link-dest`](#opt)
+ and a parallel hierarchy of files).
+0. `--direct-io`
+
+ This option opens files with a direct-I/O flag that makes the file I/O
+ avoid the buffer cache. The option only affects one side of the transfer
+ (unless the transfer is local). If you want it to affect both sides, use
-+ the `--remote-option` (`-M`) option to specify it for the remote side. For
-+ instance, this specifies it for both sides:
++ the [`--remote-option`](#opt) (`-M`) option to specify it for the remote
++ side. For instance, this specifies it for both sides (via brace
++ expansion):
+
+ > rsync -av {,-M}--direct-io /src/ host:/dest/
+
#ifndef S_BLKSIZE
# if defined hpux || defined __hpux__ || defined __hpux
# define S_BLKSIZE 1024
-@@ -91,7 +93,12 @@ int do_symlink(const char *lnk, const char *fname)
+@@ -95,7 +97,12 @@ int do_symlink(const char *lnk, const char *path)
* and write the lnk into it. */
if (am_root < 0) {
int ok, len = strlen(lnk);
-- int fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+- int fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
+ int flags = O_WRONLY|O_CREAT|O_TRUNC;
+
+ if (direct_io)
+ flags |= O_DIRECT;
+
-+ int fd = open(fname, flags, S_IWUSR|S_IRUSR);
++ int fd = open(path, flags, S_IWUSR|S_IRUSR);
if (fd < 0)
return -1;
ok = write(fd, lnk, len) == len;
-@@ -220,6 +227,8 @@ int do_open(const char *pathname, int flags, mode_t mode)
+@@ -224,6 +231,8 @@ int do_open(const char *pathname, int flags, mode_t mode)
if (open_noatime)
flags |= O_NOATIME;
#endif
return open(pathname, flags | O_BINARY, mode);
}
-@@ -624,6 +633,9 @@ int do_open_nofollow(const char *pathname, int flags)
+@@ -684,6 +693,9 @@ int do_open_nofollow(const char *pathname, int flags)
#endif
}