venti: formatting changes for wrarena

This commit is contained in:
Russ Cox 2007-09-24 22:35:57 -04:00
parent 67a65bbaa5
commit 952f137f04

View file

@ -62,9 +62,9 @@ rdarena(Arena *arena, u64int offset)
{ {
int i; int i;
u64int a, aa, e; u64int a, aa, e;
uchar score[VtScoreSize];
Clump cl; Clump cl;
ClumpInfo ci; ClumpInfo ci;
uchar score[VtScoreSize];
ZBlock *lump; ZBlock *lump;
ZClump zcl; ZClump zcl;
@ -75,19 +75,20 @@ rdarena(Arena *arena, u64int offset)
e = arena->base + arena->size; e = arena->base + arena->size;
if(offset != ~(u64int)0) { if(offset != ~(u64int)0) {
if(offset >= e - a) if(offset >= e - a)
sysfatal("bad offset %#llx >= %#llx\n", sysfatal("bad offset %#llx >= %#llx\n", offset, e - a);
offset, e-a);
aa = offset; aa = offset;
} else } else
aa = 0; aa = 0;
if(maxwrites != 0) i = 0;
for(i=0, a=0; i<arena->memstats.clumps; i++, a+=ClumpSize+ci.size) { for(a = 0; maxwrites != 0 && i < arena->memstats.clumps;
if(readclumpinfo(arena, i, &ci) < 0) a += ClumpSize + ci.size){
if(readclumpinfo(arena, i++, &ci) < 0)
break; break;
if(a < aa || ci.type == VtCorruptType){ if(a < aa || ci.type == VtCorruptType){
if(ci.type == VtCorruptType) if(ci.type == VtCorruptType)
fprint(2, "corrupt at %#llx: +%d\n", a, ClumpSize+ci.size); fprint(2, "corrupt at %#llx: +%d\n",
a, ClumpSize+ci.size);
continue; continue;
} }
lump = loadclump(arena, a, 0, &cl, score, 0); lump = loadclump(arena, a, 0, &cl, score, 0);
@ -98,11 +99,13 @@ rdarena(Arena *arena, u64int offset)
if(!fast && cl.info.type != VtCorruptType) { if(!fast && cl.info.type != VtCorruptType) {
scoremem(score, lump->data, cl.info.uncsize); scoremem(score, lump->data, cl.info.uncsize);
if(scorecmp(cl.info.score, score) != 0) { if(scorecmp(cl.info.score, score) != 0) {
fprint(2, "clump %#llx has mismatched score\n", a); fprint(2, "clump %#llx has mismatched score\n",
a);
break; break;
} }
if(vttypevalid(cl.info.type) < 0) { if(vttypevalid(cl.info.type) < 0) {
fprint(2, "clump %#llx has bad type %d\n", a, cl.info.type); fprint(2, "clump %#llx has bad type %d\n",
a, cl.info.type);
break; break;
} }
} }
@ -113,8 +116,8 @@ rdarena(Arena *arena, u64int offset)
send(c, &zcl); send(c, &zcl);
}else }else
freezblock(lump); freezblock(lump);
if(maxwrites>0 && --maxwrites == 0) if(maxwrites > 0)
break; --maxwrites;
} }
if(a > aa) if(a > aa)
aa = a; aa = a;