The patches for 3.0.0pre7.
[rsync-patches.git] / link-by-hash.diff
1 Jason M. Felice wrote:
2
3 This patch adds the --link-by-hash=DIR option, which hard links received
4 files in a link farm arranged by MD4 file hash.  The result is that the system
5 will only store one copy of the unique contents of each file, regardless of
6 the file's name.
7
8 To use this patch, run these commands for a successful build:
9
10     patch -p1 <patches/link-by-hash.diff
11     ./prepare-source
12     ./configure
13     make
14
15 diff --git a/Makefile.in b/Makefile.in
16 --- a/Makefile.in
17 +++ b/Makefile.in
18 @@ -36,7 +36,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
19         util.o main.o checksum.o match.o syscall.o log.o backup.o
20  OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
21         fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
22 -OBJS3=progress.o pipe.o
23 +OBJS3=progress.o pipe.o hashlink.o
24  DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
25  popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
26         popt/popthelp.o popt/poptparse.o
27 diff --git a/flist.c b/flist.c
28 --- a/flist.c
29 +++ b/flist.c
30 @@ -68,6 +68,7 @@ extern int need_unsorted_flist;
31  extern int unsort_ndx;
32  extern struct stats stats;
33  extern char *filesfrom_host;
34 +extern char *link_by_hash_dir;
35  
36  extern char curr_dir[MAXPATHLEN];
37  
38 @@ -822,7 +823,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
39                 extra_len += (S_ISDIR(mode) ? 2 : 1) * EXTRA_LEN;
40  #endif
41  
42 -       if (always_checksum && S_ISREG(mode))
43 +       if ((always_checksum || link_by_hash_dir) && S_ISREG(mode))
44                 extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
45  
46         if (file_length > 0xFFFFFFFFu && S_ISREG(mode))
47 diff --git a/hashlink.c b/hashlink.c
48 new file mode 100644
49 --- /dev/null
50 +++ b/hashlink.c
51 @@ -0,0 +1,336 @@
52 +/*
53 +   Copyright (C) Cronosys, LLC 2004
54 +
55 +   This program is free software; you can redistribute it and/or modify
56 +   it under the terms of the GNU General Public License as published by
57 +   the Free Software Foundation; either version 2 of the License, or
58 +   (at your option) any later version.
59 +
60 +   This program is distributed in the hope that it will be useful,
61 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
62 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
63 +   GNU General Public License for more details.
64 +
65 +   You should have received a copy of the GNU General Public License
66 +   along with this program; if not, write to the Free Software
67 +   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
68 +*/
69 +
70 +/* This file contains code used by the --link-by-hash option. */
71 +
72 +#include "rsync.h"
73 +
74 +extern char *link_by_hash_dir;
75 +
76 +#ifdef HAVE_LINK
77 +
78 +char *make_hash_name(struct file_struct *file)
79 +{
80 +       char hash[33], *dst;
81 +       uchar c, *src = (uchar*)F_SUM(file);
82 +       int i;
83 +
84 +       for (dst = hash, i = 0; i < 4; i++, src++) {
85 +               c = *src >> 4;
86 +               *(dst++) = (c >= 10) ? (c - 10 + 'a') : (c + '0');
87 +               c = *src & 0x0f;
88 +               *(dst++) = (c >= 10) ? (c - 10 + 'a') : (c + '0');
89 +       }
90 +       *dst++ = '/';
91 +       for (i = 0; i < 12; i++, src++) {
92 +               c = *src >> 4;
93 +               *(dst++) = (c >= 10) ? (c - 10 + 'a') : (c + '0');
94 +               c = *src & 0x0f;
95 +               *(dst++) = (c >= 10) ? (c - 10 + 'a') : (c + '0');
96 +       }
97 +       *dst = 0;
98 +
99 +       asprintf(&dst,"%s/%s",link_by_hash_dir,hash);
100 +       return dst;
101 +}
102 +
103 +
104 +void kill_hashfile(struct hashfile_struct *hashfile)
105 +{
106 +       if (!hashfile)
107 +               return;
108 +       free(hashfile->name);
109 +       close(hashfile->fd);
110 +       free(hashfile);
111 +}
112 +
113 +
114 +void kill_hashfiles(struct hashfile_struct *hashfiles)
115 +{
116 +       struct hashfile_struct *iter, *next;
117 +       if ((iter = hashfiles) != NULL) {
118 +               do {
119 +                       next = iter->next;
120 +                       kill_hashfile(iter);
121 +                       iter = next;
122 +               } while (iter != hashfiles);
123 +       }
124 +}
125 +
126 +
127 +struct hashfile_struct *find_hashfiles(char *hashname, int64 size, long *fnbr)
128 +{
129 +       DIR *d;
130 +       struct dirent *di;
131 +       struct hashfile_struct *hashfiles = NULL, *hashfile;
132 +       STRUCT_STAT st;
133 +       long this_fnbr;
134 +
135 +       *fnbr = 0;
136 +
137 +       /* Build a list of potential candidates and open
138 +        * them. */
139 +       if ((d = opendir(hashname)) == NULL) {
140 +               rsyserr(FERROR, errno, "opendir failed: \"%s\"", hashname);
141 +               free(hashname);
142 +               return NULL;
143 +       }
144 +       while ((di = readdir(d)) != NULL) {
145 +               if (!strcmp(di->d_name,".") || !strcmp(di->d_name,"..")) {
146 +                       continue;
147 +               }
148 +
149 +               /* We need to have the largest fnbr in case we need to store
150 +                * a new file. */
151 +               this_fnbr = atol(di->d_name);
152 +               if (this_fnbr > *fnbr)
153 +                       *fnbr = this_fnbr;
154 +
155 +               hashfile = new_array(struct hashfile_struct, 1);
156 +               asprintf(&hashfile->name,"%s/%s",hashname,
157 +                        di->d_name);
158 +               if (do_stat(hashfile->name,&st) == -1) {
159 +                       rsyserr(FERROR, errno, "stat failed: %s", hashfile->name);
160 +                       kill_hashfile(hashfile);
161 +                       continue;
162 +               }
163 +               if (st.st_size != size) {
164 +                       kill_hashfile(hashfile);
165 +                       continue;
166 +               }
167 +               hashfile->nlink = st.st_nlink;
168 +               hashfile->fd = open(hashfile->name,O_RDONLY|O_BINARY);
169 +               if (hashfile->fd == -1) {
170 +                       rsyserr(FERROR, errno, "open failed: %s", hashfile->name);
171 +                       kill_hashfile(hashfile);
172 +                       continue;
173 +               }
174 +               if (hashfiles == NULL)
175 +                       hashfiles = hashfile->next = hashfile->prev = hashfile;
176 +               else {
177 +                       hashfile->next = hashfiles;
178 +                       hashfile->prev = hashfiles->prev;
179 +                       hashfile->next->prev = hashfile;
180 +                       hashfile->prev->next = hashfile;
181 +               }
182 +       }
183 +       closedir(d);
184 +
185 +       return hashfiles;
186 +}
187 +
188 +
189 +struct hashfile_struct *compare_hashfiles(int fd,struct hashfile_struct *files)
190 +{
191 +       int amt, hamt;
192 +       char buffer[BUFSIZ], cmpbuffer[BUFSIZ];
193 +       struct hashfile_struct *iter, *next, *best;
194 +       uint32 nlink;
195 +
196 +       if (!files)
197 +               return NULL;
198 +
199 +       iter = files; /* in case files are 0 bytes */
200 +       while ((amt = read(fd, buffer, BUFSIZ)) > 0) {
201 +               iter = files;
202 +               do {
203 +                       /* Icky bit to resync when we steal the first node. */
204 +                       if (!files)
205 +                               files = iter;
206 +
207 +                       next = iter->next;
208 +
209 +                       hamt = read(iter->fd, cmpbuffer, BUFSIZ);
210 +                       if (amt != hamt || memcmp(buffer, cmpbuffer, amt)) {
211 +                               if (iter == files) {
212 +                                       files = files->prev;
213 +                               }
214 +                               if (iter->next == iter) {
215 +                                       files = next = NULL;
216 +                               } else {
217 +                                       next = iter->next;
218 +                                       if (iter == files) {
219 +                                               /* So we know to resync */
220 +                                               files = NULL;
221 +                                       }
222 +                               }
223 +                               iter->next->prev = iter->prev;
224 +                               iter->prev->next = iter->next;
225 +                               kill_hashfile(iter);
226 +                       }
227 +
228 +                       iter = next;
229 +               } while (iter != files);
230 +
231 +               if (iter == NULL && files == NULL) {
232 +                       /* There are no matches. */
233 +                       return NULL;
234 +               }
235 +       }
236 +
237 +       if (amt == -1) {
238 +               rsyserr(FERROR, errno, "read failed in compare_hashfiles()");
239 +               kill_hashfiles(files);
240 +               return NULL;
241 +       }
242 +
243 +       /* If we only have one file left, use it. */
244 +       if (files == files->next) {
245 +               return files;
246 +       }
247 +
248 +       /* All files which remain in the list are identical and should have
249 +        * the same size.  We pick the one with the lowest link count (we
250 +        * may have rolled over because we hit the maximum link count for
251 +        * the filesystem). */
252 +       best = iter = files;
253 +       nlink = iter->nlink;
254 +       do {
255 +               if (iter->nlink < nlink) {
256 +                       nlink = iter->nlink;
257 +                       best = iter;
258 +               }
259 +               iter = iter->next;
260 +       } while (iter != files);
261 +
262 +       best->next->prev = best->prev;
263 +       best->prev->next = best->next;
264 +       if (files == best)
265 +               files = files->next;
266 +       kill_hashfiles(files);
267 +       return best;
268 +}
269 +
270 +
271 +int link_by_hash(const char *fnametmp, const char *fname, struct file_struct *file)
272 +{
273 +       STRUCT_STAT st;
274 +       char *hashname = make_hash_name(file);
275 +       int first = 0, rc;
276 +       char *linkname;
277 +       long last_fnbr;
278 +
279 +       if (F_LENGTH(file) == 0)
280 +               return robust_rename(fnametmp, fname, NULL, 0644);
281 +
282 +       if (do_stat(hashname, &st) == -1) {
283 +               char *dirname;
284 +
285 +               /* Directory does not exist. */
286 +               dirname = strdup(hashname);
287 +               *strrchr(dirname,'/') = 0;
288 +               if (do_mkdir(dirname, 0755) == -1 && errno != EEXIST) {
289 +                       rsyserr(FERROR, errno, "mkdir failed: %s", dirname);
290 +                       free(hashname);
291 +                       free(dirname);
292 +                       return robust_rename(fnametmp, fname, NULL, 0644);
293 +               }
294 +               free(dirname);
295 +
296 +               if (do_mkdir(hashname, 0755) == -1 && errno != EEXIST) {
297 +                       rsyserr(FERROR, errno, "mkdir failed: %s", hashname);
298 +                       free(hashname);
299 +                       return robust_rename(fnametmp, fname, NULL, 0644);
300 +               }
301 +
302 +               first = 1;
303 +               asprintf(&linkname,"%s/0",hashname);
304 +               rprintf(FINFO, "(1) linkname = %s\n", linkname);
305 +       } else {
306 +               struct hashfile_struct *hashfiles, *hashfile;
307 +
308 +               if (do_stat(fnametmp,&st) == -1) {
309 +                       rsyserr(FERROR, errno, "stat failed: %s", fname);
310 +                       return -1;
311 +               }
312 +               hashfiles = find_hashfiles(hashname, st.st_size, &last_fnbr);
313 +
314 +               if (hashfiles == NULL) {
315 +                       first = 1;
316 +                       asprintf(&linkname,"%s/0",hashname);
317 +                       rprintf(FINFO, "(2) linkname = %s\n", linkname);
318 +               } else {
319 +                       int fd;
320 +                       /* Search for one identical to us. */
321 +                       if ((fd = open(fnametmp,O_RDONLY|O_BINARY)) == -1) {
322 +                               rsyserr(FERROR, errno, "open failed: %s", fnametmp);
323 +                               kill_hashfiles(hashfiles);
324 +                               return -1;
325 +                       }
326 +                       hashfile = compare_hashfiles(fd, hashfiles);
327 +                       hashfiles = NULL;
328 +                       close(fd);
329 +
330 +                       if (hashfile) {
331 +                               first = 0;
332 +                               linkname = strdup(hashfile->name);
333 +                               rprintf(FINFO, "(3) linkname = %s\n", linkname);
334 +                               kill_hashfile(hashfile);
335 +                       } else {
336 +                               first = 1;
337 +                               asprintf(&linkname, "%s/%ld", hashname,
338 +                                        last_fnbr + 1);
339 +                               rprintf(FINFO, "(4) linkname = %s\n", linkname);
340 +                       }
341 +               }
342 +       }
343 +
344 +       if (!first) {
345 +               rprintf(FINFO, "link-by-hash (existing): \"%s\" -> %s\n",
346 +                               linkname, full_fname(fname));
347 +               robust_unlink(fname);
348 +               rc = do_link(linkname, fname);
349 +               if (rc == -1) {
350 +                       if (errno == EMLINK) {
351 +                               first = 1;
352 +                               free(linkname);
353 +                               asprintf(&linkname,"%s/%ld",hashname,
354 +                                        last_fnbr + 1);
355 +                               rprintf(FINFO, "(5) linkname = %s\n", linkname);
356 +                               rprintf(FINFO,"link-by-hash: max link count exceeded, starting new file \"%s\".\n", linkname);
357 +                       } else {
358 +                               rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"",
359 +                                       linkname, full_fname(fname));
360 +                               rc = robust_rename(fnametmp, fname, NULL, 0644);
361 +                       }
362 +               } else {
363 +                       do_unlink(fnametmp);
364 +               }
365 +       }
366 +
367 +       if (first) {
368 +               rprintf(FINFO, "link-by-hash (new): %s -> \"%s\"\n",
369 +                               full_fname(fname),linkname);
370 +
371 +               rc = robust_rename(fnametmp, fname, NULL, 0644);
372 +               if (rc != 0) {
373 +                       rsyserr(FERROR, errno, "rename \"%s\" -> \"%s\"",
374 +                               full_fname(fnametmp), full_fname(fname));
375 +               }
376 +               rc = do_link(fname,linkname);
377 +               if (rc != 0) {
378 +                       rsyserr(FERROR, errno, "link \"%s\" -> \"%s\"",
379 +                               full_fname(fname), linkname);
380 +               }
381 +       }
382 +
383 +       free(linkname);
384 +       free(hashname);
385 +       return rc;
386 +}
387 +#endif
388 diff --git a/options.c b/options.c
389 --- a/options.c
390 +++ b/options.c
391 @@ -156,6 +156,7 @@ char *backup_suffix = NULL;
392  char *tmpdir = NULL;
393  char *partial_dir = NULL;
394  char *basis_dir[MAX_BASIS_DIRS+1];
395 +char *link_by_hash_dir = NULL;
396  char *config_file = NULL;
397  char *shell_cmd = NULL;
398  char *logfile_name = NULL;
399 @@ -389,6 +390,7 @@ void usage(enum logcode F)
400    rprintf(F,"     --compare-dest=DIR      also compare destination files relative to DIR\n");
401    rprintf(F,"     --copy-dest=DIR         ... and include copies of unchanged files\n");
402    rprintf(F,"     --link-dest=DIR         hardlink to files in DIR when unchanged\n");
403 +  rprintf(F,"     --link-by-hash=DIR      create hardlinks by hash into DIR\n");
404    rprintf(F," -z, --compress              compress file data during the transfer\n");
405    rprintf(F,"     --compress-level=NUM    explicitly set compression level\n");
406    rprintf(F,"     --skip-compress=LIST    skip compressing files with a suffix in LIST\n");
407 @@ -441,7 +443,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
408        OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
409        OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
410        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
411 -      OPT_NO_D, OPT_APPEND,
412 +      OPT_NO_D, OPT_APPEND, OPT_LINK_BY_HASH,
413        OPT_SERVER, OPT_REFUSED_BASE = 9000};
414  
415  static struct poptOption long_options[] = {
416 @@ -564,6 +566,7 @@ static struct poptOption long_options[] = {
417    {"compare-dest",     0,  POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
418    {"copy-dest",        0,  POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
419    {"link-dest",        0,  POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
420 +  {"link-by-hash",     0,  POPT_ARG_STRING, 0, OPT_LINK_BY_HASH, 0, 0},
421    {"fuzzy",           'y', POPT_ARG_NONE,   &fuzzy_basis, 0, 0, 0 },
422    {"compress",        'z', POPT_ARG_NONE,   0, 'z', 0, 0 },
423    {"no-compress",      0,  POPT_ARG_VAL,    &do_compression, 0, 0, 0 },
424 @@ -1226,6 +1229,21 @@ int parse_arguments(int *argc_p, const char ***argv_p, int frommain)
425                         return 0;
426  #endif
427  
428 +                case OPT_LINK_BY_HASH:
429 +#ifdef HAVE_LINK
430 +                       arg = poptGetOptArg(pc);
431 +                       if (sanitize_paths)
432 +                               arg = sanitize_path(NULL, arg, NULL, 0, NULL);
433 +                       link_by_hash_dir = (char *)arg;
434 +                       break;
435 +#else
436 +                       snprintf(err_buf, sizeof err_buf,
437 +                                "hard links are not supported on this %s\n",
438 +                                am_server ? "server" : "client");
439 +                       rprintf(FERROR, "ERROR: %s", err_buf);
440 +                       return 0;
441 +#endif
442 +
443                 default:
444                         /* A large opt value means that set_refuse_options()
445                          * turned this option off. */
446 @@ -1974,6 +1992,11 @@ void server_options(char **args, int *argc_p)
447         } else if (inplace)
448                 args[ac++] = "--inplace";
449  
450 +       if (link_by_hash_dir && am_sender) {
451 +               args[ac++] = "--link-by-hash";
452 +               args[ac++] = link_by_hash_dir;
453 +       }
454 +
455         if (files_from && (!am_sender || filesfrom_host)) {
456                 if (filesfrom_host) {
457                         args[ac++] = "--files-from";
458 diff --git a/receiver.c b/receiver.c
459 --- a/receiver.c
460 +++ b/receiver.c
461 @@ -162,12 +162,14 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file)
462  }
463  
464  static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
465 -                       const char *fname, int fd, OFF_T total_size)
466 +                       const char *fname, int fd, OFF_T total_size,
467 +                       const char *md4)
468  {
469         static char file_sum1[MAX_DIGEST_LEN];
470         static char file_sum2[MAX_DIGEST_LEN];
471         struct map_struct *mapbuf;
472         struct sum_struct sum;
473 +       md_context mdfour_data;
474         int32 len, sum_len;
475         OFF_T offset = 0;
476         OFF_T offset2;
477 @@ -187,6 +189,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
478         } else
479                 mapbuf = NULL;
480  
481 +       if (md4)
482 +               mdfour_begin(&mdfour_data);
483 +
484         sum_init(checksum_seed);
485  
486         if (append_mode > 0) {
487 @@ -231,6 +236,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
488                         cleanup_got_literal = 1;
489  
490                         sum_update(data, i);
491 +                       if (md4)
492 +                               mdfour_update(&mdfour_data, (uchar*)data, i);
493  
494                         if (fd != -1 && write_file(fd,data,i) != i)
495                                 goto report_write_error;
496 @@ -257,6 +264,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
497  
498                         see_token(map, len);
499                         sum_update(map, len);
500 +                       if (md4)
501 +                               mdfour_update(&mdfour_data, (uchar*)map, len);
502                 }
503  
504                 if (updating_basis_or_equiv) {
505 @@ -299,6 +308,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
506         }
507  
508         sum_len = sum_end(file_sum1);
509 +       if (md4)
510 +               mdfour_result(&mdfour_data, (uchar*)md4);
511  
512         if (mapbuf)
513                 unmap_file(mapbuf);
514 @@ -314,7 +325,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
515  
516  static void discard_receive_data(int f_in, OFF_T length)
517  {
518 -       receive_data(f_in, NULL, -1, 0, NULL, -1, length);
519 +       receive_data(f_in, NULL, -1, 0, NULL, -1, length, NULL);
520  }
521  
522  static void handle_delayed_updates(char *local_name)
523 @@ -675,7 +686,7 @@ int recv_files(int f_in, char *local_name)
524  
525                 /* recv file data */
526                 recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,
527 -                                      fname, fd2, F_LENGTH(file));
528 +                                      fname, fd2, F_LENGTH(file), F_SUM(file));
529  
530                 log_item(log_code, file, &initial_stats, iflags, NULL);
531  
532 diff --git a/rsync.c b/rsync.c
533 --- a/rsync.c
534 +++ b/rsync.c
535 @@ -48,6 +48,7 @@ extern int inplace;
536  extern int flist_eof;
537  extern int keep_dirlinks;
538  extern int make_backups;
539 +extern char *link_by_hash_dir;
540  extern struct file_list *cur_flist, *first_flist, *dir_flist;
541  extern struct chmod_mode_struct *daemon_chmod_modes;
542  #ifdef ICONV_OPTION
543 @@ -531,8 +532,15 @@ void finish_transfer(const char *fname, const char *fnametmp,
544         /* move tmp file over real file */
545         if (verbose > 2)
546                 rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
547 -       ret = robust_rename(fnametmp, fname, partialptr,
548 -                           file->mode & INITACCESSPERMS);
549 +#ifdef HAVE_LINK
550 +       if (link_by_hash_dir)
551 +               ret = link_by_hash(fnametmp, fname, file);
552 +       else
553 +#endif
554 +       {
555 +               ret = robust_rename(fnametmp, fname, partialptr,
556 +                                   file->mode & INITACCESSPERMS);
557 +       }
558         if (ret < 0) {
559                 rsyserr(FERROR_XFER, errno, "%s %s -> \"%s\"",
560                         ret == -2 ? "copy" : "rename",
561 diff --git a/rsync.h b/rsync.h
562 --- a/rsync.h
563 +++ b/rsync.h
564 @@ -816,6 +816,14 @@ struct stats {
565         int num_transferred_files;
566  };
567  
568 +struct hashfile_struct {
569 +       struct hashfile_struct *next;
570 +       struct hashfile_struct *prev;
571 +       char *name;
572 +       int fd;
573 +       uint32 nlink;
574 +};
575 +
576  struct chmod_mode_struct;
577  
578  #define EMPTY_ITEM_LIST {NULL, 0, 0}
579 diff --git a/rsync.yo b/rsync.yo
580 --- a/rsync.yo
581 +++ b/rsync.yo
582 @@ -388,6 +388,7 @@ to the detailed description below for a complete description.  verb(
583       --compare-dest=DIR      also compare received files relative to DIR
584       --copy-dest=DIR         ... and include copies of unchanged files
585       --link-dest=DIR         hardlink to files in DIR when unchanged
586 +     --link-by-hash=DIR      create hardlinks by hash into DIR
587   -z, --compress              compress file data during the transfer
588       --compress-level=NUM    explicitly set compression level
589       --skip-compress=LIST    skip compressing files with suffix in LIST