My improved version of a connection-timeout patch.
[rsync/rsync-patches.git] / drop-cache.diff
index 69b3ac3..e0a3558 100644 (file)
@@ -94,12 +94,12 @@ Changes:
                if ((ret = do_fstat(fd, &st)) == 0) {
 --- old/configure.in
 +++ new/configure.in
-@@ -561,7 +561,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+@@ -547,7 +547,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
      strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
      setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
      strerror putenv iconv_open locale_charset nl_langinfo getxattr \
--    extattr_get_link sigaction sigprocmask)
-+    extattr_get_link sigaction sigprocmask posix_fadvise64)
+-    extattr_get_link sigaction sigprocmask setattrlist)
++    extattr_get_link sigaction sigprocmask setattrlist posix_fadvise64)
  
  AC_CHECK_FUNCS(getpgrp tcgetpgrp)
  if test $ac_cv_func_getpgrp = yes; then
@@ -107,7 +107,7 @@ Changes:
 +++ new/fileio.c
 @@ -30,6 +30,12 @@ extern int sparse_files;
  static char last_byte;
- static int last_sparse;
+ static size_t sparse_seek = 0;
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -117,11 +117,11 @@ Changes:
 +
  int sparse_end(int f)
  {
-       if (last_sparse) {
+       int ret;
 --- old/generator.c
 +++ new/generator.c
-@@ -115,6 +115,10 @@ static int dir_tweaking;
- static int need_retouch_dir_times;
+@@ -112,6 +112,10 @@ static int need_retouch_dir_times;
+ static int need_retouch_dir_perms;
  static const char *solo_file = NULL;
  
 +#ifdef HAVE_POSIX_FADVISE64
@@ -133,15 +133,15 @@ Changes:
  #define DEL_DIR_IS_EMPTY      (1<<2) /* internal delete_FUNCTIONS use only */
 --- old/options.c
 +++ new/options.c
-@@ -57,6 +57,7 @@ int preserve_gid = 0;
+@@ -58,6 +58,7 @@ int preserve_uid = 0;
+ int preserve_gid = 0;
  int preserve_times = 0;
- int omit_dir_times = 0;
  int update_only = 0;
 +int drop_cache = 0;
  int cvs_exclude = 0;
  int dry_run = 0;
  int do_xfers = 1;
-@@ -310,6 +311,9 @@ void usage(enum logcode F)
+@@ -319,6 +320,9 @@ void usage(enum logcode F)
    rprintf(F,"     --backup-dir=DIR        make backups into hierarchy based in DIR\n");
    rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
    rprintf(F," -u, --update                skip files that are newer on the receiver\n");
@@ -150,8 +150,8 @@ Changes:
 +#endif
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
-   rprintf(F," -d, --dirs                  transfer directories without recursing\n");
-@@ -506,6 +510,9 @@ static struct poptOption long_options[] 
+   rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
+@@ -522,6 +526,9 @@ static struct poptOption long_options[] 
    {"size-only",        0,  POPT_ARG_NONE,   &size_only, 0, 0, 0 },
    {"one-file-system", 'x', POPT_ARG_NONE,   0, 'x', 0, 0 },
    {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
@@ -161,7 +161,7 @@ Changes:
    {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
    {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
-@@ -1603,6 +1610,11 @@ void server_options(char **args,int *arg
+@@ -1659,6 +1666,11 @@ void server_options(char **args, int *ar
        if (!am_sender)
                args[ac++] = "--sender";
  
@@ -172,12 +172,12 @@ Changes:
 +
        x = 1;
        argstr[0] = '-';
-       for (i = 0; i < verbose; i++)
 --- old/receiver.c
 +++ new/receiver.c
 @@ -62,6 +62,10 @@ static int phase = 0, redoing = 0;
  /* We're either updating the basis file or an identical copy: */
- static int updating_basis;
+ static int updating_basis_or_equiv;
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -188,15 +188,15 @@ Changes:
   *
 --- old/rsync.yo
 +++ new/rsync.yo
-@@ -335,6 +335,7 @@ to the detailed description below for a 
+@@ -352,6 +352,7 @@ to the detailed description below for a 
       --super                 receiver attempts super-user activities
       --fake-super            store/recover privileged attrs using xattrs
   -S, --sparse                handle sparse files efficiently
 +     --drop-cache            tell OS to drop caching of file data
-  -n, --dry-run               show what would have been transferred
+  -n, --dry-run               perform a trial run with no changes made
   -W, --whole-file            copy files whole (without rsync algorithm)
   -x, --one-file-system       don't cross filesystem boundaries
-@@ -956,6 +957,10 @@ NOTE: Don't use this option when the des
+@@ -1022,6 +1023,10 @@ NOTE: Don't use this option when the des
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
@@ -204,14 +204,14 @@ Changes:
 +prevents rsync from filling up the filesystem cache.  This can sometimes help
 +to make a system perform better by keeping non-rsync files in the disk cache.
 +
- dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers,
- instead it will just report the actions it would have taken.
+ 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
 --- old/sender.c
 +++ new/sender.c
 @@ -46,6 +46,10 @@ extern int write_batch;
  extern struct stats stats;
- extern struct file_list *cur_flist, *first_flist;
+ extern struct file_list *cur_flist, *first_flist, *dir_flist;
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -232,7 +232,7 @@ Changes:
  int
 --- old/util.c
 +++ new/util.c
-@@ -25,6 +25,7 @@
+@@ -26,6 +26,7 @@
  extern int verbose;
  extern int dry_run;
  extern int module_id;
@@ -240,7 +240,7 @@ Changes:
  extern int modify_window;
  extern int relative_paths;
  extern int human_readable;
-@@ -39,6 +40,131 @@ char curr_dir[MAXPATHLEN];
+@@ -41,6 +42,131 @@ char curr_dir[MAXPATHLEN];
  unsigned int curr_dir_len;
  int curr_dir_depth; /* This is only set for a sanitizing daemon. */