venti/randtest: compute totalbytes correctly
This commit is contained in:
parent
50f5d1a7a8
commit
72281ecda8
1 changed files with 4 additions and 3 deletions
|
|
@ -96,8 +96,9 @@ run(void (*fn)(char*, char*), Channel *c)
|
||||||
buf = vtmalloc(blocksize);
|
buf = vtmalloc(blocksize);
|
||||||
cur = 0;
|
cur = 0;
|
||||||
packets = totalbytes/blocksize;
|
packets = totalbytes/blocksize;
|
||||||
if(maxpackets == 0)
|
if(maxpackets > 0 && maxpackets < packets)
|
||||||
maxpackets = packets;
|
packets = maxpackets;
|
||||||
|
totalbytes = (vlong)packets * blocksize;
|
||||||
order = vtmalloc(packets*sizeof order[0]);
|
order = vtmalloc(packets*sizeof order[0]);
|
||||||
for(i=0; i<packets; i++)
|
for(i=0; i<packets; i++)
|
||||||
order[i] = i;
|
order[i] = i;
|
||||||
|
|
@ -109,7 +110,7 @@ run(void (*fn)(char*, char*), Channel *c)
|
||||||
order[j] = t;
|
order[j] = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0; i<packets && i<maxpackets; i++){
|
for(i=0; i<packets; i++){
|
||||||
memmove(buf, template, blocksize);
|
memmove(buf, template, blocksize);
|
||||||
*(uint*)buf = order[i];
|
*(uint*)buf = order[i];
|
||||||
if(c){
|
if(c){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue