Use "use warnings" rather than -w on the #! line.
[rsync/rsync-patches.git] / drop-cache.diff
index 69b3ac3..fcb15a9 100644 (file)
@@ -56,15 +56,16 @@ You can get the latest edition of the patch from
 cheers
 tobi
 
 cheers
 tobi
 
-Changes: 
+Changes:
 
  2007-04-23
 
 * pass --drop-cache on to the remote server
 * make test works now
 
 
  2007-04-23
 
 * pass --drop-cache on to the remote server
 * make test works now
 
---- old/checksum.c
-+++ new/checksum.c
+diff --git a/checksum.c b/checksum.c
+--- a/checksum.c
++++ b/checksum.c
 @@ -26,6 +26,10 @@ extern int protocol_version;
  
  int csum_length = SHORT_SUM_LENGTH; /* initial value */
 @@ -26,6 +26,10 @@ extern int protocol_version;
  
  int csum_length = SHORT_SUM_LENGTH; /* initial value */
@@ -76,8 +77,9 @@ Changes:
  /*
    a simple 32 bit checksum that can be upadted from either end
    (inspired by Mark Adler's Adler-32 checksum)
  /*
    a simple 32 bit checksum that can be upadted from either end
    (inspired by Mark Adler's Adler-32 checksum)
---- old/cleanup.c
-+++ new/cleanup.c
+diff --git a/cleanup.c b/cleanup.c
+--- a/cleanup.c
++++ b/cleanup.c
 @@ -46,7 +46,13 @@ void close_all(void)
        int fd;
        int ret;
 @@ -46,7 +46,13 @@ void close_all(void)
        int fd;
        int ret;
@@ -92,22 +94,24 @@ Changes:
        max_fd = sysconf(_SC_OPEN_MAX) - 1;
        for (fd = max_fd; fd >= 0; fd--) {
                if ((ret = do_fstat(fd, &st)) == 0) {
        max_fd = sysconf(_SC_OPEN_MAX) - 1;
        for (fd = max_fd; fd >= 0; fd--) {
                if ((ret = do_fstat(fd, &st)) == 0) {
---- old/configure.in
-+++ new/configure.in
-@@ -561,7 +561,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strd
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -554,7 +554,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
      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 \
      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
---- old/fileio.c
-+++ new/fileio.c
+ dnl cygwin iconv.h defines iconv_open as libiconv_open
+ if test x"$ac_cv_func_iconv_open" != x"yes"; then
+diff --git a/fileio.c b/fileio.c
+--- a/fileio.c
++++ b/fileio.c
 @@ -30,6 +30,12 @@ extern int sparse_files;
  static char last_byte;
 @@ -30,6 +30,12 @@ extern int sparse_files;
  static char last_byte;
- static int last_sparse;
+ static OFF_T sparse_seek = 0;
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -117,11 +121,12 @@ Changes:
 +
  int sparse_end(int f)
  {
 +
  int sparse_end(int f)
  {
-       if (last_sparse) {
---- old/generator.c
-+++ new/generator.c
-@@ -115,6 +115,10 @@ static int dir_tweaking;
- static int need_retouch_dir_times;
+       int ret;
+diff --git a/generator.c b/generator.c
+--- a/generator.c
++++ b/generator.c
+@@ -115,6 +115,10 @@ static int need_retouch_dir_times;
+ static int need_retouch_dir_perms;
  static const char *solo_file = NULL;
  
 +#ifdef HAVE_POSIX_FADVISE64
  static const char *solo_file = NULL;
  
 +#ifdef HAVE_POSIX_FADVISE64
@@ -129,19 +134,20 @@ Changes:
 +#endif
 +
  /* For calling delete_item() and delete_dir_contents(). */
 +#endif
 +
  /* For calling delete_item() and delete_dir_contents(). */
- #define DEL_RECURSE           (1<<1) /* recurse */
- #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;
+ #define DEL_NO_UID_WRITE      (1<<0) /* file/dir has our uid w/o write perm */
+ #define DEL_RECURSE           (1<<1) /* if dir, delete all contents */
+diff --git a/options.c b/options.c
+--- a/options.c
++++ b/options.c
+@@ -60,6 +60,7 @@ int preserve_uid = 0;
+ int preserve_gid = 0;
  int preserve_times = 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;
  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)
+@@ -327,6 +328,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");
    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,10 +156,10 @@ Changes:
 +#endif
    rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
    rprintf(F,"     --append                append data onto shorter files\n");
 +#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[] 
-   {"size-only",        0,  POPT_ARG_NONE,   &size_only, 0, 0, 0 },
-   {"one-file-system", 'x', POPT_ARG_NONE,   0, 'x', 0, 0 },
+   rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
+@@ -535,6 +539,9 @@ static struct poptOption long_options[] = {
+   {"no-one-file-system",'x',POPT_ARG_VAL,   &one_file_system, 0, 0, 0 },
+   {"no-x",            'x', POPT_ARG_VAL,    &one_file_system, 0, 0, 0 },
    {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
 +#ifdef HAVE_POSIX_FADVISE64
 +  {"drop-cache",       0,  POPT_ARG_NONE,   &drop_cache, 0, 0, 0 },
    {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
 +#ifdef HAVE_POSIX_FADVISE64
 +  {"drop-cache",       0,  POPT_ARG_NONE,   &drop_cache, 0, 0, 0 },
@@ -161,7 +167,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 },
    {"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
+@@ -1720,6 +1727,11 @@ void server_options(char **args, int *argc_p)
        if (!am_sender)
                args[ac++] = "--sender";
  
        if (!am_sender)
                args[ac++] = "--sender";
  
@@ -172,12 +178,13 @@ Changes:
 +
        x = 1;
        argstr[0] = '-';
 +
        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;
+diff --git a/receiver.c b/receiver.c
+--- a/receiver.c
++++ b/receiver.c
+@@ -63,6 +63,10 @@ static flist_ndx_list batch_redo_list;
  /* We're either updating the basis file or an identical copy: */
  /* 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)
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -186,17 +193,18 @@ Changes:
  /*
   * get_tmpname() - create a tmp filename for a given filename
   *
  /*
   * get_tmpname() - create a tmp filename for a given filename
   *
---- old/rsync.yo
-+++ new/rsync.yo
-@@ -335,6 +335,7 @@ to the detailed description below for a 
+diff --git a/rsync.yo b/rsync.yo
+--- a/rsync.yo
++++ b/rsync.yo
+@@ -356,6 +356,7 @@ to the detailed description below for a complete description.  verb(
       --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
       --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
-  -W, --whole-file            copy files whole (without rsync algorithm)
+  -n, --dry-run               perform a trial run with no changes made
+  -W, --whole-file            copy files whole (w/o delta-xfer algorithm)
   -x, --one-file-system       don't cross filesystem boundaries
   -x, --one-file-system       don't cross filesystem boundaries
-@@ -956,6 +957,10 @@ NOTE: Don't use this option when the des
+@@ -1053,6 +1054,10 @@ NOTE: Don't use this option when the destination is a Solaris "tmpfs"
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
  filesystem. It doesn't seem to handle seeks over null regions
  correctly and ends up corrupting the files.
  
@@ -204,14 +212,15 @@ 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.
 +
 +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.
---- old/sender.c
-+++ new/sender.c
+ 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/sender.c b/sender.c
+--- a/sender.c
++++ b/sender.c
 @@ -46,6 +46,10 @@ extern int write_batch;
  extern struct stats stats;
 @@ -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)
  
 +#ifdef HAVE_POSIX_FADVISE64
 +#define close(fd) fadv_close(fd)
@@ -220,19 +229,21 @@ Changes:
  /**
   * @file
   *
  /**
   * @file
   *
---- old/t_unsafe.c
-+++ new/t_unsafe.c
+diff --git a/t_unsafe.c b/t_unsafe.c
+--- a/t_unsafe.c
++++ b/t_unsafe.c
 @@ -28,6 +28,7 @@ int am_root = 0;
  int read_only = 0;
  int list_only = 0;
  int verbose = 0;
 +int drop_cache = 0;
  int preserve_perms = 0;
 @@ -28,6 +28,7 @@ int am_root = 0;
  int read_only = 0;
  int list_only = 0;
  int verbose = 0;
 +int drop_cache = 0;
  int preserve_perms = 0;
+ int preserve_executability = 0;
  
  
- int
---- old/util.c
-+++ new/util.c
-@@ -25,6 +25,7 @@
+diff --git a/util.c b/util.c
+--- a/util.c
++++ b/util.c
+@@ -26,6 +26,7 @@
  extern int verbose;
  extern int dry_run;
  extern int module_id;
  extern int verbose;
  extern int dry_run;
  extern int module_id;
@@ -240,7 +251,7 @@ Changes:
  extern int modify_window;
  extern int relative_paths;
  extern int human_readable;
  extern int modify_window;
  extern int relative_paths;
  extern int human_readable;
-@@ -39,6 +40,131 @@ char curr_dir[MAXPATHLEN];
+@@ -42,6 +43,131 @@ char curr_dir[MAXPATHLEN];
  unsigned int curr_dir_len;
  int curr_dir_depth; /* This is only set for a sanitizing daemon. */
  
  unsigned int curr_dir_len;
  int curr_dir_depth; /* This is only set for a sanitizing daemon. */
  
@@ -354,12 +365,12 @@ Changes:
 +              fadv_fd_init_func();
 +              fadv_close_buffer_size += pos - fadv_fd_pos[fd];
 +              fadv_close_ring[fadv_close_ring_head] = newfd;
 +              fadv_fd_init_func();
 +              fadv_close_buffer_size += pos - fadv_fd_pos[fd];
 +              fadv_close_ring[fadv_close_ring_head] = newfd;
-+              fadv_close_ring_head = (fadv_close_ring_head + 1) % fadv_max_fd;        
++              fadv_close_ring_head = (fadv_close_ring_head + 1) % fadv_max_fd;
 +              fadv_close_ring_size ++;
 +              if (fadv_close_ring_size == fadv_max_fd || fadv_close_buffer_size > 1024*1024 ){
 +                      /* it seems fastest to drop things 'in groups' */
 +                      fadv_close_all();
 +              fadv_close_ring_size ++;
 +              if (fadv_close_ring_size == fadv_max_fd || fadv_close_buffer_size > 1024*1024 ){
 +                      /* it seems fastest to drop things 'in groups' */
 +                      fadv_close_all();
-+              } 
++              }
 +      }
 +      return close(fd);
 +}
 +      }
 +      return close(fd);
 +}