venti: import changes from plan 9

R=rsc
CC=plan9port.codebot
http://codereview.appspot.com/4523057
This commit is contained in:
David du Colombier 2011-06-02 09:33:56 -04:00 committed by Russ Cox
parent 7fb06adf54
commit f5a8ea6fd8
21 changed files with 141 additions and 63 deletions

View file

@ -328,16 +328,20 @@ newindex(char *name, ISect **sects, int n)
}
if(nb >= ((u64int)1 << 32)){
seterr(EBug, "index too large");
return nil;
fprint(2, "%s: index is 2^32 blocks or more; ignoring some of it\n",
argv0);
nb = ((u64int)1 << 32) - 1;
}
div = (((u64int)1 << 32) + nb - 1) / nb;
ub = (((u64int)1 << 32) - 1) / div + 1;
if(div < 100){
seterr(EBug, "index divisor too coarse [%lld buckets]", nb);
return nil;
fprint(2, "%s: index divisor %d too coarse; "
"index larger than needed, ignoring some of it\n",
argv0, div);
div = 100;
nb = (((u64int)1 << 32) - 1) / (100 - 1);
}
ub = (((u64int)1 << 32) - 1) / div + 1;
if(ub > nb){
seterr(EBug, "index initialization math wrong");
return nil;