Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix confusion between RERR_NOSUPPORT and RERR_UNSUPPORTED for exit codes
[rsync/rsync.git]
/
match.c
diff --git
a/match.c
b/match.c
index
1210215
..
845bd35
100644
(file)
--- a/
match.c
+++ b/
match.c
@@
-29,18
+29,18
@@
extern int remote_version;
typedef unsigned short tag;
#define TABLESIZE (1<<16)
typedef unsigned short tag;
#define TABLESIZE (1<<16)
-#define NULL_TAG (
(tag)
-1)
+#define NULL_TAG (-1)
static int false_alarms;
static int tag_hits;
static int matches;
static int false_alarms;
static int tag_hits;
static int matches;
-static int data_transfer;
+static int
64
data_transfer;
static int total_false_alarms;
static int total_tag_hits;
static int total_matches;
static int total_false_alarms;
static int total_tag_hits;
static int total_matches;
-static int64 total_data_transfer;
+extern struct stats stats;
struct target {
tag t;
struct target {
tag t;
@@
-49,7
+49,7
@@
struct target {
static struct target *targets;
static struct target *targets;
-static
tag
*tag_table;
+static
int
*tag_table;
#define gettag2(s1,s2) (((s1) + (s2)) & 0xFFFF)
#define gettag(sum) gettag2((sum)&0xFFFF,(sum)>>16)
#define gettag2(s1,s2) (((s1) + (s2)) & 0xFFFF)
#define gettag(sum) gettag2((sum)&0xFFFF,(sum)>>16)
@@
-65,7
+65,7
@@
static void build_hash_table(struct sum_struct *s)
int i;
if (!tag_table)
int i;
if (!tag_table)
- tag_table = (
tag *)malloc(sizeof(tag
)*TABLESIZE);
+ tag_table = (
int *)malloc(sizeof(tag_table[0]
)*TABLESIZE);
targets = (struct target *)malloc(sizeof(targets[0])*s->count);
if (!tag_table || !targets)
targets = (struct target *)malloc(sizeof(targets[0])*s->count);
if (!tag_table || !targets)
@@
-103,11
+103,10
@@
static void matched(int f,struct sum_struct *s,struct map_struct *buf,
send_token(f,i,buf,last_match,n,i<0?0:s->sums[i].len);
data_transfer += n;
send_token(f,i,buf,last_match,n,i<0?0:s->sums[i].len);
data_transfer += n;
- if (n > 0)
- write_flush(f);
-
- if (i >= 0)
+ if (i >= 0) {
+ stats.matched_data += s->sums[i].len;
n += s->sums[i].len;
n += s->sums[i].len;
+ }
for (j=0;j<n;j+=CHUNK_SIZE) {
int n1 = MIN(CHUNK_SIZE,n-j);
for (j=0;j<n;j+=CHUNK_SIZE) {
int n1 = MIN(CHUNK_SIZE,n-j);
@@
-119,6
+118,11
@@
static void matched(int f,struct sum_struct *s,struct map_struct *buf,
last_match = offset + s->sums[i].len;
else
last_match = offset;
last_match = offset + s->sums[i].len;
else
last_match = offset;
+
+ if (buf)
+ show_progress(last_match, buf->size);
+
+ if (i == -1) end_progress();
}
}
@@
-253,6
+257,12
@@
void match_sums(int f,struct sum_struct *s,struct map_struct *buf,OFF_T len)
if (verbose > 2)
rprintf(FINFO,"done hash search\n");
} else {
if (verbose > 2)
rprintf(FINFO,"done hash search\n");
} else {
+ OFF_T j;
+ /* by doing this in pieces we avoid too many seeks */
+ for (j=0;j<(len-CHUNK_SIZE);j+=CHUNK_SIZE) {
+ int n1 = MIN(CHUNK_SIZE,(len-CHUNK_SIZE)-j);
+ matched(f,s,buf,j+n1,-2);
+ }
matched(f,s,buf,len,-1);
}
matched(f,s,buf,len,-1);
}
@@
-276,7
+286,7
@@
void match_sums(int f,struct sum_struct *s,struct map_struct *buf,OFF_T len)
total_tag_hits += tag_hits;
total_false_alarms += false_alarms;
total_matches += matches;
total_tag_hits += tag_hits;
total_false_alarms += false_alarms;
total_matches += matches;
-
total_data_transfer
+= data_transfer;
+
stats.literal_data
+= data_transfer;
}
void match_report(void)
}
void match_report(void)
@@
-285,7
+295,8
@@
void match_report(void)
return;
rprintf(FINFO,
return;
rprintf(FINFO,
- "total: matches=%d tag_hits=%d false_alarms=%d
data=%ld
\n",
+ "total: matches=%d tag_hits=%d false_alarms=%d
data=%.0f
\n",
total_matches,total_tag_hits,
total_matches,total_tag_hits,
- total_false_alarms,(long)total_data_transfer);
+ total_false_alarms,
+ (double)stats.literal_data);
}
}