diff options
author | Russ Cox <rsc@swtch.com> | 2007-09-24 22:35:57 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2007-09-24 22:35:57 -0400 |
commit | 952f137f04a7e93519415ac47bafe1b404f2ca47 (patch) | |
tree | 854db16ff0f2c58d14dc02dfa0977c2fc73c1bfc /src | |
parent | 67a65bbaa5df3751206eca4fd0c2db359095800f (diff) | |
download | plan9port-952f137f04a7e93519415ac47bafe1b404f2ca47.tar.gz plan9port-952f137f04a7e93519415ac47bafe1b404f2ca47.tar.bz2 plan9port-952f137f04a7e93519415ac47bafe1b404f2ca47.zip |
venti: formatting changes for wrarena
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/venti/srv/wrarena.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/cmd/venti/srv/wrarena.c b/src/cmd/venti/srv/wrarena.c index 115ae883..a9f67b11 100644 --- a/src/cmd/venti/srv/wrarena.c +++ b/src/cmd/venti/srv/wrarena.c @@ -62,9 +62,9 @@ rdarena(Arena *arena, u64int offset) { int i; u64int a, aa, e; + uchar score[VtScoreSize]; Clump cl; ClumpInfo ci; - uchar score[VtScoreSize]; ZBlock *lump; ZClump zcl; @@ -74,20 +74,21 @@ rdarena(Arena *arena, u64int offset) a = arena->base; e = arena->base + arena->size; if(offset != ~(u64int)0) { - if(offset >= e-a) - sysfatal("bad offset %#llx >= %#llx\n", - offset, e-a); + if(offset >= e - a) + sysfatal("bad offset %#llx >= %#llx\n", offset, e - a); aa = offset; } else aa = 0; - if(maxwrites != 0) - for(i=0, a=0; i<arena->memstats.clumps; i++, a+=ClumpSize+ci.size) { - if(readclumpinfo(arena, i, &ci) < 0) + i = 0; + for(a = 0; maxwrites != 0 && i < arena->memstats.clumps; + a += ClumpSize + ci.size){ + if(readclumpinfo(arena, i++, &ci) < 0) break; if(a < aa || 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; } lump = loadclump(arena, a, 0, &cl, score, 0); @@ -98,11 +99,13 @@ rdarena(Arena *arena, u64int offset) if(!fast && cl.info.type != VtCorruptType) { scoremem(score, lump->data, cl.info.uncsize); 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; } 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; } } @@ -113,8 +116,8 @@ rdarena(Arena *arena, u64int offset) send(c, &zcl); }else freezblock(lump); - if(maxwrites>0 && --maxwrites == 0) - break; + if(maxwrites > 0) + --maxwrites; } if(a > aa) aa = a; |