- Parse hard-link info as soon as we get it in inc_recurse mode.
authorWayne Davison <wayned@samba.org>
Sat, 15 Sep 2007 15:40:57 +0000 (15:40 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 15 Sep 2007 15:40:57 +0000 (15:40 +0000)
- Improve the chances of the generator finding a match for a
  hard-link file in inc_recurse mode.

generator.c
io.c
main.c

index 6f02446..438d940 100644 (file)
@@ -1921,9 +1921,12 @@ void generate_files(int f_out, const char *local_name)
 
        do {
 #ifdef SUPPORT_HARD_LINKS
 
        do {
 #ifdef SUPPORT_HARD_LINKS
-               if (inc_recurse && preserve_hard_links)
-                       match_hard_links(cur_flist);
+               if (preserve_hard_links && inc_recurse) {
+                       while (!flist_eof && file_total < FILECNT_LOOKAHEAD/2)
+                               wait_for_receiver();
+               }
 #endif
 #endif
+
                if (inc_recurse && cur_flist->ndx_start) {
                        struct file_struct *fp = dir_flist->files[cur_flist->parent_ndx];
                        f_name(fp, fbuf);
                if (inc_recurse && cur_flist->ndx_start) {
                        struct file_struct *fp = dir_flist->files[cur_flist->parent_ndx];
                        f_name(fp, fbuf);
diff --git a/io.c b/io.c
index b3f3373..62990b9 100644 (file)
--- a/io.c
+++ b/io.c
@@ -377,6 +377,10 @@ static void read_msg_fd(void)
                }
                flist = recv_file_list(fd);
                flist->parent_ndx = IVAL(buf,0);
                }
                flist = recv_file_list(fd);
                flist->parent_ndx = IVAL(buf,0);
+#ifdef SUPPORT_HARD_LINKS
+               if (preserve_hard_links)
+                       match_hard_links(flist);
+#endif
                break;
        case MSG_FLIST_EOF:
                if (len != 0 || !am_generator || !inc_recurse)
                break;
        case MSG_FLIST_EOF:
                if (len != 0 || !am_generator || !inc_recurse)
diff --git a/main.c b/main.c
index efcd060..d8d3480 100644 (file)
--- a/main.c
+++ b/main.c
@@ -71,7 +71,7 @@ extern char *shell_cmd;
 extern char *batch_name;
 extern char *password_file;
 extern char curr_dir[MAXPATHLEN];
 extern char *batch_name;
 extern char *password_file;
 extern char curr_dir[MAXPATHLEN];
-extern struct file_list *cur_flist;
+extern struct file_list *first_flist;
 extern struct filter_list_struct server_filter_list;
 
 int local_server = 0;
 extern struct filter_list_struct server_filter_list;
 
 int local_server = 0;
@@ -721,7 +721,7 @@ static int do_recv(int f_in, int f_out, char *local_name)
 
 #ifdef SUPPORT_HARD_LINKS
        if (preserve_hard_links && !inc_recurse)
 
 #ifdef SUPPORT_HARD_LINKS
        if (preserve_hard_links && !inc_recurse)
-               match_hard_links(cur_flist);
+               match_hard_links(first_flist);
 #endif
 
        if (fd_pair(error_pipe) < 0) {
 #endif
 
        if (fd_pair(error_pipe) < 0) {
@@ -796,6 +796,14 @@ static int do_recv(int f_in, int f_out, char *local_name)
        set_msg_fd_in(error_pipe[0]);
        io_start_buffering_in(error_pipe[0]);
 
        set_msg_fd_in(error_pipe[0]);
        io_start_buffering_in(error_pipe[0]);
 
+#ifdef SUPPORT_HARD_LINKS
+       if (preserve_hard_links && inc_recurse) {
+               struct file_list *flist;
+               for (flist = first_flist; flist; flist = flist->next)
+                       match_hard_links(flist);
+       }
+#endif
+
        generate_files(f_out, local_name);
 
        handle_stats(-1);
        generate_files(f_out, local_name);
 
        handle_stats(-1);