X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=vss.c;h=db1beeba17d080e08f306830bc0ce9dd0b7bf5e0;hp=e336a9e7413d469c71a6221cab0e86b0aae24867;hb=71bcf40d3aeed43884c8db9e44d5eade41f22db2;hpb=ff70d3f74c6116cf5b3c9a6708218788363efa7c diff --git a/vss.c b/vss.c index e336a9e7..db1beeba 100644 --- a/vss.c +++ b/vss.c @@ -1079,8 +1079,6 @@ static void vss_send(struct vss_task *vsst) senders[i].send(mmd->current_chunk, mmd->chunks_sent, buf, len, vsst->header_buf, vsst->header_len); } - mmd->chunks_sent++; - mmd->current_chunk++; /* * Prefault next chunk(s) * @@ -1093,11 +1091,15 @@ static void vss_send(struct vss_task *vsst) * eliminate the delays completely. Moreover, it is supported * only on Linux. So we do our own read-ahead here. */ - buf += len; - for (i = 0; i < 5 && buf < vsst->map + mmd->size; i++) { - __a_unused volatile char x = *buf; - buf += 4096; + if (mmd->current_chunk > 0) { /* chunk 0 might be on the heap */ + buf += len; + for (i = 0; i < 5 && buf < vsst->map + mmd->size; i++) { + __a_unused volatile char x = *buf; + buf += 4096; + } } + mmd->chunks_sent++; + mmd->current_chunk++; } }