The patches for 3.3.0.
[rsync-patches.git] / link-by-hash.diff
index 74c5a1870a11d5de4687840439ca8d5192b6cfa6..c3593a98aac18ea0b183627a376e05d137a59312 100644 (file)
@@ -12,75 +12,71 @@ To use this patch, run these commands for a successful build:
     ./configure
     make
 
-based-on: 2f84a6bd73e1a6e2081b1bcb965049ef83b2ce45
+based-on: 6c8ca91c731b7bf2b081694bda85b7dadc2b7aff
 diff --git a/Makefile.in b/Makefile.in
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -44,7 +44,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
-       util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
+@@ -47,7 +47,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
+       util1.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
  OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
-       fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
--OBJS3=progress.o pipe.o
-+OBJS3=progress.o pipe.o hashlink.o
+       usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
+-OBJS3=progress.o pipe.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_ASM@
++OBJS3=progress.o pipe.o hashlink.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_ASM@
  DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
  popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
        popt/popthelp.o popt/poptparse.o
 diff --git a/checksum.c b/checksum.c
 --- a/checksum.c
 +++ b/checksum.c
-@@ -39,9 +39,12 @@ extern int am_server;
- extern int local_server;
- extern int whole_file;
- extern int read_batch;
-+extern int checksum_len;
+@@ -40,6 +40,8 @@ extern int whole_file;
  extern int checksum_seed;
  extern int protocol_version;
  extern int proper_seed_order;
 +extern char *link_by_hash_dir;
 +extern char link_by_hash_extra_sum[MAX_DIGEST_LEN];
- extern char *checksum_choice;
+ extern const char *checksum_choice;
  
- #define CSUM_NONE 0
-@@ -397,7 +400,7 @@ static union {
-       MD4_CTX m4;
- #endif
      MD5_CTX m5;
--} ctx;
-+} ctx, ctx2;
+ #define NNI_BUILTIN (1<<0)
+@@ -539,7 +541,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
+ }
static int32 sumresidue;
+-static md_context ctx_md;
++static md_context ctx_md, ctx2_md;
  #ifdef SUPPORT_XXHASH
  static XXH64_state_t* xxh64_state;
  #endif
-@@ -414,6 +417,8 @@ void sum_init(int csum_type, int seed)
-       switch (csum_type) {
+@@ -597,6 +599,8 @@ int sum_init(struct name_num_item *nni, int seed)
+ #endif
          case CSUM_MD5:
-               MD5_Init(&ctx.m5);
+               md5_begin(&ctx_md);
 +              if (link_by_hash_dir)
-+                      MD5_Init(&ctx2.m5);
++                      md5_begin(&ctx2_md);
                break;
          case CSUM_MD4:
- #ifdef USE_OPENSSL
-@@ -464,6 +469,8 @@ void sum_update(const char *p, int32 len)
-       switch (cursum_type) {
+               mdfour_begin(&ctx_md);
+@@ -643,6 +647,8 @@ void sum_update(const char *p, int32 len)
+ #endif
          case CSUM_MD5:
-               MD5_Update(&ctx.m5, (uchar *)p, len);
+               md5_update(&ctx_md, (uchar *)p, len);
 +              if (link_by_hash_dir)
-+                      MD5_Update(&ctx2.m5, (uchar *)p, len);
++                      md5_update(&ctx2_md, (uchar *)p, len);
                break;
          case CSUM_MD4:
- #ifdef USE_OPENSSL
-@@ -521,6 +528,8 @@ int sum_end(char *sum)
-       switch (cursum_type) {
+         case CSUM_MD4_OLD:
+@@ -709,6 +715,8 @@ void sum_end(char *sum)
+ #endif
          case CSUM_MD5:
-               MD5_Final((uchar *)sum, &ctx.m5);
+               md5_result(&ctx_md, (uchar *)sum);
 +              if (link_by_hash_dir)
-+                      MD5_Final((uchar *)link_by_hash_extra_sum, &ctx2.m5);
++                      md5_result(&ctx2_md, (uchar *)link_by_hash_extra_sum);
                break;
          case CSUM_MD4:
- #ifdef USE_OPENSSL
+         case CSUM_MD4_OLD:
 diff --git a/clientserver.c b/clientserver.c
 --- a/clientserver.c
 +++ b/clientserver.c
-@@ -50,6 +50,7 @@ extern int logfile_format_has_i;
+@@ -53,6 +53,7 @@ extern int logfile_format_has_i;
  extern int logfile_format_has_o_or_i;
  extern char *bind_address;
  extern char *config_file;
@@ -88,27 +84,27 @@ diff --git a/clientserver.c b/clientserver.c
  extern char *logfile_format;
  extern char *files_from;
  extern char *tmpdir;
-@@ -543,6 +544,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
+@@ -736,6 +737,9 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
                return -1;
        }
  
 +      if (*lp_link_by_hash_dir(i))
 +              link_by_hash_dir = lp_link_by_hash_dir(i);
 +
-       if (am_daemon && am_server) {
+       if (am_daemon > 0) {
                rprintf(FLOG, "rsync allowed access on module %s from %s (%s)\n",
                        name, host, addr);
-diff --git a/compat.c b/compat.c
---- a/compat.c
-+++ b/compat.c
-@@ -57,6 +57,7 @@ extern char *files_from;
- extern char *filesfrom_host;
- extern char *checksum_choice;
- extern char *compress_choice;
-+extern char *link_by_hash_dir;
- extern filter_rule_list filter_list;
- extern int need_unsorted_flist;
- #ifdef ICONV_OPTION
+diff --git a/daemon-parm.txt b/daemon-parm.txt
+--- a/daemon-parm.txt
++++ b/daemon-parm.txt
+@@ -29,6 +29,7 @@ STRING       hosts_deny              NULL
+ STRING        include                 NULL
+ STRING        include_from            NULL
+ STRING        incoming_chmod          NULL
++STRING        link_by_hash_dir        NULL
+ STRING        lock_file               DEFAULT_LOCK_FILE
+ STRING        log_file                NULL
+ STRING        log_format              "%o %h [%a] %m (%u) %f %l"
 diff --git a/hashlink.c b/hashlink.c
 new file mode 100644
 --- /dev/null
@@ -206,61 +202,10 @@ new file mode 100644
 +      free(hashname);
 +}
 +#endif
-diff --git a/loadparm.c b/loadparm.c
---- a/loadparm.c
-+++ b/loadparm.c
-@@ -131,6 +131,7 @@ typedef struct {
-       char *include;
-       char *include_from;
-       char *incoming_chmod;
-+      char *link_by_hash_dir;
-       char *lock_file;
-       char *log_file;
-       char *log_format;
-@@ -159,6 +160,7 @@ typedef struct {
-       BOOL include_EXP;
-       BOOL include_from_EXP;
-       BOOL incoming_chmod_EXP;
-+      BOOL link_by_hash_dir_EXP;
-       BOOL lock_file_EXP;
-       BOOL log_file_EXP;
-       BOOL log_format_EXP;
-@@ -245,6 +247,7 @@ static const all_vars Defaults = {
-  /* include; */                       NULL,
-  /* include_from; */          NULL,
-  /* incoming_chmod; */                NULL,
-+ /* link_by_hash_dir; */      NULL,
-  /* lock_file; */             DEFAULT_LOCK_FILE,
-  /* log_file; */              NULL,
-  /* log_format; */            "%o %h [%a] %m (%u) %f %l",
-@@ -272,6 +275,7 @@ static const all_vars Defaults = {
-  /* include_EXP; */           False,
-  /* include_from_EXP; */      False,
-  /* incoming_chmod_EXP; */    False,
-+ /* link_by_hash_dir_EXP; */  False,
-  /* lock_file_EXP; */         False,
-  /* log_file_EXP; */          False,
-  /* log_format_EXP; */                False,
-@@ -417,6 +421,7 @@ static struct parm_struct parm_table[] =
-  {"include from",      P_STRING, P_LOCAL, &Vars.l.include_from,        NULL,0},
-  {"include",           P_STRING, P_LOCAL, &Vars.l.include,             NULL,0},
-  {"incoming chmod",    P_STRING, P_LOCAL, &Vars.l.incoming_chmod,      NULL,0},
-+ {"link by hash dir",  P_STRING, P_LOCAL, &Vars.l.link_by_hash_dir,    NULL,0},
-  {"list",              P_BOOL,   P_LOCAL, &Vars.l.list,                NULL,0},
-  {"lock file",         P_STRING, P_LOCAL, &Vars.l.lock_file,           NULL,0},
-  {"log file",          P_STRING, P_LOCAL, &Vars.l.log_file,            NULL,0},
-@@ -552,6 +557,7 @@ FN_LOCAL_STRING(lp_hosts_deny, hosts_deny)
- FN_LOCAL_STRING(lp_include, include)
- FN_LOCAL_STRING(lp_include_from, include_from)
- FN_LOCAL_STRING(lp_incoming_chmod, incoming_chmod)
-+FN_LOCAL_STRING(lp_link_by_hash_dir, link_by_hash_dir)
- FN_LOCAL_STRING(lp_lock_file, lock_file)
- FN_LOCAL_STRING(lp_log_file, log_file)
- FN_LOCAL_STRING(lp_log_format, log_format)
 diff --git a/options.c b/options.c
 --- a/options.c
 +++ b/options.c
-@@ -165,6 +165,7 @@ char *backup_suffix = NULL;
+@@ -173,6 +173,7 @@ char *backup_suffix = NULL;
  char *tmpdir = NULL;
  char *partial_dir = NULL;
  char *basis_dir[MAX_BASIS_DIRS+1];
@@ -268,7 +213,7 @@ diff --git a/options.c b/options.c
  char *config_file = NULL;
  char *shell_cmd = NULL;
  char *logfile_name = NULL;
-@@ -216,7 +217,7 @@ static const char *debug_verbosity[] = {
+@@ -231,7 +232,7 @@ static const char *debug_verbosity[] = {
        /*2*/ "BIND,CMD,CONNECT,DEL,DELTASUM,DUP,FILTER,FLIST,ICONV",
        /*3*/ "ACL,BACKUP,CONNECT2,DELTASUM2,DEL2,EXIT,FILTER2,FLIST2,FUZZY,GENR,OWN,RECV,SEND,TIME",
        /*4*/ "CMD2,DELTASUM3,DEL3,EXIT2,FLIST3,ICONV2,OWN2,PROTO,TIME2",
@@ -277,7 +222,7 @@ diff --git a/options.c b/options.c
  };
  
  #define MAX_VERBOSITY ((int)(sizeof debug_verbosity / sizeof debug_verbosity[0]) - 1)
-@@ -286,6 +287,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
+@@ -302,6 +303,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
        DEBUG_WORD(FUZZY, W_REC, "Debug fuzzy scoring (levels 1-2)"),
        DEBUG_WORD(GENR, W_REC, "Debug generator functions"),
        DEBUG_WORD(HASH, W_SND|W_REC, "Debug hashtable code"),
@@ -285,24 +230,16 @@ diff --git a/options.c b/options.c
        DEBUG_WORD(HLINK, W_SND|W_REC, "Debug hard-link actions (levels 1-3)"),
        DEBUG_WORD(ICONV, W_CLI|W_SRV, "Debug iconv character conversions (levels 1-2)"),
        DEBUG_WORD(IO, W_CLI|W_SRV, "Debug I/O routines (levels 1-4)"),
-@@ -781,6 +783,7 @@ void usage(enum logcode F)
-   rprintf(F,"     --compare-dest=DIR      also compare destination files relative to DIR\n");
-   rprintf(F,"     --copy-dest=DIR         ... and include copies of unchanged files\n");
-   rprintf(F,"     --link-dest=DIR         hardlink to files in DIR when unchanged\n");
-+  rprintf(F,"     --link-by-hash=DIR      create hardlinks by hash into DIR\n");
-   rprintf(F," -z, --compress              compress file data during the transfer\n");
-   rprintf(F,"     --compress-level=NUM    explicitly set compression level\n");
-   rprintf(F,"     --skip-compress=LIST    skip compressing files with a suffix in LIST\n");
-@@ -838,7 +841,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
-       OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP,
+@@ -582,7 +584,7 @@ enum {OPT_SERVER = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
        OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD,
        OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
--      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG,
-+      OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_LINK_BY_HASH,
-       OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT,
-       OPT_SERVER, OPT_REFUSED_BASE = 9000};
-@@ -990,6 +993,7 @@ static struct poptOption long_options[] = {
+       OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_BLOCK_SIZE,
+-      OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT, OPT_STDERR,
++      OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT, OPT_STDERR, OPT_LINK_BY_HASH,
+       OPT_OLD_COMPRESS, OPT_NEW_COMPRESS, OPT_NO_COMPRESS, OPT_OLD_ARGS,
+       OPT_STOP_AFTER, OPT_STOP_AT,
+       OPT_REFUSED_BASE = 9000};
+@@ -743,6 +745,7 @@ static struct poptOption long_options[] = {
    {"compare-dest",     0,  POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
    {"copy-dest",        0,  POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
    {"link-dest",        0,  POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
@@ -310,18 +247,18 @@ diff --git a/options.c b/options.c
    {"fuzzy",           'y', POPT_ARG_NONE,   0, 'y', 0, 0 },
    {"no-fuzzy",         0,  POPT_ARG_VAL,    &fuzzy_basis, 0, 0, 0 },
    {"no-y",             0,  POPT_ARG_VAL,    &fuzzy_basis, 0, 0, 0 },
-@@ -1422,6 +1426,9 @@ int parse_arguments(int *argc_p, const char ***argv_p)
-               iconv_opt = strdup(arg);
- #endif
+@@ -990,6 +993,9 @@ static void set_refuse_options(void)
+               ref = cp + 1;
+       }
  
 +      if (*lp_link_by_hash_dir(module_id))
-+              set_refuse_options("link-by-hash");
++              parse_one_refuse_match(0, "link-by-hash", list_end);
 +
-       /* TODO: Call poptReadDefaultConfig; handle errors. */
-       /* The context leaks in case of an error, but if there's a
-@@ -1905,6 +1912,21 @@ int parse_arguments(int *argc_p, const char ***argv_p)
-                       return 0;
+       if (am_daemon) {
+ #ifdef ICONV_OPTION
+               if (!*lp_charset(module_id))
+@@ -1867,6 +1873,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+                       goto cleanup;
  #endif
  
 +                case OPT_LINK_BY_HASH:
@@ -335,14 +272,13 @@ diff --git a/options.c b/options.c
 +                      snprintf(err_buf, sizeof err_buf,
 +                               "hard links are not supported on this %s\n",
 +                               am_server ? "server" : "client");
-+                      rprintf(FERROR, "ERROR: %s", err_buf);
 +                      return 0;
 +#endif
 +
-               default:
-                       /* A large opt value means that set_refuse_options()
-                        * turned this option off. */
-@@ -2226,6 +2248,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+               case OPT_STOP_AFTER: {
+                       long val;
+                       arg = poptGetOptArg(pc);
+@@ -2252,6 +2272,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, SP_DEFAULT);
                if (backup_dir)
                        backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT);
@@ -351,9 +287,9 @@ diff --git a/options.c b/options.c
        }
        if (daemon_filter_list.head && !am_sender) {
                filter_rule_list *elp = &daemon_filter_list;
-@@ -2894,6 +2918,12 @@ void server_options(char **args, int *argc_p)
-       } else if (inplace)
-               args[ac++] = "--inplace";
+@@ -2941,6 +2963,12 @@ void server_options(char **args, int *argc_p)
+                       args[ac++] = "--no-W";
+       }
  
 +      if (link_by_hash_dir && am_sender) {
 +              args[ac++] = "--link-by-hash";
@@ -364,10 +300,72 @@ diff --git a/options.c b/options.c
        if (files_from && (!am_sender || filesfrom_host)) {
                if (filesfrom_host) {
                        args[ac++] = "--files-from";
+diff --git a/rsync.1.md b/rsync.1.md
+--- a/rsync.1.md
++++ b/rsync.1.md
+@@ -510,6 +510,7 @@ has its own detailed description later in this manpage.
+ --compare-dest=DIR       also compare destination files relative to DIR
+ --copy-dest=DIR          ... and include copies of unchanged files
+ --link-dest=DIR          hardlink to files in DIR when unchanged
++--link-by-hash=DIR       create hardlinks by hash into DIR
+ --compress, -z           compress file data during the transfer
+ --compress-choice=STR    choose the compression algorithm (aka --zc)
+ --compress-level=NUM     explicitly set compression level (aka --zl)
+@@ -2720,6 +2721,50 @@ expand it.
+     this bug by avoiding the `-o` option (or using `--no-o`) when sending to an
+     old rsync.
++0.  `--link-by-hash=DIR`
++
++    This option hard links the destination files into _DIR_, a link farm
++    arranged by MD5 file hash. The result is that the system will only store
++    (usually) one copy of the unique contents of each file, regardless of the
++    file's name (it will use extra files if the links overflow the available
++    maximum).
++
++    This patch does not take into account file permissions, extended
++    attributes, or ACLs when linking things together, so you should only use
++    this if you don't care about preserving those extra file attributes (or if
++    they are always the same for identical files).
++
++    The _DIR_ is relative to the destination directory, so either specify a full
++    path to the hash hierarchy, or specify a relative path that puts the links
++    outside the destination (e.g. "../links").
++
++    Keep in mind that the hierarchy is never pruned, so if you need to reclaim
++    space, you should remove any files that have just one link (since they are
++    not linked into any destination dirs anymore):
++
++    >     find $DIR -links 1 -delete
++
++    The link farm's directory hierarchy is determined by the file's (32-char)
++    MD5 hash and the file-length.  The hash is split up into directory shards.
++    For example, if a file is 54321 bytes long, it could be stored like this:
++
++    >     $DIR/123/456/789/01234567890123456789012.54321.0
++
++    Note that the directory layout in this patch was modified for version
++    3.1.0, so anyone using an older version of this patch should move their
++    existing link hierarchy out of the way and then use the newer rsync to copy
++    the saved hierarchy into its new layout.  Assuming that no files have
++    overflowed their link limits, this would work:
++
++    >     mv $DIR $DIR.old
++    >     rsync -aiv --link-by-hash=$DIR $DIR.old/ $DIR.tmp/
++    >     rm -rf $DIR.tmp
++    >     rm -rf $DIR.old
++
++    If some of your files are at their link limit, you'd be better of using a
++    script to calculate the md5 sum of each file in the hierarchy and move it
++    to its new location.
++
+ 0.  `--compress`, `-z`
+     With this option, rsync compresses the file data as it is sent to the
 diff --git a/rsync.c b/rsync.c
 --- a/rsync.c
 +++ b/rsync.c
-@@ -50,6 +50,7 @@ extern int flist_eof;
+@@ -52,6 +52,7 @@ extern int flist_eof;
  extern int file_old_total;
  extern int keep_dirlinks;
  extern int make_backups;
@@ -375,7 +373,7 @@ diff --git a/rsync.c b/rsync.c
  extern int sanitize_paths;
  extern struct file_list *cur_flist, *first_flist, *dir_flist;
  extern struct chmod_mode_struct *daemon_chmod_modes;
-@@ -726,6 +727,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
+@@ -760,6 +761,10 @@ int finish_transfer(const char *fname, const char *fnametmp,
        }
        if (ret == 0) {
                /* The file was moved into place (not copied), so it's done. */
@@ -389,7 +387,7 @@ diff --git a/rsync.c b/rsync.c
 diff --git a/rsync.h b/rsync.h
 --- a/rsync.h
 +++ b/rsync.h
-@@ -1339,7 +1339,8 @@ extern short info_levels[], debug_levels[];
+@@ -1446,7 +1446,8 @@ extern short info_levels[], debug_levels[];
  #define DEBUG_FUZZY (DEBUG_FLIST+1)
  #define DEBUG_GENR (DEBUG_FUZZY+1)
  #define DEBUG_HASH (DEBUG_GENR+1)
@@ -399,88 +397,30 @@ diff --git a/rsync.h b/rsync.h
  #define DEBUG_ICONV (DEBUG_HLINK+1)
  #define DEBUG_IO (DEBUG_ICONV+1)
  #define DEBUG_NSTR (DEBUG_IO+1)
-diff --git a/rsync.yo b/rsync.yo
---- a/rsync.yo
-+++ b/rsync.yo
-@@ -429,6 +429,7 @@ to the detailed description below for a complete description.  verb(
-      --compare-dest=DIR      also compare received files relative to DIR
-      --copy-dest=DIR         ... and include copies of unchanged files
-      --link-dest=DIR         hardlink to files in DIR when unchanged
-+     --link-by-hash=DIR      create hardlinks by hash into DIR
-  -z, --compress              compress file data during the transfer
-      --compress-level=NUM    explicitly set compression level
-      --skip-compress=LIST    skip compressing files with suffix in LIST
-@@ -2052,6 +2053,48 @@ bf(--link-dest) from working properly for a non-super-user when bf(-o) was
- specified (or implied by bf(-a)).  You can work-around this bug by avoiding
- the bf(-o) option when sending to an old rsync.
+diff --git a/rsyncd.conf.5.md b/rsyncd.conf.5.md
+--- a/rsyncd.conf.5.md
++++ b/rsyncd.conf.5.md
+@@ -388,6 +388,23 @@ in the values of parameters.  See that section for details.
+     is 0, which means no limit.  A negative value disables the module.  See
+     also the "[lock file](#)" parameter.
  
-+dit(bf(--link-by-hash=DIR)) This option hard links the destination files into
-+em(DIR), a link farm arranged by MD5 file hash. The result is that the system
-+will only store (usually) one copy of the unique contents of each file,
-+regardless of the file's name (it will use extra files if the links overflow
-+the available maximum).
-+
-+This patch does not take into account file permissions, extended attributes,
-+or ACLs when linking things together, so you should only use this if you
-+don't care about preserving those extra file attributes (or if they are
-+always the same for identical files).
-+
-+The DIR is relative to the destination directory, so either specify a full
-+path to the hash hierarchy, or specify a relative path that puts the links
-+outside the destination (e.g. "../links").
-+
-+Keep in mind that the hierarchy is never pruned, so if you need to reclaim
-+space, you should remove any files that have just one link (since they are not
-+linked into any destination dirs anymore):
-+
-+    find $DIR -links 1 -delete
-+
-+The link farm's directory hierarchy is determined by the file's (32-char) MD5
-+hash and the file-length.  The hash is split up into directory shards.  For
-+example, if a file is 54321 bytes long, it could be stored like this:
-+
-+    $DIR/123/456/789/01234567890123456789012.54321.0
-+
-+Note that the directory layout in this patch was modified for version 3.1.0,
-+so anyone using an older version of this patch should move their existing
-+link hierarchy out of the way and then use the newer rsync to copy the saved
-+hierarchy into its new layout.  Assuming that no files have overflowed their
-+link limits, this would work:
-+
-+    mv $DIR $DIR.old
-+    rsync -aiv --link-by-hash=$DIR $DIR.old/ $DIR.tmp/
-+    rm -rf $DIR.tmp
-+    rm -rf $DIR.old
-+
-+If some of your files are at their link limit, you'd be better of using a
-+script to calculate the md5 sum of each file in the hierarchy and move it
-+to its new location.
-+
- dit(bf(-z, --compress)) With this option, rsync compresses the file data
- as it is sent to the destination machine, which reduces the amount of data
- being transmitted -- something that is useful over a slow connection.
-diff --git a/rsyncd.conf.yo b/rsyncd.conf.yo
---- a/rsyncd.conf.yo
-+++ b/rsyncd.conf.yo
-@@ -297,6 +297,21 @@ message telling them to try later.  The default is 0, which means no limit.
- A negative value disables the module.
- See also the "lock file" parameter.
-+dit(bf(link by hash dir)) When the "link by hash dir" parameter is set to a
-+non-empty string, received files will be hard linked into em(DIR), a link farm
-+arranged by MD5 file hash. See the bf(--link-by-hash) option for a full
-+explanation.
++0.  `link by hash dir`
++
++    When the "link by hash dir" parameter is set to a non-empty string,
++    received files will be hard linked into **DIR**, a link farm arranged by
++    MD5 file hash. See the `--link-by-hash` option for a full explanation.
 +
-+The em(DIR) must be accessible inside any chroot restrictions for the module,
-+but can exist outside the transfer location if there is an inside-the-chroot
-+path to the module (see "use chroot").  Note that a user-specified option does
-+not allow this outside-the-transfer-area placement.
++    The **DIR** must be accessible inside any chroot restrictions for the
++    module, but can exist outside the transfer location if there is an
++    inside-the-chroot path to the module (see "use chroot").  Note that a
++    user-specified option does not allow this outside-the-transfer-area
++    placement.
 +
-+If this parameter is set, it will disable the bf(--link-by-hash) command-line
-+option for copies into the module.
++    If this parameter is set, it will disable the `--link-by-hash` command-line
++    option for copies into the module.
 +
 +The default is for this parameter to be unset.
 +
- dit(bf(log file)) When the "log file" parameter is set to a non-empty
- string, the rsync daemon will log messages to the indicated file rather
- than using syslog. This is particularly useful on systems (such as AIX)
+ 0.  `log file`
+     When the "log file" parameter is set to a non-empty string, the rsync