The patches for 3.3.0.
[rsync-patches.git] / direct-io.diff
index 11c49edfde184f5222099e19d3521ed078ae35c1..8aaabd7e055448385971792b25f2b46bfb6c269f 100644 (file)
@@ -10,19 +10,19 @@ To use this patch, run these commands for a successful build:
     ./configure                         (optional if already run)
     make
 
-based-on: cdf58a7aba23e31653661c950c2c870b96de08fa
+based-on: 6c8ca91c731b7bf2b081694bda85b7dadc2b7aff
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
 @@ -24,6 +24,7 @@
- #include "latest-year.h"
+ #include "ifuncs.h"
  #include <popt.h>
  
 +extern int direct_io;
  extern int module_id;
  extern int local_server;
  extern int sanitize_paths;
-@@ -911,6 +912,8 @@ static struct poptOption long_options[] = {
+@@ -764,6 +765,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 },
@@ -34,7 +34,7 @@ diff --git a/options.c b/options.c
 diff --git a/rsync.1.md b/rsync.1.md
 --- a/rsync.1.md
 +++ b/rsync.1.md
-@@ -406,6 +406,7 @@ detailed description below for a complete description.
+@@ -495,6 +495,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
@@ -42,17 +42,18 @@ diff --git a/rsync.1.md b/rsync.1.md
  --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
-@@ -2813,6 +2814,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).
+@@ -3433,6 +3434,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/
 +
@@ -71,21 +72,21 @@ diff --git a/syscall.c b/syscall.c
  #ifndef S_BLKSIZE
  # if defined hpux || defined __hpux__ || defined __hpux
  #  define S_BLKSIZE 1024
-@@ -82,7 +84,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;
-@@ -207,6 +214,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
@@ -94,7 +95,7 @@ diff --git a/syscall.c b/syscall.c
  
        return open(pathname, flags | O_BINARY, mode);
  }
-@@ -575,6 +584,9 @@ int do_open_nofollow(const char *pathname, int flags)
+@@ -684,6 +693,9 @@ int do_open_nofollow(const char *pathname, int flags)
  #endif
        }