File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / patches / slow-down.diff
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 00:32:36 2021 UTC (4 years ago) by misho
Branches: rsync, MAIN
CVS tags: v3_2_3, HEAD
rsync 3.2.3

    1: This patch adds a --slow-down=USECs option that causes the sender to scan
    2: the filelist more slowly, and the generator to scan for deletions more
    3: slowly.  It doesn't do anything to make anyone slow down during the normal
    4: transfer processing, though.
    5: 
    6: The idea is to lessen rsync's impact on disk I/O.  Unfortunately, there
    7: should really be a way to affect more of rsync's processing, perhaps by
    8: specifying a maximum disk I/O rate (and have that affect a maximum stat()
    9: rate or something like that).
   10: 
   11: To use this patch, run these commands for a successful build:
   12: 
   13:     patch -p1 <patches/slow-down.diff
   14:     ./configure                           (optional if already run)
   15:     make
   16: 
   17: based-on: e94bad1c156fc3910f24e2b3b71a81b0b0bdeb70
   18: diff --git a/flist.c b/flist.c
   19: --- a/flist.c
   20: +++ b/flist.c
   21: @@ -73,6 +73,7 @@ extern int sender_symlink_iconv;
   22:  extern int output_needs_newline;
   23:  extern int sender_keeps_checksum;
   24:  extern int unsort_ndx;
   25: +extern unsigned long sleep_asec;
   26:  extern uid_t our_uid;
   27:  extern struct stats stats;
   28:  extern char *filesfrom_host;
   29: @@ -1837,6 +1838,9 @@ static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
   30:  		}
   31:  
   32:  		send_file_name(f, flist, fbuf, NULL, flags, filter_level);
   33: +		/* Sleep for a bit, to avoid hammering the disk. */
   34: +		if (sleep_asec)
   35: +			usleep(sleep_asec);
   36:  	}
   37:  
   38:  	fbuf[len] = '\0';
   39: diff --git a/options.c b/options.c
   40: --- a/options.c
   41: +++ b/options.c
   42: @@ -113,6 +113,7 @@ int size_only = 0;
   43:  int daemon_bwlimit = 0;
   44:  int bwlimit = 0;
   45:  int fuzzy_basis = 0;
   46: +unsigned long sleep_asec = 0;
   47:  size_t bwlimit_writemax = 0;
   48:  int ignore_existing = 0;
   49:  int ignore_non_existing = 0;
   50: @@ -764,6 +765,7 @@ static struct poptOption long_options[] = {
   51:    {"itemize-changes", 'i', POPT_ARG_NONE,   0, 'i', 0, 0 },
   52:    {"no-itemize-changes",0, POPT_ARG_VAL,    &itemize_changes, 0, 0, 0 },
   53:    {"no-i",             0,  POPT_ARG_VAL,    &itemize_changes, 0, 0, 0 },
   54: +  {"slow-down",        0,  POPT_ARG_LONG,   &sleep_asec, 0, 0, 0 },
   55:    {"bwlimit",          0,  POPT_ARG_STRING, &bwlimit_arg, OPT_BWLIMIT, 0, 0 },
   56:    {"no-bwlimit",       0,  POPT_ARG_VAL,    &bwlimit, 0, 0, 0 },
   57:    {"backup",          'b', POPT_ARG_VAL,    &make_backups, 1, 0, 0 },
   58: diff --git a/rsync.1.md b/rsync.1.md
   59: --- a/rsync.1.md
   60: +++ b/rsync.1.md
   61: @@ -459,6 +459,7 @@ detailed description below for a complete description.
   62:  --early-input=FILE       use FILE for daemon's early exec input
   63:  --list-only              list the files instead of copying them
   64:  --bwlimit=RATE           limit socket I/O bandwidth
   65: +--slow-down=USECs        sleep N usec while creating the filelist
   66:  --stop-after=MINS        Stop rsync after MINS minutes have elapsed
   67:  --stop-at=y-m-dTh:m      Stop rsync at the specified point in time
   68:  --write-batch=FILE       write a batched update to FILE
   69: diff -Nurp a/rsync.1 b/rsync.1
   70: --- a/rsync.1
   71: +++ b/rsync.1
   72: @@ -535,6 +535,7 @@ detailed description below for a complet
   73:  --early-input=FILE       use FILE for daemon's early exec input
   74:  --list-only              list the files instead of copying them
   75:  --bwlimit=RATE           limit socket I/O bandwidth
   76: +--slow-down=USECs        sleep N usec while creating the filelist
   77:  --stop-after=MINS        Stop rsync after MINS minutes have elapsed
   78:  --stop-at=y-m-dTh:m      Stop rsync at the specified point in time
   79:  --write-batch=FILE       write a batched update to FILE
   80: diff -Nurp a/rsync.1.html b/rsync.1.html
   81: --- a/rsync.1.html
   82: +++ b/rsync.1.html
   83: @@ -450,6 +450,7 @@ detailed description below for a complet
   84:  --early-input=FILE       use FILE for daemon's early exec input
   85:  --list-only              list the files instead of copying them
   86:  --bwlimit=RATE           limit socket I/O bandwidth
   87: +--slow-down=USECs        sleep N usec while creating the filelist
   88:  --stop-after=MINS        Stop rsync after MINS minutes have elapsed
   89:  --stop-at=y-m-dTh:m      Stop rsync at the specified point in time
   90:  --write-batch=FILE       write a batched update to FILE

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>