X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=vss.c;h=db1beeba17d080e08f306830bc0ce9dd0b7bf5e0;hb=71bcf40d3aeed43884c8db9e44d5eade41f22db2;hp=e833543e785788876af91d691b73cf8876899de3;hpb=7bba6232e873b7a6acc95ac05b4e333f86a51a46;p=paraslash.git diff --git a/vss.c b/vss.c index e833543e..db1beeba 100644 --- a/vss.c +++ b/vss.c @@ -132,6 +132,7 @@ struct fec_group { uint16_t slice_bytes; }; +/** A FEC client is always in one of these states. */ enum fec_client_state { FEC_STATE_NONE = 0, /**< not initialized and not enabled */ FEC_STATE_DISABLED, /**< temporarily disabled */ @@ -1078,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) * @@ -1092,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++; } }