Commit 96d910c7 authored by Wayne Davison's avatar Wayne Davison

Call map_file() with its new args, including a suggested window

size.
parent 7560c17a
......@@ -102,7 +102,7 @@ void file_checksum(char *fname,char *sum,OFF_T size)
if (fd == -1)
return;
buf = map_file(fd, size, CSUM_CHUNK);
buf = map_file(fd, size, CSUM_CHUNK * 2048, 0);
mdfour_begin(&m);
......
......@@ -154,7 +154,7 @@ static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len)
c >>= 1;
} while (c >= 8); /* round to multiple of 8 */
blength = MAX(blength, BLOCK_SIZE);
blength = MIN(blength, MAX_MAP_SIZE);
blength = MIN(blength, MAX_BLOCK_SIZE);
}
if (protocol_version < 27) {
......@@ -209,7 +209,7 @@ static void generate_and_send_sums(int fd, OFF_T len, int f_out)
sum_sizes_sqroot(&sum, len);
if (len > 0)
mapbuf = map_file(fd, len, sum.blength);
mapbuf = map_file(fd, len, MAX_MAP_SIZE, sum.blength);
else
mapbuf = NULL;
......
......@@ -222,7 +222,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
read_sum_head(f_in, &sum);
if (fd_r >= 0 && size_r > 0) {
mapbuf = map_file(fd_r, size_r, sum.blength);
OFF_T map_size = MAX(sum.blength * 2, 16*1024);
mapbuf = map_file(fd_r, size_r, map_size, sum.blength);
if (verbose > 2) {
rprintf(FINFO, "recv mapped %s of size %.0f\n",
safe_fname(fname_r), (double)size_r);
......
......@@ -208,7 +208,11 @@ void send_files(struct file_list *flist, int f_out, int f_in)
return;
}
mbuf = st.st_size ? map_file(fd, st.st_size, s->blength) : NULL;
if (st.st_size) {
OFF_T map_size = MAX(s->blength * 3, MAX_MAP_SIZE);
mbuf = map_file(fd, st.st_size, map_size, s->blength);
} else
mbuf = NULL;
if (verbose > 2) {
rprintf(FINFO, "send_files mapped %s of size %.0f\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment