X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/5dd14f0c3388f69932d521915e039e32b9e6d970..b3bf9b9df95137a3a43248be9599d919b04877af:/io.c diff --git a/io.c b/io.c index ed556b15..12e648d4 100644 --- a/io.c +++ b/io.c @@ -4,7 +4,7 @@ * Copyright (C) 1996-2001 Andrew Tridgell * Copyright (C) 1996 Paul Mackerras * Copyright (C) 2001, 2002 Martin Pool - * Copyright (C) 2003-2008 Wayne Davison + * Copyright (C) 2003-2009 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,16 +124,7 @@ static void writefd(int fd, const char *buf, size_t len); static void writefd_unbuffered(int fd, const char *buf, size_t len); static void mplex_write(int fd, enum msgcode code, const char *buf, size_t len, int convert); -struct flist_ndx_item { - struct flist_ndx_item *next; - int ndx; -}; - -struct flist_ndx_list { - struct flist_ndx_item *head, *tail; -}; - -static struct flist_ndx_list redo_list, hlink_list; +static flist_ndx_list redo_list, hlink_list; struct msg_list_item { struct msg_list_item *next; @@ -147,39 +138,6 @@ struct msg_list { static struct msg_list msg_queue; -static void flist_ndx_push(struct flist_ndx_list *lp, int ndx) -{ - struct flist_ndx_item *item; - - if (!(item = new(struct flist_ndx_item))) - out_of_memory("flist_ndx_push"); - item->next = NULL; - item->ndx = ndx; - if (lp->tail) - lp->tail->next = item; - else - lp->head = item; - lp->tail = item; -} - -static int flist_ndx_pop(struct flist_ndx_list *lp) -{ - struct flist_ndx_item *next; - int ndx; - - if (!lp->head) - return -1; - - ndx = lp->head->ndx; - next = lp->head->next; - free(lp->head); - lp->head = next; - if (!next) - lp->tail = NULL; - - return ndx; -} - static void got_flist_entry_status(enum festatus status, const char *buf) { int ndx = IVAL(buf, 0); @@ -206,6 +164,11 @@ static void got_flist_entry_status(enum festatus status, const char *buf) } break; case FES_REDO: + if (read_batch) { + if (inc_recurse) + flist->in_progress++; + break; + } if (inc_recurse) flist->to_redo++; flist_ndx_push(&redo_list, ndx); @@ -484,9 +447,14 @@ static void read_msg_fd(void) * this, sender-side deletions were mostly happening at the end. */ void increment_active_files(int ndx, int itemizing, enum logcode code) { - /* TODO: tune these limits? */ - while (active_filecnt >= (active_bytecnt >= 128*1024 ? 10 : 50)) { + while (1) { + /* TODO: tune these limits? */ + int limit = active_bytecnt >= 128*1024 ? 10 : 50; + if (active_filecnt < limit) + break; check_for_finished_files(itemizing, code, 0); + if (active_filecnt < limit) + break; if (iobuf_out_cnt) io_flush(NORMAL_FLUSH); else