From fa325e9b42b0bdfb48857d1958d9fb7ceac55151 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Fri, 10 Jan 2020 14:44:21 +0000 Subject: Trivial changes: whitespace and modes. Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross --- src/cmd/venti/copy.c | 10 +-- src/cmd/venti/devnull.c | 3 +- src/cmd/venti/dump.c | 8 +- src/cmd/venti/randtest.c | 1 - src/cmd/venti/readlist.c | 2 +- src/cmd/venti/ro.c | 7 +- src/cmd/venti/srv/arena.c | 24 +++--- src/cmd/venti/srv/bloom.c | 26 +++---- src/cmd/venti/srv/buildindex.c | 121 +++++++++++++++--------------- src/cmd/venti/srv/clumpstats.c | 2 +- src/cmd/venti/srv/cmparenas.c | 12 +-- src/cmd/venti/srv/config.c | 3 +- src/cmd/venti/srv/conv.c | 12 +-- src/cmd/venti/srv/dat.h | 21 +++--- src/cmd/venti/srv/dcache.c | 18 ++--- src/cmd/venti/srv/disksched.c | 15 ++-- src/cmd/venti/srv/fixarenas.c | 157 +++++++++++++++++++-------------------- src/cmd/venti/srv/fmtbloom.c | 6 +- src/cmd/venti/srv/graph.c | 16 ++-- src/cmd/venti/srv/hdisk.c | 66 ++++++++-------- src/cmd/venti/srv/hproc.c | 3 +- src/cmd/venti/srv/httpd.c | 34 ++++----- src/cmd/venti/srv/icache.c | 31 ++++---- src/cmd/venti/srv/icachewrite.c | 7 +- src/cmd/venti/srv/index.c | 20 +++-- src/cmd/venti/srv/lump.c | 2 +- src/cmd/venti/srv/lumpcache.c | 3 +- src/cmd/venti/srv/lumpqueue.c | 2 +- src/cmd/venti/srv/mgr.c | 46 ++++++------ src/cmd/venti/srv/mirrorarenas.c | 42 +++++------ src/cmd/venti/srv/part.c | 19 ++--- src/cmd/venti/srv/png.c | 8 +- src/cmd/venti/srv/rdarena.c | 2 +- src/cmd/venti/srv/readifile.c | 4 +- src/cmd/venti/srv/reseal.c | 16 ++-- src/cmd/venti/srv/round.c | 1 - src/cmd/venti/srv/sortientry.c | 2 +- src/cmd/venti/srv/stats.c | 12 +-- src/cmd/venti/srv/syncindex0.c | 8 +- src/cmd/venti/srv/venti.c | 2 +- src/cmd/venti/srv/verifyarena.c | 10 +-- src/cmd/venti/srv/wrarena.c | 2 +- src/cmd/venti/srv/xml.c | 1 - src/cmd/venti/srv/zblock.c | 1 - src/cmd/venti/sync.c | 2 +- src/cmd/venti/writefile.c | 7 +- 46 files changed, 396 insertions(+), 421 deletions(-) (limited to 'src/cmd/venti') diff --git a/src/cmd/venti/copy.c b/src/cmd/venti/copy.c index d6d770bc..50d9bb20 100644 --- a/src/cmd/venti/copy.c +++ b/src/cmd/venti/copy.c @@ -53,7 +53,7 @@ static int havevisited(uchar score[VtScoreSize], int type) { ScoreTree a; - + if(scoretree == nil) return 0; memmove(a.score, score, VtScoreSize); @@ -99,7 +99,7 @@ walk(uchar score[VtScoreSize], uint type, int base, int depth) if(memcmp(score, vtzeroscore, VtScoreSize) == 0 || memcmp(score, zeroscore, VtScoreSize) == 0) return; - + if(havevisited(score, type)){ nskip++; return; @@ -145,7 +145,7 @@ walk(uchar score[VtScoreSize], uint type, int base, int depth) continue; walk(e.score, e.type, e.type&VtTypeBaseMask, depth+1); /* - * Don't repack unless we're rewriting -- some old + * Don't repack unless we're rewriting -- some old * vac files have psize==0 and dsize==0, and these * get rewritten by vtentryunpack to have less strange * block sizes. So vtentryunpack; vtentrypack does not @@ -175,7 +175,7 @@ walk(uchar score[VtScoreSize], uint type, int base, int depth) sysfatal("writing block %V (type %d): %r", score, type); } if(!rewrite && memcmp(score, nscore, VtScoreSize) != 0) - sysfatal("not rewriting: wrote %V got %V", score, nscore); + sysfatal("not rewriting: wrote %V got %V", score, nscore); if((type !=0 || base !=0) && verbose){ n = vtzerotruncate(type, buf, n); @@ -185,7 +185,7 @@ walk(uchar score[VtScoreSize], uint type, int base, int depth) fprint(2, " "); fprint(2, "<- %V\n", score); } - + markvisited(score, type); free(buf); } diff --git a/src/cmd/venti/devnull.c b/src/cmd/venti/devnull.c index fdad553e..3bf6cee4 100644 --- a/src/cmd/venti/devnull.c +++ b/src/cmd/venti/devnull.c @@ -33,7 +33,7 @@ threadmain(int argc, char **argv) fmtinstall('V', vtscorefmt); fmtinstall('F', vtfcallfmt); - + address = "tcp!*!venti"; ARGBEGIN{ @@ -76,4 +76,3 @@ threadmain(int argc, char **argv) } threadexitsall(nil); } - diff --git a/src/cmd/venti/dump.c b/src/cmd/venti/dump.c index 352b3cac..53ec4bad 100644 --- a/src/cmd/venti/dump.c +++ b/src/cmd/venti/dump.c @@ -31,7 +31,7 @@ dump(int indent, uchar *score, int type) uchar *buf; VtEntry e; VtRoot root; - + if(spaces[0] == 0) memset(spaces, ' ', sizeof spaces-1); @@ -54,7 +54,7 @@ dump(int indent, uchar *score, int type) indent*4, spaces, score, root.name, root.type, root.prev, root.blocksize); dump(indent+1, root.score, VtDirType); break; - + case VtDirType: Bprint(&bout, "%.*s%V dir n=%d\n", indent*4, spaces, score, n); for(i=0; i*VtEntrySize>1] |= c; } return 0; diff --git a/src/cmd/venti/ro.c b/src/cmd/venti/ro.c index ee954a32..a499aa1e 100644 --- a/src/cmd/venti/ro.c +++ b/src/cmd/venti/ro.c @@ -32,7 +32,7 @@ readthread(void *v) VtReq *r; uchar *buf; int n; - + r = v; buf = vtmalloc(r->tx.count); if((n=vtread(z, r->tx.score, r->tx.blocktype, buf, r->tx.count)) < 0){ @@ -57,10 +57,10 @@ threadmain(int argc, char **argv) fmtinstall('F', vtfcallfmt); fmtinstall('V', vtscorefmt); - + address = "tcp!*!venti"; ventiaddress = nil; - + ARGBEGIN{ case 'v': verbose++; @@ -109,4 +109,3 @@ threadmain(int argc, char **argv) } threadexitsall(nil); } - diff --git a/src/cmd/venti/srv/arena.c b/src/cmd/venti/srv/arena.c index ddeb3b4c..7df1fc4b 100644 --- a/src/cmd/venti/srv/arena.c +++ b/src/cmd/venti/srv/arena.c @@ -401,7 +401,7 @@ atailcmp(ATailStats *a, ATailStats *b) return -1; if(a->used > b->used) return 1; - + /* suspect tests - why order this way? (no one cares) */ if(a->clumps < b->clumps) return -1; @@ -419,7 +419,7 @@ atailcmp(ATailStats *a, ATailStats *b) return -1; if(a->sealed > b->sealed) return 1; - + /* everything matches */ return 0; } @@ -574,7 +574,7 @@ ReadErr: sha1(b->data, bs-VtScoreSize, nil, &s); sha1(zeroscore, VtScoreSize, nil, &s); sha1(nil, 0, score, &s); - + /* * check for no checksum or the same */ @@ -683,7 +683,7 @@ loadarena(Arena *arena) || arena->blocksize != head.blocksize || arena->size + 2 * arena->blocksize != head.size){ if(namecmp(arena->name, head.name)!=0) - logerr(ECorrupt, "arena tail name %s head %s", + logerr(ECorrupt, "arena tail name %s head %s", arena->name, head.name); else if(arena->clumpmagic != head.clumpmagic) logerr(ECorrupt, "arena tail clumpmagic 0x%lux head 0x%lux", @@ -780,22 +780,22 @@ putcib(Arena *arena, CIBlock *cib) /* - * For index entry readahead purposes, the arenas are + * For index entry readahead purposes, the arenas are * broken into smaller subpieces, called clump info groups * or cigs. Each cig has ArenaCIGSize clumps (ArenaCIGSize * is chosen to make the index entries take up about half * a megabyte). The index entries do not contain enough * information to determine what the clump index is for * a given address in an arena. That info is needed both for - * figuring out which clump group an address belongs to + * figuring out which clump group an address belongs to * and for prefetching a clump group's index entries from * the arena table of contents. The first time clump groups * are accessed, we scan the entire arena table of contents - * (which might be 10s of megabytes), recording the data + * (which might be 10s of megabytes), recording the data * offset of each clump group. */ -/* +/* * load clump info group information by scanning entire toc. */ static void @@ -811,7 +811,7 @@ loadcig(Arena *arena) return; // fprint(2, "loadcig %s\n", arena->name); - + ncig = (arena->memstats.clumps+ArenaCIGSize-1) / ArenaCIGSize; if(ncig == 0){ arena->cig = vtmalloc(1); @@ -839,7 +839,7 @@ loadcig(Arena *arena) } } vtfree(ci); - + arena->ncig = ncig; arena->cig = cig; @@ -900,7 +900,7 @@ asumload(Arena *arena, int g, IEntry *entries, int nentries) fprint(2, "asking for too few entries\n"); return -1; } - + qlock(&arena->lock); if(arena->cig == nil) loadcig(arena); @@ -908,7 +908,7 @@ asumload(Arena *arena, int g, IEntry *entries, int nentries) qunlock(&arena->lock); return -1; } - + addr = 0; base = g*ArenaCIGSize; limit = base + ArenaCIGSize; diff --git a/src/cmd/venti/srv/bloom.c b/src/cmd/venti/srv/bloom.c index 42418d1c..d50b1777 100644 --- a/src/cmd/venti/srv/bloom.c +++ b/src/cmd/venti/srv/bloom.c @@ -1,6 +1,6 @@ /* * Bloom filter tracking which scores are present in our arenas - * and (more importantly) which are not. + * and (more importantly) which are not. */ #include "stdinc.h" @@ -13,19 +13,19 @@ int bloominit(Bloom *b, vlong vsize, u8int *data) { ulong size; - + size = vsize; if(size != vsize){ /* truncation */ werrstr("bloom data too big"); return -1; } - + b->size = size; b->nhash = 32; /* will be fixed by caller on initialization */ if(data != nil) if(unpackbloomhead(b, data) < 0) return -1; - + b->bitmask = (b->size<<3) - 1; b->data = data; return 0; @@ -42,7 +42,7 @@ readbloom(Part *p) { uchar buf[512]; Bloom *b; - + b = vtmallocz(sizeof *b); if(readpart(p, 0, buf, sizeof buf) < 0) return nil; @@ -75,7 +75,7 @@ int resetbloom(Bloom *b) { uchar *data; - + data = vtmallocz(b->size); b->data = data; if(b->size == MaxBloomSize) /* 2^32 overflows ulong */ @@ -92,7 +92,7 @@ loadbloom(Bloom *b) uint ones; uchar *data; u32int *a; - + data = vtmallocz(b->size); if(readpart(b->part, 0, data, b->size) < 0){ vtfree(b); @@ -105,14 +105,14 @@ loadbloom(Bloom *b) n = b->size/4; ones = 0; for(i=0; isize == MaxBloomSize) /* 2^32 overflows ulong */ addstat(StatBloomBits, b->size*8-1); else addstat(StatBloomBits, b->size*8); - + return 0; } @@ -204,7 +204,7 @@ inbloomfilter(Bloom *b, u8int *score) if(ignorebloom) return 1; - + rlock(&b->lk); r = _inbloomfilter(b, score); runlock(&b->lk); @@ -236,7 +236,7 @@ markbloomfiltern(Bloom *b, u8int score[][20], int n) if(b == nil || b->data == nil) return; - + rlock(&b->lk); qlock(&b->mod); for(i=0; iwritechan, 0); @@ -268,5 +268,5 @@ startbloomproc(Bloom *b) { b->writechan = chancreate(sizeof(void*), 0); b->writedonechan = chancreate(sizeof(ulong), 0); - vtproc(bloomwriteproc, b); + vtproc(bloomwriteproc, b); } diff --git a/src/cmd/venti/srv/buildindex.c b/src/cmd/venti/srv/buildindex.c index 95fb74b7..faf4b414 100644 --- a/src/cmd/venti/srv/buildindex.c +++ b/src/cmd/venti/srv/buildindex.c @@ -12,7 +12,7 @@ enum }; typedef struct IEntryBuf IEntryBuf; -struct IEntryBuf +struct IEntryBuf { IEntry ie[100]; int nie; @@ -61,7 +61,7 @@ threadmain(int argc, char *argv[]) u32int bcmem, imem; Config conf; Part *p; - + maxdisks = 100000; ventifmtinstall(); imem = 256*1024*1024; @@ -116,18 +116,18 @@ threadmain(int argc, char *argv[]) close(fd); } } - + /* * need a block for every arena */ bcmem = maxblocksize * (mainindex->narenas + 16); if(0) fprint(2, "initialize %d bytes of disk block cache\n", bcmem); initdcache(bcmem); - + totalclumps = 0; for(i=0; inarenas; i++) totalclumps += ix->arenas[i]->diskstats.clumps; - + totalbuckets = 0; for(i=0; insects; i++) totalbuckets += ix->sects[i]->blocks; @@ -142,7 +142,7 @@ threadmain(int argc, char *argv[]) vtproc(isectproc, ix->sects[i]); } } - + for(i=0; ibloom && writebloom(ix->bloom) < 0) fprint(2, "writing bloom filter: %r\n"); - fprint(2, "%T done arenaentries=%,lld indexed=%,lld (nskip=%,lld)\n", + fprint(2, "%T done arenaentries=%,lld indexed=%,lld (nskip=%,lld)\n", arenaentries, indexentries, skipentries); threadexitsall(nil); } @@ -189,7 +189,7 @@ static int shouldprocess(ISect *is) { int i; - + if(nisect == 0) return 1; @@ -205,7 +205,7 @@ static void add(u64int *a, u64int n) { static Lock l; - + lock(&l); *a += n; unlock(&l); @@ -233,7 +233,7 @@ arenapartproc(void *v) IEntryBuf *buf, *b; uchar *score; ScoreBuf sb; - + p = v; threadsetname("arenaproc %s", p->name); buf = MKNZ(IEntryBuf, ix->nsects); @@ -247,10 +247,10 @@ arenapartproc(void *v) if(a->part != p) continue; if(a->memstats.clumps) - fprint(2, "%T arena %s: %d entries\n", + fprint(2, "%T arena %s: %d entries\n", a->name, a->memstats.clumps); /* - * Running the loop backwards accesses the + * Running the loop backwards accesses the * clump info blocks forwards, since they are * stored in reverse order at the end of the arena. * This speeds things slightly. @@ -304,7 +304,7 @@ arenapartproc(void *v) } add(&arenaentries, tot); add(&skipentries, nskip); - + for(i=0; insects; i++) if(ix->sects[i]->writechan && buf[i].nie > 0) send(ix->sects[i]->writechan, &buf[i]); @@ -323,7 +323,7 @@ static u32int score2bucket(ISect *is, uchar *score) { u32int b; - + b = hashbits(score, 32)/ix->div; if(b < is->start || b >= is->stop){ fprint(2, "score2bucket: score=%V div=%d b=%ud start=%ud stop=%ud\n", @@ -340,7 +340,7 @@ static u32int offset2bucket(ISect *is, u64int offset) { u32int b; - + assert(is->blockbase <= offset); offset -= is->blockbase; b = offset/is->blocksize; @@ -358,7 +358,7 @@ bucket2offset(ISect *is, u32int b) return is->blockbase + (u64int)b*is->blocksize; } -/* +/* * IEntry buffers to hold initial round of spraying. */ typedef struct Buf Buf; @@ -378,7 +378,7 @@ static void bflush(Buf *buf) { u32int bufsize; - + if(buf->woffset >= buf->eoffset) sysfatal("buf index chunk overflow - need bigger index"); bufsize = buf->ep - buf->bp; @@ -420,11 +420,11 @@ struct Minibuf }; /* - * Index entry pool. Used when trying to shuffle around + * Index entry pool. Used when trying to shuffle around * the entries in a big buffer into the corresponding M minibuffers. * Sized to hold M*EntriesPerBlock entries, so that there will always * either be room in the pool for another block worth of entries - * or there will be an entire block worth of sorted entries to + * or there will be an entire block worth of sorted entries to * write out. */ typedef struct IEntryLink IEntryLink; @@ -461,7 +461,7 @@ countsokay(IPool *p) { int i; u64int n; - + n = 0; for(i=0; inmbuf; i++) n += p->mcount[i]; @@ -477,21 +477,21 @@ countsokay(IPool *p) */ static IPool* -mkipool(ISect *isect, Minibuf *mbuf, u32int nmbuf, +mkipool(ISect *isect, Minibuf *mbuf, u32int nmbuf, u32int mbufbuckets, u32int bufsize) { u32int i, nentry; uchar *data; IPool *p; IEntryLink *l; - + nentry = (nmbuf+1)*bufsize / IEntrySize; p = ezmalloc(sizeof(IPool) +nentry*sizeof(IEntry) +nmbuf*sizeof(IEntryLink*) +nmbuf*sizeof(u32int) +3*bufsize); - + p->isect = isect; p->mbufbuckets = mbufbuckets; p->bufsize = bufsize; @@ -516,7 +516,7 @@ mkipool(ISect *isect, Minibuf *mbuf, u32int nmbuf, return p; } -/* +/* * Add the index entry ie to the pool p. * Caller must know there is room. */ @@ -543,7 +543,7 @@ ipoolinsert(IPool *p, uchar *ie) l->next = p->mlist[x]; p->mlist[x] = l; p->mcount[x]++; -} +} /* * Pull out a block containing as many @@ -555,7 +555,7 @@ ipoolgetbuf(IPool *p, u32int x) uchar *bp, *ep, *wp; IEntryLink *l; u32int n; - + bp = p->wbuf; ep = p->wbuf + p->bufsize; n = 0; @@ -582,7 +582,7 @@ static void ipoolloadblock(IPool *p, Minibuf *mb) { u32int i, n; - + assert(mb->nentry > 0); assert(mb->roffset >= mb->woffset); assert(mb->roffset < mb->eoffset); @@ -609,14 +609,14 @@ ipoolflush0(IPool *pool, u32int x) { u32int bufsize; Minibuf *mb; - + mb = pool->mbuf+x; bufsize = pool->bufsize; mb->nwentry += ipoolgetbuf(pool, x); if(mb->nentry > 0 && mb->roffset == mb->woffset){ assert(pool->nfree >= pool->bufsize/IEntrySize); /* - * There will be room in the pool -- we just + * There will be room in the pool -- we just * removed a block worth. */ ipoolloadblock(pool, mb); @@ -655,7 +655,7 @@ static void ipoolflush(IPool *pool) { u32int i; - + for(i=0; inmbuf; i++) while(pool->mlist[i]) ipoolflush0(pool, i); @@ -668,7 +668,7 @@ ipoolflush(IPool *pool) */ /* - * Compare two packed index entries. + * Compare two packed index entries. * Usual ordering except break ties by putting higher * index addresses first (assumes have duplicates * due to corruption in the lower addresses). @@ -678,7 +678,7 @@ ientrycmpaddr(const void *va, const void *vb) { int i; uchar *a, *b; - + a = (uchar*)va; b = (uchar*)vb; i = ientrycmp(a, b); @@ -692,7 +692,7 @@ zerorange(Part *p, u64int o, u64int e) { static uchar zero[MaxIoSize]; u32int n; - + for(; o e) @@ -703,7 +703,7 @@ zerorange(Part *p, u64int o, u64int e) } /* - * Load a minibuffer into memory and write out the + * Load a minibuffer into memory and write out the * corresponding buckets. */ static void @@ -714,10 +714,10 @@ sortminibuffer(ISect *is, Minibuf *mb, uchar *buf, u32int nbuf, u32int bufsize) u64int o; IBucket ib; Part *part; - + part = is->part; buckdata = emalloc(is->blocksize); - + if(mb->nwentry == 0) return; @@ -732,7 +732,7 @@ sortminibuffer(ISect *is, Minibuf *mb, uchar *buf, u32int nbuf, u32int bufsize) return; } assert(*(uint*)buf != 0xa5a5a5a5); - + /* * remove fragmentation due to IEntrySize * not evenly dividing Bufsize @@ -746,7 +746,7 @@ sortminibuffer(ISect *is, Minibuf *mb, uchar *buf, u32int nbuf, u32int bufsize) ep = buf + mb->nwentry*IEntrySize; assert(ep <= buf+nbuf); - /* + /* * sort entries */ qsort(buf, mb->nwentry, IEntrySize, ientrycmpaddr); @@ -795,14 +795,14 @@ isectproc(void *v) IPool *ipool; ISect *is; Minibuf *mbuf, *mb; - + is = v; blocksize = is->blocksize; nbucket = is->stop - is->start; /* * Three passes: - * pass 1 - write index entries from arenas into + * pass 1 - write index entries from arenas into * large sequential sections on index disk. * requires nbuf * bufsize memory. * @@ -810,36 +810,36 @@ isectproc(void *v) * requires nminibuf * bufsize memory. * * pass 3 - read each minibuf into memory and - * write buckets out. + * write buckets out. * requires entries/minibuf * IEntrySize memory. - * + * * The larger we set bufsize the less seeking hurts us. - * + * * The fewer sections and minibufs we have, the less * seeking hurts us. - * - * The fewer sections and minibufs we have, the + * + * The fewer sections and minibufs we have, the * more entries we end up with in each minibuf - * at the end. + * at the end. * * Shoot for using half our memory to hold each - * minibuf. The chance of a random distribution - * getting off by 2x is quite low. + * minibuf. The chance of a random distribution + * getting off by 2x is quite low. * - * Once that is decided, figure out the smallest + * Once that is decided, figure out the smallest * nminibuf and nsection/biggest bufsize we can use * and still fit in the memory constraints. */ - + /* expected number of clump index entries we'll see */ xclump = nbucket * (double)totalclumps/totalbuckets; - + /* number of clumps we want to see in a minibuf */ xminiclump = isectmem/2/IEntrySize; - + /* total number of minibufs we need */ prod = (xclump+xminiclump-1) / xminiclump; - + /* if possible, skip second pass */ if(!dumb && prod*MinBufSize < isectmem){ nbuf = prod; @@ -904,7 +904,7 @@ isectproc(void *v) } } add(&indexentries, n); - + nn = 0; for(i=0; ipart->name); - + /* * Rearrange entries into minibuffers and then * split each minibuffer into buckets. - * The minibuffer must be sized so that it is + * The minibuffer must be sized so that it is * a multiple of blocksize -- ipoolloadblock assumes * that each minibuf starts aligned on a blocksize * boundary. @@ -971,7 +971,7 @@ isectproc(void *v) while(mb->nentry > 0){ if(ipool->nfree < epbuf){ ipoolflush1(ipool); - /* ipoolflush1 might change mb->nentry */ + /* ipoolflush1 might change mb->nentry */ continue; } assert(ipool->nfree >= epbuf); @@ -1002,9 +1002,6 @@ isectproc(void *v) } free(data); } - + sendp(isectdonechan, is); } - - - diff --git a/src/cmd/venti/srv/clumpstats.c b/src/cmd/venti/srv/clumpstats.c index d2cfe251..1a7e016c 100644 --- a/src/cmd/venti/srv/clumpstats.c +++ b/src/cmd/venti/srv/clumpstats.c @@ -122,6 +122,6 @@ threadmain(int argc, char *argv[]) initdcache(bcmem); clumpstats(mainindex); - + threadexitsall(0); } diff --git a/src/cmd/venti/srv/cmparenas.c b/src/cmd/venti/srv/cmparenas.c index 322f16ee..5abf8575 100644 --- a/src/cmd/venti/srv/cmparenas.c +++ b/src/cmd/venti/srv/cmparenas.c @@ -57,7 +57,7 @@ printheader(char *name, ArenaHead *head, int fd) Arena arena; vlong baseoff, lo, hi, off; int clumpmax; - + off = seek(fd, 0, 1); seek(fd, off + head->size - head->blocksize, 0); if(readblock(fd, data, head->blocksize) < 0){ @@ -91,7 +91,7 @@ printheader(char *name, ArenaHead *head, int fd) lo = hi; fprint(2, "\t%llx-%llx: clumps (%llx)\n", lo, hi, hi - lo); fprint(2, "\t%llx-%llx: tail\n", hi, hi + head->blocksize); - + fprint(2, "arena:\n"); printarena(2, &arena); return 0; @@ -149,7 +149,7 @@ cmparena(char *name, vlong len) if(printheader(name, &head, fd) < 0) return; - + /* * now we know how much to read * read everything but the last block, which is special @@ -196,7 +196,7 @@ static int shouldcheck(char *name, char **s, int n) { int i; - + if(n == 0) return 1; @@ -213,7 +213,7 @@ char * readap(int fd, ArenaPart *ap) { char *table; - + if(preadblock(fd, data, 8192, PartBlank) < 0) sysfatal("read arena part header: %r"); if(unpackarenapart(ap, data) < 0) @@ -237,7 +237,7 @@ threadmain(int argc, char *argv[]) vlong start, stop; ArenaPart ap; ArenaPart ap1; - + ventifmtinstall(); blocksize = MaxIoSize; ARGBEGIN{ diff --git a/src/cmd/venti/srv/config.c b/src/cmd/venti/srv/config.c index 8c29fe95..e7dde3e4 100644 --- a/src/cmd/venti/srv/config.c +++ b/src/cmd/venti/srv/config.c @@ -201,7 +201,7 @@ configisect(char *file) { Part *part; ISect *is; - + if(0) fprint(2, "configure index section in %s\n", file); part = initpart(file, ORDWR|ODIRECT); @@ -252,4 +252,3 @@ void needmainindex(void) { } - diff --git a/src/cmd/venti/srv/conv.c b/src/cmd/venti/srv/conv.c index e6a6cbfe..90aefbec 100644 --- a/src/cmd/venti/srv/conv.c +++ b/src/cmd/venti/srv/conv.c @@ -162,7 +162,7 @@ unpackarena(Arena *arena, u8int *buf) * all the existing version 4 arenas too. * * To maintain backwards compatibility with existing venti - * installations using the older format, we define that if + * installations using the older format, we define that if * memstats == diskstats, then the extension fields are not * included (see packarena below). That is, only partially * indexed arenas have these fields. Fully indexed arenas @@ -181,7 +181,7 @@ unpackarena(Arena *arena, u8int *buf) p += U64Size; arena->memstats.sealed = U8GET(p); p += U8Size; - + /* * 2008/4/2 * Packarena (below) used to have a bug in which it would @@ -264,7 +264,7 @@ _packarena(Arena *arena, u8int *buf, int forceext) p += U64Size; U8PUT(p, arena->diskstats.sealed); p += U8Size; - + /* * Extension fields; see above. */ @@ -281,7 +281,7 @@ _packarena(Arena *arena, u8int *buf, int forceext) p += U32Size; U32PUT(p, arena->memstats.cclumps); p += U32Size; - U64PUT(p, arena->memstats.used, t32); + U64PUT(p, arena->memstats.used, t32); p += U64Size; U64PUT(p, arena->memstats.uncsize, t32); p += U64Size; @@ -669,7 +669,7 @@ unpackibucket(IBucket *b, u8int *buf, u32int magic) b->data = buf + IBucketSize; if(magic && magic != U32GET(buf+U16Size)) b->n = 0; -} +} void packibucket(IBucket *b, u8int *buf, u32int magic) @@ -705,7 +705,7 @@ unpackbloomhead(Bloom *b, u8int *buf) return -1; } p += U32Size; - + m = U32GET(p); if(m != BloomVersion){ seterr(ECorrupt, "bloom filter has wrong version %ud expected %ud", (uint)m, (uint)BloomVersion); diff --git a/src/cmd/venti/srv/dat.h b/src/cmd/venti/srv/dat.h index f47d01a1..68e6c8f5 100644 --- a/src/cmd/venti/srv/dat.h +++ b/src/cmd/venti/srv/dat.h @@ -90,7 +90,7 @@ enum ArenaPartMagic = 0xa9e4a5e7U, /* arena partition header */ ArenaMagic = 0xf2a14eadU, /* arena trailer */ ArenaHeadMagic = 0xd15c4eadU, /* arena header */ - + BloomMagic = 0xb1004eadU, /* bloom filter header */ BloomMaxHash = 32, @@ -145,7 +145,7 @@ enum IEntryAddrOff = VtScoreSize + U32Size + U16Size, MaxClumpBlocks = (VtMaxLumpSize + ClumpSize + (1 << ABlockLog) - 1) >> ABlockLog, - + IcacheFrac = 1000000, /* denominator */ SleepForever = 1000000000, /* magic value for sleep time */ @@ -156,7 +156,7 @@ enum DirtyArenaCib, DirtyArenaTrailer, DirtyMax, - + ArenaCIGSize = 10*1024, // about 0.5 MB worth of IEntry. VentiZZZZZZZZ @@ -231,7 +231,7 @@ struct DBlock u32int used2; u32int ref; /* reference count */ RWLock lock; /* for access to data only */ - Channel *writedonechan; + Channel *writedonechan; void* chanbuf[1]; /* buffer for the chan! */ }; @@ -315,7 +315,7 @@ struct CIBlock }; /* - * Statistics kept in the tail. + * Statistics kept in the tail. */ struct ATailStats { @@ -382,7 +382,7 @@ struct Arena u32int ctime; /* first time a block was written */ u32int wtime; /* last time a block was written */ u32int clumpmagic; - + ArenaCIG *cig; int ncig; }; @@ -465,7 +465,7 @@ struct Index Bloom *bloom; /* bloom filter */ /* - * fields stored in config file + * fields stored in config file */ u32int version; char name[ANameSize]; /* text label */ @@ -473,7 +473,7 @@ struct Index AMap *smap; /* mapping of buckets to index sections */ int narenas; AMap *amap; /* mapping from index addesses to arenas */ - + QLock writing; }; @@ -529,7 +529,7 @@ struct IEntry /* on disk data - 32 bytes*/ u8int score[VtScoreSize]; IAddr ia; - + IEntry *nexthash; IEntry *nextdirty; IEntry *next; @@ -657,7 +657,7 @@ enum StatSumRead, StatSumReadBytes, - + StatCigLoad, StatCigLoadTime, @@ -762,4 +762,3 @@ extern ulong stattime; #pragma varargck type "V" uchar* #define ODIRECT 0 #endif - diff --git a/src/cmd/venti/srv/dcache.c b/src/cmd/venti/srv/dcache.c index a50ef0c5..f4f00898 100644 --- a/src/cmd/venti/srv/dcache.c +++ b/src/cmd/venti/srv/dcache.c @@ -1,23 +1,23 @@ /* * Disk cache. - * + * * Caches raw disk blocks. Getdblock() gets a block, putdblock puts it back. * Getdblock has a mode parameter that determines i/o and access to a block: * if mode is OREAD or ORDWR, it is read from disk if not already in memory. * If mode is ORDWR or OWRITE, it is locked for exclusive use before being returned. * It is *not* marked dirty -- once changes have been made, they should be noted - * by using dirtydblock() before putdblock(). + * by using dirtydblock() before putdblock(). * - * There is a global cache lock as well as a lock on each block. + * There is a global cache lock as well as a lock on each block. * Within a thread, the cache lock can be acquired while holding a block lock, * but not vice versa; and a block cannot be locked if you already hold the lock * on another block. - * + * * The flush proc writes out dirty blocks in batches, one batch per dirty tag. * For example, the DirtyArena blocks are all written to disk before any of the * DirtyArenaCib blocks. * - * This code used to be in charge of flushing the dirty index blocks out to + * This code used to be in charge of flushing the dirty index blocks out to * disk, but updating the index turned out to benefit from extra care. * Now cached index blocks are never marked dirty. The index.c code takes * care of updating them behind our back, and uses _getdblock to update any @@ -134,7 +134,7 @@ DBlock* getdblock(Part *part, u64int addr, int mode) { DBlock *b; - + b = _getdblock(part, addr, mode, 1); if(mode == OREAD || mode == ORDWR) addstat(StatDcacheRead, 1); @@ -335,7 +335,7 @@ static void unchain(DBlock *b) { ulong h; - + /* * unchain the block */ @@ -395,7 +395,7 @@ void emptydcache(void) { DBlock *b; - + qlock(&dcache.lock); while(dcache.nheap > 0){ b = dcache.heap[0]; @@ -575,7 +575,7 @@ parallelwrites(DBlock **b, DBlock **eb, int dirty) assert(b<=p && pwritedonechan); } - + /* * Flush the partitions that have been written to. */ diff --git a/src/cmd/venti/srv/disksched.c b/src/cmd/venti/srv/disksched.c index d43b64c7..0315425c 100644 --- a/src/cmd/venti/srv/disksched.c +++ b/src/cmd/venti/srv/disksched.c @@ -15,7 +15,7 @@ disksched(void) ulong t; vlong cflush; Stats *prev; - + /* * no locks because all the data accesses are atomic. */ @@ -40,22 +40,22 @@ disksched(void) /* # entries written to index cache */ nwrite = stats.n[StatIcacheWrite] - prev->n[StatIcacheWrite]; - + /* # dirty entries in index cache */ ndirty = stats.n[StatIcacheDirty] - prev->n[StatIcacheDirty]; - + /* # entries flushed to disk */ nflush = nwrite - ndirty; - + /* want to stay around 70% dirty */ tdirty = (vlong)stats.n[StatIcacheSize]*700/1000; - + /* assume nflush*icachesleeptime is a constant */ cflush = (vlong)nflush*(icachesleeptime+1); - + /* computer number entries to write in next minute */ toflush = nwrite + (stats.n[StatIcacheDirty] - tdirty); - + /* schedule for that many */ if(toflush <= 0 || cflush/toflush > 100000) icachesleeptime = SleepForever; @@ -86,4 +86,3 @@ diskaccess(int level) } lasttime[level] = time(0); } - diff --git a/src/cmd/venti/srv/fixarenas.c b/src/cmd/venti/srv/fixarenas.c index d7ae41d3..8fc4f55d 100644 --- a/src/cmd/venti/srv/fixarenas.c +++ b/src/cmd/venti/srv/fixarenas.c @@ -6,7 +6,7 @@ * * The rule here (hopefully followed!) is that block corruption * only ever has a local effect -- there are no blocks that you - * can wipe out that will cause large portions of + * can wipe out that will cause large portions of * uncorrupted data blocks to be useless. */ @@ -26,7 +26,7 @@ enum K = 1024, M = 1024*1024, G = 1024*1024*1024, - + Block = 4096, }; @@ -64,7 +64,7 @@ static int zfmt(Fmt *fmt) { vlong x; - + x = va_arg(fmt->args, vlong); if(x == 0) return fmtstrcpy(fmt, "0"); @@ -85,7 +85,7 @@ tfmt(Fmt *fmt) { uint t; char buf[30]; - + t = va_arg(fmt->args, uint); strcpy(buf, ctime(t)); buf[28] = 0; @@ -133,7 +133,7 @@ readdisk(uchar *buf, vlong offset, int len) memset(buf, 0xFB, len); return buf; } - + if(offset+len > partend){ memset(buf, 0xFB, len); len = partend - offset; @@ -141,7 +141,7 @@ readdisk(uchar *buf, vlong offset, int len) if(readpart(part, offset, buf, len) >= 0) return buf; - + /* * The read failed. Clear the buffer to nonsense, and * then try reading in smaller pieces. If that fails, @@ -191,7 +191,7 @@ void sbdebug(Shabuf *sb, char *file) { int fd; - + if(sb->fd > 0){ close(sb->fd); sb->fd = 0; @@ -234,7 +234,7 @@ sbupdate(Shabuf *sb, uchar *p, vlong offset, int len) len -= x; } assert(sb->offset == offset); - + if(sb->fd > 0) pwrite(sb->fd, p, len, offset - sb->r0); @@ -243,7 +243,7 @@ sbupdate(Shabuf *sb, uchar *p, vlong offset, int len) sb->offset += len; return; } - + /* save state every 4M so we can roll back quickly */ o = offset - sb->r0; while(len > 0){ @@ -265,7 +265,7 @@ sbupdate(Shabuf *sb, uchar *p, vlong offset, int len) } sb->hist[x] = sb->state; } - } + } } void @@ -273,7 +273,7 @@ sbdiskhash(Shabuf *sb, vlong eoffset) { static uchar dbuf[4*M]; int n; - + while(sb->offset < eoffset){ n = sizeof dbuf; if(sb->offset+n > eoffset) @@ -289,7 +289,7 @@ sbrollback(Shabuf *sb, vlong offset) int x; vlong o; Dir d; - + if(!sb->rollback || !sb->r0){ print("cannot rollback sha\n"); return; @@ -305,7 +305,7 @@ sbrollback(Shabuf *sb, vlong offset) sb->state = sb->hist[x]; sb->offset = sb->r0 + x*4*M; assert(sb->offset <= offset); - + if(sb->fd > 0){ nulldir(&d); d.length = sb->offset - sb->r0; @@ -325,7 +325,7 @@ sbscore(Shabuf *sb, uchar *score) /* * If we're fixing arenas, then editing this memory edits the disk! - * It will be written back out as new data is paged in. + * It will be written back out as new data is paged in. */ uchar buf[4*M]; uchar sbuf[4*M]; @@ -341,7 +341,7 @@ pagein(vlong offset, int len) memset(buf, 0xFB, sizeof buf); return buf; } - + if(offset+len > partend){ memset(buf, 0xFB, sizeof buf); len = partend - offset; @@ -373,16 +373,16 @@ zerorange(vlong offset, int len) vlong ooff; int olen; enum { MinBlock = 4*K, MaxBlock = 8*K }; - + if(0) if(bufoffset <= offset && offset+len <= bufoffset+buflen){ memset(buf+(offset-bufoffset), 0, len); return; } - + ooff = bufoffset; olen = buflen; - + i = offset%MinBlock; if(i+len < MaxBlock){ pagein(offset-i, (len+MinBlock-1)&~(MinBlock-1)); @@ -455,7 +455,7 @@ static int vlongcmp(const void *va, const void *vb) { vlong a, b; - + a = *(vlong*)va; b = *(vlong*)vb; if(a < b) @@ -524,7 +524,7 @@ Info tailinfo4[] = { 1, "sealed", 0 }; - + Info tailinfo4a[] = { /* tailinfo 4 */ 4, "magic", @@ -547,7 +547,7 @@ Info tailinfo4a[] = { 1, "mem.sealed", 0 }; - + Info tailinfo5[] = { 4, "magic", D|4, "version", @@ -586,12 +586,12 @@ Info tailinfo5a[] = { 1, "mem.sealed", 0 }; - + void showdiffs(uchar *want, uchar *have, int len, Info *info) { int n; - + while(len > 0 && (n=info->len&N) > 0){ if(memcmp(have, want, n) != 0){ switch(info->len){ @@ -625,7 +625,7 @@ showdiffs(uchar *want, uchar *have, int len, Info *info) break; case S|ANameSize: print("\t%s: correct=%s disk=%.*s\n", - info->name, (char*)want, + info->name, (char*)want, utfnlen((char*)have, ANameSize-1), (char*)have); break; @@ -672,7 +672,7 @@ guessgeometry(void) uchar *p, *ep, *sp; u64int diff[100], head[20], tail[20]; u64int offset, bestdiff; - + ap.version = ArenaPartVersion; if(arenasize == 0 || ap.blocksize == 0){ @@ -705,8 +705,8 @@ guessgeometry(void) } if(nhead < 3 && ntail < 3) sysfatal("too few intact arenas: %d heads, %d tails", nhead, ntail); - - /* + + /* * Arena size is likely the most common * inter-head or inter-tail spacing. */ @@ -816,7 +816,7 @@ guessgeometry(void) } } p = pagein(ap.arenabase, Block); - print("arena base likely %z%s\n", (vlong)ap.arenabase, + print("arena base likely %z%s\n", (vlong)ap.arenabase, u32(p)!=ArenaHeadMagic ? " (but no arena head there)" : ""); ap.tabsize = ap.arenabase - ap.tabbase; @@ -893,7 +893,7 @@ isclump(uchar *p, Clump *cl, u32int *pmagic) uchar score[VtScoreSize], *bp; Unwhack uw; uchar ubuf[70*1024]; - + bp = p; magic = u32(p); if(magic == 0) @@ -942,7 +942,7 @@ isclump(uchar *p, Clump *cl, u32int *pmagic) return 0; } p += cl->info.size; - + /* it all worked out in the end */ *pmagic = magic; return p - bp; @@ -975,7 +975,7 @@ int* ltreewalk(int *p, uchar *score) { int i; - + for(;;){ if(*p == -1) return p; @@ -993,7 +993,7 @@ void addcibuf(ClumpInfo *ci, vlong corrupt) { Cit *cit; - + if(ncibuf == mcibuf){ mcibuf += 131072; cibuf = vtrealloc(cibuf, mcibuf*sizeof cibuf[0]); @@ -1012,7 +1012,7 @@ void addcicorrupt(vlong len) { static ClumpInfo zci; - + addcibuf(&zci, len); } @@ -1021,7 +1021,7 @@ haveclump(uchar *score) { int i; int p; - + p = ciroot; for(;;){ if(p == -1) @@ -1054,7 +1054,7 @@ int sealedarena(uchar *p, int blocksize) { int v, n; - + v = u32(p+4); switch(v){ default: @@ -1085,13 +1085,13 @@ int okayname(char *name, int n) { char buf[20]; - + if(nameok(name) < 0) return 0; sprint(buf, "%d", n); if(n == 0) buf[0] = 0; - if(strlen(name) < strlen(buf) + if(strlen(name) < strlen(buf) || strcmp(name+strlen(name)-strlen(buf), buf) != 0) return 0; return 1; @@ -1115,7 +1115,7 @@ loadci(vlong offset, Arena *arena, int nci) int i, j, per; uchar *p, *sp; ClumpInfo *bci, *ci; - + per = arena->blocksize/ClumpInfoSize; bci = vtmalloc(nci*sizeof bci[0]); ci = bci; @@ -1139,7 +1139,7 @@ writeci(vlong offset, Arena *arena, ClumpInfo *ci, int nci) { int i, j, per; uchar *p, *sp; - + per = arena->blocksize/ClumpInfoSize; offset += arena->size - arena->blocksize; p = sp = nil; @@ -1177,11 +1177,11 @@ loadarenabasics(vlong offset0, int anum, ArenaHead *head, Arena *arena) if(offset0+arena->size > partend) arena->size = partend - offset0; head->size = arena->size; - + arena->blocksize = ap.blocksize; head->blocksize = arena->blocksize; - - /* + + /* * Look for clump magic and name in head/tail blocks. * All the other info we will reconstruct just in case. */ @@ -1194,7 +1194,7 @@ loadarenabasics(vlong offset0, int anum, ArenaHead *head, Arena *arena) strcpy(head->name, ohead.name); } - p = pagein(offset0+arena->size-arena->blocksize, + p = pagein(offset0+arena->size-arena->blocksize, arena->blocksize); memset(&oarena, 0, sizeof oarena); if(unpackarena(&oarena, p) >= 0){ @@ -1228,7 +1228,7 @@ print("old arena: sealed=%d\n", oarena.diskstats.sealed); strcpy(lastbase, arena->name); sprint(dname, "%d", anum); lastbase[strlen(lastbase)-strlen(dname)] = 0; - + /* Was working in arena, now copy to head. */ head->version = arena->version; memmove(head->name, arena->name, sizeof head->name); @@ -1240,7 +1240,7 @@ void shahead(Shabuf *sb, vlong offset0, ArenaHead *head) { uchar headbuf[MaxDiskBlock]; - + sb->offset = offset0; memset(headbuf, 0, sizeof headbuf); packarenahead(head, headbuf); @@ -1251,7 +1251,7 @@ u32int newclumpmagic(int version) { u32int m; - + if(version == ArenaVersion4) return _ClumpMagic; do{ @@ -1279,7 +1279,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, ClumpInfo *bci, *ci, *eci, *xci; Cit *bcit, *cit, *ecit; Shabuf oldsha, newsha; - + /* * We expect to find an arena, with data, between offset * and offset+arenasize. With any luck, the data starts at @@ -1314,7 +1314,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, loadarenabasics(offset0, anum, head, arena); /* start the clump hunt */ - + clumps = 0; totalcorrupt = 0; sealing = 1; @@ -1424,7 +1424,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, * grow clump info blocks if needed. */ if(verbose > 1) - print("\tclump %d: %d %V at %#llux+%#ux (%d)\n", + print("\tclump %d: %d %V at %#llux+%#ux (%d)\n", clumps, cl.info.type, cl.info.score, offset, n, n); addcibuf(&cl.info, 0); if(minclumps%ncib == 0) @@ -1435,7 +1435,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, arena->diskstats.cclumps++; arena->diskstats.uncsize += cl.info.uncsize; arena->wtime = cl.time; - + /* * Move to next clump. */ @@ -1470,7 +1470,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, pageout(); if(verbose) - print("readable clumps: %d; min. directory entries: %d\n", + print("readable clumps: %d; min. directory entries: %d\n", clumps, minclumps); arena->diskstats.used = lastclumpend - boffset; leaked = eoffset - lastclumpend; @@ -1488,10 +1488,10 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, sbupdate(&oldsha, dbuf, toffset, arena->blocksize); sbscore(&oldsha, oldscore); } - + /* * If we still don't know the clump magic, the arena - * must be empty. It still needs a value, so make + * must be empty. It still needs a value, so make * something up. */ if(arena->version == 0) @@ -1537,7 +1537,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, v = offset0 + arena->size - arena->blocksize; clumps = (v-lastclumpend)/arena->blocksize * ncib; } - + if(clumps < minclumps) print("cannot happen?\n"); @@ -1546,7 +1546,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, * The tricky part is handling the corrupt sections of arena. * If possible, we remark just the affected directory entries * rather than slide everything down. - * + * * Allocate clumps+1 blocks and check that we don't need * the last one at the end. */ @@ -1554,7 +1554,7 @@ guessarena(vlong offset0, int anum, ArenaHead *head, Arena *arena, eci = bci+clumps+1; bcit = cibuf; ecit = cibuf+ncibuf; - + smart = 0; /* Somehow the smart code doesn't do corrupt clumps right. */ Again: nbad = 0; @@ -1614,11 +1614,11 @@ Again: if(clumpinfocmp(&cit->ci, ci) != 0){ if(verbose && (smart || verbose>1)){ print("clumpinfo %d\n", (int)(ci-bci)); - print("\twant: %d %d %d %V\n", + print("\twant: %d %d %d %V\n", cit->ci.type, cit->ci.size, cit->ci.uncsize, cit->ci.score); - print("\thave: %d %d %d %V\n", - ci->type, ci->size, + print("\thave: %d %d %d %V\n", + ci->type, ci->size, ci->uncsize, ci->score); } *ci = cit->ci; @@ -1633,7 +1633,7 @@ Again: smart = 0; goto Again; } - + assert(ci <= eci); arena->diskstats.clumps = ci-bci; eoffset = writeci(offset0, arena, bci, ci-bci); @@ -1661,7 +1661,7 @@ Nocib: arena->memstats = arena->diskstats; if(sealing && fix){ uchar tbuf[MaxDiskBlock]; - + sbdiskhash(&newsha, toffset); memset(tbuf, 0, sizeof tbuf); packarena(arena, tbuf); @@ -1676,7 +1676,7 @@ dumparena(vlong offset, int anum, Arena *arena) char buf[1000]; vlong o, e; int fd, n; - + snprint(buf, sizeof buf, "%s.%d", dumpbase, anum); if((fd = create(buf, OWRITE, 0666)) < 0){ fprint(2, "create %s: %r\n", buf); @@ -1703,7 +1703,7 @@ checkarena(vlong offset, int anum) ArenaHead head; Info *fmt, *fmta; int sz; - + print("# arena %d: offset %#llux\n", anum, offset); if(offset >= partend){ @@ -1737,11 +1737,11 @@ checkarena(vlong offset, int anum) p = pagein(offset, arena.blocksize); if(memcmp(dbuf, p, arena.blocksize) != 0){ print("on-disk arena header incorrect\n"); - showdiffs(dbuf, p, arena.blocksize, + showdiffs(dbuf, p, arena.blocksize, arena.version==ArenaVersion4 ? headinfo4 : headinfo5); } memmove(p, dbuf, arena.blocksize); - + memset(dbuf, 0, sizeof dbuf); packarena(&arena, dbuf); if(arena.diskstats.sealed) @@ -1781,14 +1781,14 @@ checkarena(vlong offset, int anum) print("\t disk=%V\n", p+arena.blocksize-VtScoreSize); } if(fix && scorecmp(p+arena.blocksize-VtScoreSize, score) != 0){ - print("%ssealing arena%s: %V\n", + print("%ssealing arena%s: %V\n", oarena.diskstats.sealed ? "re" : "", - scorecmp(oldscore, score) == 0 ? + scorecmp(oldscore, score) == 0 ? "" : " after changes", score); } } memmove(p, dbuf, arena.blocksize); - + pageout(); } @@ -1800,7 +1800,7 @@ buildamap(void) ArenaHead h; AMapN *an; AMap *m; - + an = vtmallocz(sizeof *an); for(o=ap.arenabase; oname, h.name); } } - return an; + return an; } void @@ -1823,7 +1823,7 @@ checkmap(void) int i, len; AMapN *an; Fmt fmt; - + an = buildamap(); fmtstrinit(&fmt); fmtprint(&fmt, "%ud\n", an->n); @@ -1837,7 +1837,7 @@ checkmap(void) (vlong)len, (vlong)ap.tabsize); len = ap.tabsize; } - + if(ap.tabsize >= 4*M){ /* can't happen - max arenas is 2000 */ print("arena partition map *way* too long\n"); return; @@ -1857,9 +1857,9 @@ void threadmain(int argc, char **argv) { int mode; - + mode = OREAD; - readonly = 1; + readonly = 1; ARGBEGIN{ case 'U': unseal = 1; @@ -1887,22 +1887,22 @@ threadmain(int argc, char **argv) default: usage(); }ARGEND - + if(argc != 1 && argc != 2) usage(); file = argv[0]; - + ventifmtinstall(); fmtinstall('z', zfmt); fmtinstall('t', tfmt); quotefmtinstall(); - + part = initpart(file, mode|ODIRECT); if(part == nil) sysfatal("can't open %s: %r", file); partend = part->size; - + if(isonearena()){ checkarena(0, -1); threadexitsall(nil); @@ -1911,4 +1911,3 @@ threadmain(int argc, char **argv) checkmap(); threadexitsall(nil); } - diff --git a/src/cmd/venti/srv/fmtbloom.c b/src/cmd/venti/srv/fmtbloom.c index 76677871..db08b91a 100644 --- a/src/cmd/venti/srv/fmtbloom.c +++ b/src/cmd/venti/srv/fmtbloom.c @@ -19,7 +19,7 @@ threadmain(int argc, char *argv[]) vlong bits, size, size2; int nhash; vlong nblocks; - + ventifmtinstall(); statsinit(); @@ -62,7 +62,7 @@ threadmain(int argc, char *argv[]) if(size == 0) size = part->size; - + if(size < 1024*1024) sysfatal("bloom filter too small"); @@ -93,7 +93,7 @@ threadmain(int argc, char *argv[]) } /* - * optimal is to use ln 2 times as many hash functions as we have bits per blocks. + * optimal is to use ln 2 times as many hash functions as we have bits per blocks. */ bits = (8*size)/nblocks; nhash = bits*7/10; diff --git a/src/cmd/venti/srv/graph.c b/src/cmd/venti/srv/graph.c index db12c3d9..f4336369 100644 --- a/src/cmd/venti/srv/graph.c +++ b/src/cmd/venti/srv/graph.c @@ -36,7 +36,7 @@ Memimage* allocrepl(ulong color) { Memimage *m; - + m = allocmemimage(Rect(0,0,1,1), RGB24); memfillcolor(m, color); m->flags |= Frepl; @@ -49,10 +49,10 @@ ginit(void) { static int first = 1; int i; - + if(!first) return; - + first = 0; memimageinit(); #ifdef PLAN9PORT @@ -90,7 +90,7 @@ drawlabel(Memimage *m, Point p, int n) { char buf[30]; Point w; - + mklabel(buf, n); w = memsubfontwidth(smallfont, buf); memimagestring(m, Pt(p.x-5-w.x, p.y), memblack, ZP, smallfont, buf); @@ -117,7 +117,7 @@ statgraph(Graph *g) Statbin *b, bin[2000]; /* 32 kB, but whack is worse */ needstack(8192); /* double check that bin didn't kill us */ - + if(g->wid <= MinWidth) g->wid = DefaultWidth; if(g->ht <= MinHeight) @@ -128,7 +128,7 @@ statgraph(Graph *g) g->fill = ((uint)(uintptr)g->arg>>8)%nelem(lofill); if(g->fill > nelem(lofill)) g->fill %= nelem(lofill); - + nbin = g->wid - (Left+Right); binstats(g->fn, g->arg, g->t0, g->t1, bin, nbin); @@ -168,7 +168,7 @@ statgraph(Graph *g) } r = Rect(Left, Top, g->wid-Right, g->ht-Bottom); memfillcolor(m, DTransparent); - + /* x axis */ memimagedraw(m, Rect(r.min.x, r.max.y, r.max.x, r.max.y+1), black, ZP, memopaque, ZP, S); @@ -176,7 +176,7 @@ statgraph(Graph *g) drawlabel(m, r.min, max); if(min != 0) drawlabel(m, Pt(r.min.x, r.max.y-smallfont->height), min); - + /* actual data */ for(i=0; ihout, "

venti disks

\n"); hprint(&c->hout, "
\n");
 	ix = mainindex;
@@ -83,7 +83,7 @@ readap(Part *p, ArenaPart *ap)
 {
 	uchar *blk;
 	char *table;
-	
+
 	blk = vtmalloc(8192);
 	if(readpart(p, PartBlank, blk, 8192) != 8192)
 		return nil;
@@ -108,7 +108,7 @@ xfindarena(char *table, char *name, vlong *start, vlong *end)
 {
 	int i, nline;
 	char *p, *q, *f[4], line[256];
-	
+
 	nline = atoi(table);
 	p = strchr(table, '\n');
 	if(p)
@@ -212,7 +212,7 @@ diskarenapart(HConnect *c, char *disk, Part *p)
 		hprint(&c->hout, "%r\n");
 		goto out;
 	}
-	
+
 	hprint(&c->hout, "
\n");
 	hprint(&c->hout, "version=%d blocksize=%d base=%d\n",
 		ap.version, ap.blocksize, ap.arenabase);
@@ -223,12 +223,12 @@ diskarenapart(HConnect *c, char *disk, Part *p)
 		diskarenatable(c, disk, table);
 		goto out;
 	}
-	
+
 	if(xfindarena(table, arenaname, &start, &end) < 0){
 		hprint(&c->hout, "no such arena %s\n", arenaname);
 		goto out;
 	}
-	
+
 	hprint(&c->hout, "

arena %s

\n", arenaname); hprint(&c->hout, "
start=%#llx end=%#llx
\n", start, end);
 	if(end < start || end - start < HeadSize){
@@ -253,7 +253,7 @@ diskarenapart(HConnect *c, char *disk, Part *p)
 
 	hprint(&c->hout, "head:\n
\n");
 	hprint(&c->hout, "version=%d name=%s blocksize=%d size=%#llx clumpmagic=%#ux\n",
-		head.version, head.name, head.blocksize, head.size, 
+		head.version, head.name, head.blocksize, head.size,
 		head.clumpmagic);
 	hprint(&c->hout, "


\n"); @@ -281,7 +281,7 @@ diskarenapart(HConnect *c, char *disk, Part *p) scorecp(arena.score, blk+head.blocksize - VtScoreSize); vtfree(blk); - + hprint(&c->hout, "tail:\n
\n");
 	hprint(&c->hout, "version=%d name=%s\n", arena.version, arena.name);
 	hprint(&c->hout, "ctime=%d %s\n", arena.ctime, fmttime(tbuf, arena.ctime));
@@ -389,10 +389,10 @@ diskarenatoc(HConnect *c, Arena *arena)
 		}
 		unpackclumpinfo(&ci, blk+(i%arena->clumpmax)*ClumpInfoSize);
 		if(i/arena->clumpmax == cib || i%arena->clumpmax == 0){
-			hprint(&c->hout, "%5d %6d %7d %V", 
+			hprint(&c->hout, "%5d %6d %7d %V",
 				ci.type, ci.size, ci.uncsize, ci.score);
 			if(coff >= 0)
-				hprint(&c->hout, " at %#llx", 
+				hprint(&c->hout, " at %#llx",
 					base, coff, ci.score, coff);
 			if(i/arena->clumpmax != cib)
 				hprint(&c->hout, "  more", base, i/arena->clumpmax);
@@ -415,7 +415,7 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr)
 	uchar xscore[VtScoreSize], score[VtScoreSize];
 	Unwhack uw;
 	int n;
-	
+
 	if(scorestr){
 		if(vtparsescore(scorestr, nil, score) < 0){
 			hprint(&c->hout, "bad score %s: %r\n", scorestr);
@@ -436,7 +436,7 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr)
 		hprint(&c->hout, "bad offset %#llx\n", off);
 		return -1;
 	}
-	
+
 	off += arena->base;
 
 	blk = vtmalloc(ClumpSize + VtMaxLumpSize);
@@ -461,15 +461,15 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr)
 
 	hprint(&c->hout, "
type=%d size=%d uncsize=%d score=%V\n", cl.info.type, cl.info.size, cl.info.uncsize, cl.info.score);
 	hprint(&c->hout, "encoding=%d creator=%d time=%d %s
\n", cl.encoding, cl.creator, cl.time, fmttime(err, cl.time)); - + if(cl.info.type == VtCorruptType) hprint(&c->hout, "clump is marked corrupt
\n"); - + if(cl.info.size >= VtMaxLumpSize){ hprint(&c->hout, "clump too big\n"); goto error; } - + switch(cl.encoding){ case ClumpECompress: blk2 = vtmalloc(VtMaxLumpSize); @@ -493,7 +493,7 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr) scoremem(xscore, blk+ClumpSize, cl.info.size); break; } - + hprint(&c->hout, "score=%V
\n", xscore); if(scorestr && scorecmp(score, xscore) != 0) hprint(&c->hout, "score does NOT match expected %V\n", score); @@ -536,7 +536,7 @@ debugamap(HConnect *c) amap = mainindex->amap; for(i=0; inarenas; i++) - hprint(&c->hout, "%s %#llx %#llx\n", + hprint(&c->hout, "%s %#llx %#llx\n", amap[i].name, amap[i].start, amap[i].stop); } @@ -559,23 +559,23 @@ debugread(HConnect *c, u8int *score) hprint(&c->hout, "zero score\n"); return; } - + hprint(&c->hout, "

index search %V

\n", score);
 	if(icachelookup(score, -1, &ia) < 0)
 		hprint(&c->hout, "  icache: not found\n");
 	else
 		hprint(&c->hout, "  icache: addr=%#llx size=%d type=%d blocks=%d\n",
 			ia.addr, ia.size, ia.type, ia.blocks);
-	
+
 	if(loadientry(mainindex, score, -1, &ie) < 0)
 		hprint(&c->hout, "  idisk: not found\n");
 	else
 		hprint(&c->hout, "  idisk: addr=%#llx size=%d type=%d blocks=%d\n",
 			ie.ia.addr, ie.ia.size, ie.ia.type, ie.ia.blocks);
-	
+
 	hprint(&c->hout, "

lookup %V

\n", score); hprint(&c->hout, "
\n");
-	
+
 	for(type=0; type < VtMaxType; type++){
 		hprint(&c->hout, "%V type %d:", score, type);
 		u = lookuplump(score, type);
@@ -584,14 +584,14 @@ debugread(HConnect *c, u8int *score)
 		else
 			hprint(&c->hout, " -cache");
 		putlump(u);
-		
+
 		if(lookupscore(score, type, &ia) < 0){
 			hprint(&c->hout, " -lookup\n");
 			continue;
 		}
 		hprint(&c->hout, "\n  lookupscore: addr=%#llx size=%d blocks=%d\n",
 			ia.addr, ia.size, ia.blocks);
-		
+
 		arena = amapitoa(mainindex, ia.addr, &aa);
 		if(arena == nil){
 			hprint(&c->hout, "  amapitoa failed: %r\n");
@@ -606,7 +606,7 @@ debugread(HConnect *c, u8int *score)
 			hprint(&c->hout, "  loadclump failed: %r\n");
 			continue;
 		}
-		
+
 		hprint(&c->hout, "  loadclump: uncsize=%d type=%d score=%V\n",
 			cl.info.uncsize, cl.info.type, sc);
 		if(ia.size != cl.info.uncsize || ia.type != cl.info.type || scorecmp(score, sc) != 0){
@@ -614,12 +614,12 @@ debugread(HConnect *c, u8int *score)
 			continue;
 		}
 	}
-	
+
 	if(hargstr(c, "brute", "")[0] == 'y'){
 		hprint(&c->hout, "
\n"); hprint(&c->hout, "

brute force arena search %V

\n", score); hprint(&c->hout, "
\n");
-		
+
 		for(i=0; inarenas; i++){
 			arena = mainindex->arenas[i];
 			hprint(&c->hout, "%s...\n", arena->name);
@@ -637,10 +637,10 @@ static void
 debugmem(HConnect *c)
 {
 	Index *ix;
-	
+
 	ix = mainindex;
 	hprint(&c->hout, "

memory

\n"); - + hprint(&c->hout, "
\n");
 	hprint(&c->hout, "ix=%p\n", ix);
 	hprint(&c->hout, "\tarenas=%p\n", ix->arenas);
@@ -660,7 +660,7 @@ hdebug(HConnect *c)
 {
 	char *scorestr, *op;
 	u8int score[VtScoreSize];
-	
+
 	if(hsethtml(c) < 0)
 		return -1;
 	hprint(&c->hout, "

venti debug

\n"); @@ -670,7 +670,7 @@ hdebug(HConnect *c) hprint(&c->hout, "no op\n"); return 0; } - + if(strcmp(op, "amap") == 0){ debugamap(c); return 0; @@ -690,7 +690,7 @@ hdebug(HConnect *c) debugread(c, score); return 0; } - + hprint(&c->hout, "unknown op %s", op); return 0; } diff --git a/src/cmd/venti/srv/hproc.c b/src/cmd/venti/srv/hproc.c index 42933920..3da217ce 100644 --- a/src/cmd/venti/srv/hproc.c +++ b/src/cmd/venti/srv/hproc.c @@ -7,11 +7,10 @@ int hproc(HConnect *c) { int r; - + if((r = hsettext(c)) < 0) return r; hprint(&c->hout, "/proc only implemented on Plan 9\n"); hflush(&c->hout); return 0; } - diff --git a/src/cmd/venti/srv/httpd.c b/src/cmd/venti/srv/httpd.c index 83d80ca7..05896ff4 100644 --- a/src/cmd/venti/srv/httpd.c +++ b/src/cmd/venti/srv/httpd.c @@ -51,7 +51,7 @@ httpdinit(char *address, char *dir) if(address == nil) address = "tcp!*!http"; webroot = dir; - + httpdobj("/stats", estats); httpdobj("/index", dindex); httpdobj("/storage", sindex); @@ -168,7 +168,7 @@ httpproc(void *v) */ if(hparsereq(c, 0) < 0) break; - + for(i = 0; i < MaxObjs && objs[i].name[0]; i++){ n = strlen(objs[i].name); if((objs[i].name[n-1] == '/' && strncmp(c->req.uri, objs[i].name, n) == 0) @@ -196,7 +196,7 @@ char* hargstr(HConnect *c, char *name, char *def) { HSPairs *p; - + for(p=c->req.searchpairs; p; p=p->next) if(strcmp(p->s, name) == 0) return p->t; @@ -207,7 +207,7 @@ vlong hargint(HConnect *c, char *name, vlong def) { char *a; - + if((a = hargstr(c, name, nil)) == nil) return def; return atoll(a); @@ -282,7 +282,7 @@ herror(HConnect *c) { int n; Hio *hout; - + hout = &c->hout; n = snprint(c->xferbuf, HBufSize, "Error\n

Error

\n
%r
\n"); hprint(hout, "%s %s\r\n", hversion, "400 Bad Request"); @@ -301,7 +301,7 @@ herror(HConnect *c) return hflush(hout); } - + int hnotfound(HConnect *c) { @@ -331,7 +331,7 @@ fromwebdir(HConnect *c) char buf[4096], *p, *ext, *type; int i, fd, n, defaulted; Dir *d; - + if(webroot == nil || strstr(c->req.uri, "..")) return hnotfound(c); snprint(buf, sizeof buf-20, "%s/%s", webroot, c->req.uri+1); @@ -430,7 +430,7 @@ xset(HConnect *c) hflush(&c->hout); return 0; } - + old = *namedints[i].p; *namedints[i].p = atoll(value); hprint(&c->hout, "%s = %d (was %d)\n", name, *namedints[i].p, old); @@ -496,7 +496,7 @@ estats(HConnect *c) percent(stats.absorbedwrites, stats.dirtydblocks)); hprint(hout, "disk cache flushes=%,ld\n", stats.dcacheflushes); - hprint(hout, "disk cache flush writes=%,ld (%,ld per flush)\n", + hprint(hout, "disk cache flush writes=%,ld (%,ld per flush)\n", stats.dcacheflushwrites, stats.dcacheflushwrites/(stats.dcacheflushes ? stats.dcacheflushes : 1)); @@ -821,7 +821,7 @@ diskbw(Stats *s) ulong *n; n = s->n; - return n[StatApartReadBytes]+n[StatApartWriteBytes] + return n[StatApartReadBytes]+n[StatApartWriteBytes] + n[StatIsectReadBytes]+n[StatIsectWriteBytes] + n[StatSumReadBytes]; } @@ -882,7 +882,7 @@ static char* graphname[] = "lcachesize", "lcachestall", "lcachelookuptime", - + "dcachehit", "dcachemiss", "dcachelookup", @@ -931,7 +931,7 @@ static char* graphname[] = "sumread", "sumreadbyte", - + "cigload", "cigloadtime", }; @@ -996,7 +996,7 @@ xgraph(HConnect *c) g.ht = hargint(c, "ht", -1); dotext = hargstr(c, "text", "")[0] != 0; g.fill = hargint(c, "fill", -1); - + graph = hargstr(c, "graph", "raw"); if(strcmp(graph, "raw") == 0) g.fn = rawgraph; @@ -1135,14 +1135,14 @@ vtloghdump(Hio *h, VtLog *l) int i; VtLogChunk *c; char *name; - + name = l ? l->name : "<nil>"; hprint(h, "\n"); hprint(h, "Venti Server Log: %s\n", name); hprint(h, "\n"); hprint(h, "Venti Server Log: %s\n

\n", name); - + if(l){ c = l->w; for(i=0; inchunk; i++){ @@ -1165,12 +1165,12 @@ vtloghlist(Hio *h) { char **p; int i, n; - + hprint(h, "\n"); hprint(h, "Venti Server Logs\n"); hprint(h, "\n"); hprint(h, "Venti Server Logs\n

\n"); - + p = vtlognames(&n); qsort(p, n, sizeof(p[0]), strpcmp); for(i=0; itable[0])); ih->table = (IEntry**)(ih+1); ih->bits = bits; @@ -80,7 +80,7 @@ ihashlookup(IHash *ih, u8int score[VtScoreSize], int type) { u32int h; IEntry *ie; - + h = hashbits(score, ih->bits); for(ie=ih->table[h]; ie; ie=ie->nexthash) if((type == -1 || type == ie->ia.type) && scorecmp(score, ie->score) == 0) @@ -93,7 +93,7 @@ ihashdelete(IHash *ih, IEntry *ie, char *what) { u32int h; IEntry **l; - + h = hashbits(ie->score, ih->bits); for(l=&ih->table[h]; *l; l=&(*l)->nexthash) if(*l == ie){ @@ -107,7 +107,7 @@ static void ihashinsert(IHash *ih, IEntry *ie) { u32int h; - + h = hashbits(ie->score, ih->bits); ie->nexthash = ih->table[h]; ih->table[h] = ie; @@ -203,7 +203,7 @@ scacheevict(void) { ISum *s; int i; - + for(i=icache.nsum-1; i>=0; i--){ s = icache.sum[i]; if(canqlock(&s->lock)){ @@ -281,7 +281,7 @@ scachemiss(u64int addr) qunlock(&s->lock); return nil; } - + return s; /* locked */ } @@ -294,7 +294,7 @@ initicache(u32int mem0) { u32int mem; int i, entries, scache; - + icache.full.l = &icache.lock; mem = mem0; @@ -312,7 +312,7 @@ fprint(2, "icache %,d bytes = %,d entries; %d scache\n", mem0, entries, scache); icache.clean.prev = icache.clean.next = &icache.clean; icache.dirty.prev = icache.dirty.next = &icache.dirty; icache.free.prev = icache.free.next = (IEntry*)&icache.free; - + icache.hash = mkihash(entries); icache.nentries = entries; setstat(StatIcacheSize, entries); @@ -338,7 +338,7 @@ static IEntry* evictlru(void) { IEntry *ie; - + ie = poplast(&icache.clean); if(ie == nil) return nil; @@ -356,7 +356,7 @@ icacheinsert(u8int score[VtScoreSize], IAddr *ia, int state) while((ie = poplast(&icache.free)) == nil && (ie = evictlru()) == nil){ // Could safely return here if state == IEClean. // But if state == IEDirty, have to wait to make - // sure we don't lose an index write. + // sure we don't lose an index write. // Let's wait all the time. flushdcache(); kickicache(); @@ -444,7 +444,7 @@ insertscore(u8int score[VtScoreSize], IAddr *ia, int state, AState *as) scacheload(toload); qunlock(&toload->lock); } - + if(icache.ndirty >= icache.maxdirty) kickicache(); @@ -483,7 +483,7 @@ lookupscore(u8int score[VtScoreSize], int type, IAddr *ia) addstat2(StatIcacheRead, 1, StatIcacheReadTime, msec() - ms); return ret; } - + u32int hashbits(u8int *sc, int bits) { @@ -550,7 +550,7 @@ void icacheclean(IEntry *ie) { IEntry *next; - + trace(TraceProc, "icacheclean enter"); qlock(&icache.lock); for(; ie; ie=next){ @@ -574,7 +574,7 @@ emptyicache(void) int i; IEntry *ie; ISum *s; - + qlock(&icache.lock); while((ie = evictlru()) != nil) pushfirst(&icache.free, ie); @@ -586,4 +586,3 @@ emptyicache(void) } qunlock(&icache.lock); } - diff --git a/src/cmd/venti/srv/icachewrite.c b/src/cmd/venti/srv/icachewrite.c index e1406ef1..d2e5a815 100644 --- a/src/cmd/venti/srv/icachewrite.c +++ b/src/cmd/venti/srv/icachewrite.c @@ -81,7 +81,7 @@ nextchunk(Index *ix, ISect *is, IEntry **pie, u64int *paddr, uint *pnbuf) *pnbuf = nbuf; return iefirst; } - + static int icachewritesect(Index *ix, ISect *is, u8int *buf) { @@ -192,7 +192,7 @@ skipit: err = -1; continue; } - + addstat(StatIsectWriteBytes, nbuf); addstat(StatIsectWrite, 1); icacheclean(chunk); @@ -264,7 +264,7 @@ icachewritecoord(void *v) send(ix->sects[i]->writechan, 0); if(ix->bloom) send(ix->bloom->writechan, 0); - + err = 0; for(i=0; insects; i++) err |= recvul(ix->sects[i]->writedonechan); @@ -355,4 +355,3 @@ iesort(IEntry *ie) *l = nil; return sorted; } - diff --git a/src/cmd/venti/srv/index.c b/src/cmd/venti/srv/index.c index 07bf81c8..c3baa905 100644 --- a/src/cmd/venti/srv/index.c +++ b/src/cmd/venti/srv/index.c @@ -1,21 +1,21 @@ /* - * Index, mapping scores to log positions. + * Index, mapping scores to log positions. * * The index is made up of some number of index sections, each of - * which is typically stored on a different disk. The blocks in all the - * index sections are logically numbered, with each index section + * which is typically stored on a different disk. The blocks in all the + * index sections are logically numbered, with each index section * responsible for a range of blocks. Blocks are typically 8kB. * * The N index blocks are treated as a giant hash table. The top 32 bits * of score are used as the key for a lookup. Each index block holds * one hash bucket, which is responsible for ceil(2^32 / N) of the key space. - * - * The index is sized so that a particular bucket is extraordinarily - * unlikely to overflow: assuming compressed data blocks are 4kB + * + * The index is sized so that a particular bucket is extraordinarily + * unlikely to overflow: assuming compressed data blocks are 4kB * on disk, and assuming each block has a 40 byte index entry, * the index data will be 1% of the total data. Since scores are essentially * random, all buckets should be about the same fullness. - * A factor of 5 gives us a wide comfort boundary to account for + * A factor of 5 gives us a wide comfort boundary to account for * random variation. So the index disk space should be 5% of the arena disk space. */ @@ -500,7 +500,7 @@ initisect1(ISect *is) v = is->part->size & ~(u64int)(is->blocksize - 1); if(is->blockbase + (u64int)is->blocks * is->blocksize != v){ seterr(ECorrupt, "invalid blocks in index section %s", is->name); - /* ZZZ what to do? + /* ZZZ what to do? freeisect(is); return nil; */ @@ -654,7 +654,7 @@ amapitoag(Index *ix, u64int a, u64int *gstart, u64int *glimit, int *g) { u64int aa; Arena *arena; - + arena = amapitoa(ix, a, &aa); if(arena == nil) return nil; @@ -895,5 +895,3 @@ loadibucket(Index *ix, u8int *score, ISect **pis, u32int *pbuck, IBucket *ib) { return loadibucket1(ix, score, pis, pbuck, ib); } - - diff --git a/src/cmd/venti/srv/lump.c b/src/cmd/venti/srv/lump.c index cc0a26dc..3e66068a 100644 --- a/src/cmd/venti/srv/lump.c +++ b/src/cmd/venti/srv/lump.c @@ -178,7 +178,7 @@ writeqlump(Lump *u, Packet *p, int creator, uint ms) insertlump(u, p); else packetfree(p); - + if(syncwrites){ flushdcache(); flushicache(); diff --git a/src/cmd/venti/srv/lumpcache.c b/src/cmd/venti/srv/lumpcache.c index 93fed6d1..0fdc0102 100644 --- a/src/cmd/venti/srv/lumpcache.c +++ b/src/cmd/venti/srv/lumpcache.c @@ -73,7 +73,7 @@ lookuplump(u8int *score, int type) ms = 0; trace(TraceLump, "lookuplump enter"); - + h = hashbits(score, HashLog); /* @@ -426,4 +426,3 @@ checklumpcache(void) if(lumpcache.nheap + nfree + refed != lumpcache.nblocks) sysfatal("lc: missing blocks: %d %d %d %d", lumpcache.nheap, refed, nfree, lumpcache.nblocks); } - diff --git a/src/cmd/venti/srv/lumpqueue.c b/src/cmd/venti/srv/lumpqueue.c index 869eaeae..a312ad17 100644 --- a/src/cmd/venti/srv/lumpqueue.c +++ b/src/cmd/venti/srv/lumpqueue.c @@ -127,7 +127,7 @@ flushqueue(void) qunlock(&q->lock); } } - + static void queueproc(void *vq) { diff --git a/src/cmd/venti/srv/mgr.c b/src/cmd/venti/srv/mgr.c index 9a615b2c..93e87a39 100644 --- a/src/cmd/venti/srv/mgr.c +++ b/src/cmd/venti/srv/mgr.c @@ -105,7 +105,7 @@ rdconf(char *file, Conf *conf) char *s, *line, *flds[10]; int i, ok; IFile f; - + if(readifile(&f, file) < 0) return -1; memset(conf, 0, sizeof *conf); @@ -132,7 +132,7 @@ rdconf(char *file, Conf *conf) }else if(i == 3 && strcmp(flds[1], "verify") == 0) { if(conf->nverify%64 == 0) conf->verify = vtrealloc(conf->verify, (conf->nverify+64)*sizeof(conf->verify[0])); - conf->verify[conf->nverify++] = vtstrdup(flds[2]); + conf->verify[conf->nverify++] = vtstrdup(flds[2]); }else if(i == 3 && strcmp(flds[1], "verifyfreq") == 0) { conf->verifyfreq = atoi(flds[2]); }else if(i == 3 && strcmp(flds[1], "httpaddr") == 0){ @@ -186,7 +186,7 @@ logtext(VtLog *l) int i; char *p; VtLogChunk *c; - + p = logbuf; c = l->w; for(i=0; inchunk; i++) { @@ -283,7 +283,7 @@ hsettext(HConnect *c) { return hsettype(c, "text/plain; charset=utf-8"); } - + int hnotfound(HConnect *c) { @@ -316,12 +316,12 @@ vtloghlist(Hio *h) { char **p; int i, n; - + hprint(h, "\n"); hprint(h, "Venti Server Logs\n"); hprint(h, "\n"); hprint(h, "Venti Server Logs\n

\n"); - + p = vtlognames(&n); qsort(p, n, sizeof(p[0]), strpcmp); for(i=0; iname : "<nil>"; hprint(h, "\n"); hprint(h, "Venti Server Log: %s\n", name); hprint(h, "\n"); hprint(h, "Venti Server Log: %s\n

\n", name); - + if(l){ c = l->w; for(i=0; inchunk; i++){ @@ -360,7 +360,7 @@ char* hargstr(HConnect *c, char *name, char *def) { HSPairs *p; - + for(p=c->req.searchpairs; p; p=p->next) if(strcmp(p->s, name) == 0) return p->t; @@ -446,7 +446,7 @@ httpproc(void *v) */ if(hparsereq(c, 0) < 0) break; - + for(i = 0; i < MaxObjs && objs[i].name[0]; i++){ n = strlen(objs[i].name); if((objs[i].name[n-1] == '/' && strncmp(c->req.uri, objs[i].name, n) == 0) @@ -508,7 +508,7 @@ fromwebdir(HConnect *c) char buf[4096], *p, *ext, *type; int i, fd, n, defaulted; Dir *d; - + if(conf.webroot == nil || strstr(c->req.uri, "..")) return hnotfound(c); snprint(buf, sizeof buf-20, "%s/%s", conf.webroot, c->req.uri+1); @@ -614,7 +614,7 @@ piper(void *v) int fd; char *p; int ok; - + j = v; fd = j->pipe; l = j->newlog; @@ -625,7 +625,7 @@ piper(void *v) } qlock(&loglk); p = logtext(l); - ok = j->ok(p); + ok = j->ok(p); qunlock(&loglk); j->newok = ok; close(fd); @@ -808,7 +808,7 @@ threadmain(int argc, char **argv) int nofork; char *prog; Job *j; - + ventilogging = 1; ventifmtinstall(); #ifdef PLAN9PORT @@ -893,8 +893,8 @@ void qp(Biobuf *b, char *p) { int n, nspace; - - nspace = 0; + + nspace = 0; n = 0; for(; *p; p++) { if(*p == '\n') { @@ -934,7 +934,7 @@ smtpread(Biobuf *b, int code) { char *p, *q; int n; - + while((p = Brdstr(b, '\n', 1)) != nil) { n = strtol(p, &q, 10); if(n == 0 || q != p+3) { @@ -957,13 +957,13 @@ smtpread(Biobuf *b, int code) return -1; } - + void sendmail(char *content, char *subject, char *msg) { int fd; Biobuf *bin, *bout; - + if((fd = dial(conf.smtp, 0, 0, 0)) < 0) { vtlogprint(errlog, "dial %s: %r\n", conf.smtp); return; @@ -979,7 +979,7 @@ sendmail(char *content, char *subject, char *msg) Bterm(bout); return; } - + Bprint(bout, "HELO venti-mgr\n"); Bflush(bout); if(smtpread(bin, 250) < 0) @@ -994,12 +994,12 @@ sendmail(char *content, char *subject, char *msg) Bflush(bout); if(smtpread(bin, 250) < 0) goto error; - + Bprint(bout, "DATA\n"); Bflush(bout); if(smtpread(bin, 354) < 0) goto error; - + Bprint(bout, "From: \"venti mgr\" <%s>\n", conf.mailfrom); Bprint(bout, "To: <%s>\n", conf.mailto); Bprint(bout, "Subject: %s\n", subject); @@ -1013,7 +1013,7 @@ sendmail(char *content, char *subject, char *msg) Bflush(bout); if(smtpread(bin, 250) < 0) goto error; - + Bprint(bout, "QUIT\n"); Bflush(bout); Bterm(bin); diff --git a/src/cmd/venti/srv/mirrorarenas.c b/src/cmd/venti/srv/mirrorarenas.c index c0d02e65..adca4a78 100644 --- a/src/cmd/venti/srv/mirrorarenas.c +++ b/src/cmd/venti/srv/mirrorarenas.c @@ -1,5 +1,5 @@ /* - * Mirror one arena partition onto another. + * Mirror one arena partition onto another. * Be careful to copy only new data. */ @@ -41,7 +41,7 @@ void tag(int indx, char *name, char *fmt, ...) { va_list arg; - + if(tagged){ free(tagged); tagged = nil; @@ -53,7 +53,7 @@ tag(int indx, char *name, char *fmt, ...) va_end(arg); } -enum +enum { Sealed = 1, Mirrored = 2, @@ -99,7 +99,7 @@ setstatus(int bits) if(bits < 0) { startindx = -1; return; - } + } } void @@ -132,7 +132,7 @@ ereadpart(Part *p, u64int offset, u8int *buf, u32int count) } return 0; } - + int ewritepart(Part *p, u64int offset, u8int *buf, u32int count) { @@ -153,7 +153,7 @@ static void writeproc(void *v) { Write *w; - + USED(v); while((w = recvp(writechan)) != nil){ if(w == &wsync) @@ -175,7 +175,7 @@ copy(uvlong start, uvlong end, char *what, DigestState *ds) static uchar *tmp[2]; uchar *p; Write w[2]; - + assert(start <= end); assert(astart <= start && start < aend); assert(astart <= end && end <= aend); @@ -240,7 +240,7 @@ copy1(uvlong start, uvlong end, char *what, DigestState *ds) int n; uvlong o; static uchar tmp[1024*1024]; - + assert(start <= end); assert(astart <= start && start < aend); assert(astart <= end && end <= aend); @@ -310,16 +310,16 @@ mirror(int indx, Arena *sa, Arena *da) ArenaHead h; DigestState xds, *ds; vlong shaoff, base; - + base = sa->base; blocksize = sa->blocksize; end = sa->base + sa->size; - + astart = base - blocksize; aend = end + blocksize; tag(indx, sa->name, "%T %s (%,llud-%,llud)\n", sa->name, astart, aend); - + if(force){ copy(astart, aend, "all", nil); return; @@ -357,7 +357,7 @@ mirror(int indx, Arena *sa, Arena *da) if(ewritepart(dst, end, buf, blocksize) < 0) return; } - + memset(&h, 0, sizeof h); h.version = da->version; strcpy(h.name, da->name); @@ -379,7 +379,7 @@ mirror(int indx, Arena *sa, Arena *da) sha1(buf, blocksize, nil, ds); shaoff = base; } - + if(sa->diskstats.used != da->diskstats.used){ di = base+rdown(da->diskstats.used, blocksize); si = base+rup(sa->diskstats.used, blocksize); @@ -389,14 +389,14 @@ mirror(int indx, Arena *sa, Arena *da) return; shaoff = si; } - + clumpmax = sa->clumpmax; di = end - da->diskstats.clumps/clumpmax * blocksize; si = end - (sa->diskstats.clumps+clumpmax-1)/clumpmax * blocksize; if(sa->diskstats.sealed){ /* - * might be a small hole between the end of the + * might be a small hole between the end of the * data and the beginning of the directory. */ v = base+rup(sa->diskstats.used, blocksize); @@ -419,7 +419,7 @@ mirror(int indx, Arena *sa, Arena *da) da->wtime = sa->wtime; da->diskstats = sa->diskstats; da->diskstats.sealed = 0; - + /* * Repack the arena tail information * and save it for next time... @@ -525,7 +525,7 @@ mirrormany(ArenaPart *sp, ArenaPart *dp, char *range) mirror(i, sa, da); } setstatus(-1); - } + } } @@ -536,7 +536,7 @@ threadmain(int argc, char **argv) Arena *sa, *da; ArenaPart *s, *d; char *ranges; - + ventifmtinstall(); ARGBEGIN{ @@ -552,7 +552,7 @@ threadmain(int argc, char **argv) default: usage(); }ARGEND - + if(argc != 2 && argc != 3) usage(); ranges = nil; @@ -571,7 +571,7 @@ threadmain(int argc, char **argv) sysfatal("loadarenapart %s: %r", argv[1]); for(i=0; inarenas; i++) delarena(d->arenas[i]); - + /* * The arena geometries must match or all bets are off. */ @@ -589,7 +589,7 @@ threadmain(int argc, char **argv) if(strcmp(sa->name, da->name) != 0) sysfatal("arena %d: name mismatch: %s vs %s", i, sa->name, da->name); } - + /* * Mirror one arena at a time. */ diff --git a/src/cmd/venti/srv/part.c b/src/cmd/venti/srv/part.c index ae044814..c1fb929f 100644 --- a/src/cmd/venti/srv/part.c +++ b/src/cmd/venti/srv/part.c @@ -56,7 +56,7 @@ strtoullsuf(char *p, char **pp, int rad, u64int *u) *u = v; return 0; } - + static int parsepart(char *name, char **file, char **subpart, u64int *lo, u64int *hi) { @@ -221,11 +221,11 @@ partblocksize(Part *part, u32int blocksize) * Most Unix systems require that when accessing a block device directly, * the buffer, offset, and count are all multiples of the device block size, * making this a lot more complicated than it otherwise would be. - * + * * Most of our callers will make things easy on us, but for some callers it's best * if we just do the work here, with only one place to get it right (hopefully). - * - * If everything is aligned properly, prwb will try to do big transfers in the main + * + * If everything is aligned properly, prwb will try to do big transfers in the main * body of the loop: up to MaxIo bytes at a time. If everything isn't aligned properly, * we work one block at a time. */ @@ -412,7 +412,7 @@ rwpart(Part *part, int isread, u64int offset, u8int *buf, u32int count) int n, try; u32int blocksize; - trace(TraceDisk, "%s %s %ud at 0x%llx", + trace(TraceDisk, "%s %s %ud at 0x%llx", isread ? "read" : "write", part->name, count, offset); if(offset >= part->size || offset+count > part->size){ seterr(EStrange, "out of bounds %s offset 0x%llux count %ud to partition %s size 0x%llux", @@ -491,7 +491,7 @@ readfile(char *name) /* * Search for the Plan 9 partition with the given name. - * This lets you write things like /dev/ad4:arenas + * This lets you write things like /dev/ad4:arenas * if you move a disk from a Plan 9 system to a FreeBSD system. * * God I hope I never write this code again. @@ -566,7 +566,7 @@ findsubpart(Part *part, char *name) /* See if this is a Plan 9 partition. */ if(tryplan9part(part, name) >= 0) return 0; - + /* Otherwise try for an MBR and then narrow to Plan 9 partition. */ if(readpart(part, 0, buf, 512) != 512) return -1; @@ -587,8 +587,3 @@ findsubpart(Part *part, char *name) } return -1; } - - - - - diff --git a/src/cmd/venti/srv/png.c b/src/cmd/venti/srv/png.c index 8805ada4..85901a92 100644 --- a/src/cmd/venti/srv/png.c +++ b/src/cmd/venti/srv/png.c @@ -99,7 +99,7 @@ zread(void *va, void *buf, int n) b[2] = (b[2]*255)/a; } } - }else + }else b += pixwid*pixels; z->x += pixels; @@ -148,7 +148,7 @@ memRGBA(Memimage *i) Memimage *ni; char buf[32]; ulong dst; - + /* * [A]BGR because we want R,G,B,[A] in big-endian order. Sigh. */ @@ -157,7 +157,7 @@ memRGBA(Memimage *i) dst = ABGR32; else dst = BGR24; - + if(i->chan == dst) return i; @@ -194,7 +194,7 @@ writepng(Hio *io, Memimage *m) return -1; hwrite(io, PNGmagic, sizeof PNGmagic); - + /* IHDR chunk */ h = buf; put4(h, Dx(m->r)); h += 4; diff --git a/src/cmd/venti/srv/rdarena.c b/src/cmd/venti/srv/rdarena.c index 9d7cd20e..42be5663 100644 --- a/src/cmd/venti/srv/rdarena.c +++ b/src/cmd/venti/srv/rdarena.c @@ -33,7 +33,7 @@ rdarena(Arena *arena) if(a + bs > e) bs = arena->blocksize; if(readpart(arena->part, a, b->data, bs) < 0) - fprint(2, "can't copy %s, read at %lld failed: %r\n", arena->name, a); + fprint(2, "can't copy %s, read at %lld failed: %r\n", arena->name, a); if(write(1, b->data, bs) != bs) sysfatal("can't copy %s, write at %lld failed: %r", arena->name, a); } diff --git a/src/cmd/venti/srv/readifile.c b/src/cmd/venti/srv/readifile.c index a822a987..ddfef141 100644 --- a/src/cmd/venti/srv/readifile.c +++ b/src/cmd/venti/srv/readifile.c @@ -18,10 +18,10 @@ threadmain(int argc, char *argv[]) default: usage(); }ARGEND - + if(argc != 1) usage(); - + if(readifile(&ifile, argv[0]) < 0) sysfatal("readifile %s: %r", argv[0]); write(1, ifile.b->data, ifile.b->len); diff --git a/src/cmd/venti/srv/reseal.c b/src/cmd/venti/srv/reseal.c index f7353122..41a53ce1 100644 --- a/src/cmd/venti/srv/reseal.c +++ b/src/cmd/venti/srv/reseal.c @@ -97,7 +97,7 @@ verify(Arena *arena, void *data, uchar *newscore) bs = e - n; sha1(data, bs, nil, &ds); } - + /* last block */ if(preadblock(data, arena->blocksize, o + e) < 0){ werrstr("read: %r"); @@ -113,7 +113,7 @@ verify(Arena *arena, void *data, uchar *newscore) } fprint(2, "warning: score mismatch %V != %V\n", score, arena->score); } - + /* prepare new last block */ memset(data, 0, arena->blocksize); packarena(arena, data); @@ -158,17 +158,17 @@ resealarena(char *name, vlong len) if(loadheader(name, &head, &arena, off) < 0) return; - + if(!arena.diskstats.sealed){ fprint(2, "%s: not sealed\n", name); return; } - + if(verify(&arena, data, newscore) < 0){ fprint(2, "%s: failed to verify before reseal: %r\n", name); return; } - + if(pwriteblock(data, arena.blocksize, arena.base + arena.size) < 0){ fprint(2, "%s: writing new tail: %r\n", name); return; @@ -188,7 +188,7 @@ static int shouldcheck(char *name, char **s, int n) { int i; - + if(n == 0) return 1; @@ -205,7 +205,7 @@ char * readap(ArenaPart *ap) { char *table; - + if(preadblock(data, 8192, PartBlank) < 0) sysfatal("read arena part header: %r"); if(unpackarenapart(ap, data) < 0) @@ -229,7 +229,7 @@ threadmain(int argc, char *argv[]) vlong start, stop; ArenaPart ap; Part *part; - + ventifmtinstall(); blocksize = MaxIoSize; ARGBEGIN{ diff --git a/src/cmd/venti/srv/round.c b/src/cmd/venti/srv/round.c index bbf4a478..5e01b0ba 100644 --- a/src/cmd/venti/srv/round.c +++ b/src/cmd/venti/srv/round.c @@ -99,4 +99,3 @@ delaykickroundproc(void *v) trace(TraceProc, "finishround 0x%ux", (uint)n); } } - diff --git a/src/cmd/venti/srv/sortientry.c b/src/cmd/venti/srv/sortientry.c index b8b8e876..e65b9988 100644 --- a/src/cmd/venti/srv/sortientry.c +++ b/src/cmd/venti/srv/sortientry.c @@ -262,7 +262,7 @@ sortiebucks(IEBucks *ib) if(n == TWID32) return TWID64; if(n != ib->bucks[i].total/IEntrySize) - fprint(2, "bucket %d changed count %d => %d\n", + fprint(2, "bucket %d changed count %d => %d\n", i, (int)(ib->bucks[i].total/IEntrySize), n); tot += n; } diff --git a/src/cmd/venti/srv/stats.c b/src/cmd/venti/srv/stats.c index bb944760..e2f077be 100644 --- a/src/cmd/venti/srv/stats.c +++ b/src/cmd/venti/srv/stats.c @@ -17,7 +17,7 @@ Statdesc statdesc[NStat] = { "rpc read cached time", }, { "rpc read uncached", }, { "rpc read uncached time "}, - + { "rpc writes", }, { "rpc writes new", }, { "rpc writes old", }, @@ -83,7 +83,7 @@ Statdesc statdesc[NStat] = { "sum reads", }, { "sum read bytes", }, - + { "cig loads" }, { "cig load time" }, }; @@ -158,9 +158,9 @@ binstats(long (*fn)(Stats *s0, Stats *s1, void *arg), void *arg, int i, j, lo, hi, m; vlong tot; Statbin *b; - + t = stats.now; - + /* negative times mean relative to now. */ if(t0 <= 0) t0 += t; @@ -170,7 +170,7 @@ binstats(long (*fn)(Stats *s0, Stats *s1, void *arg), void *arg, if(t1 <= t0) t0 = t1 - 60*10; if(0) fprint(2, "stats %ld-%ld\n", t0, t1); - + /* binary search to find t0-1 or close */ lo = stattime; hi = stattime+nstathist; @@ -208,5 +208,5 @@ binstats(long (*fn)(Stats *s0, Stats *s1, void *arg), void *arg, b->avg = tot / b->nsamp; if(b->nsamp==0 && i>0) *b = bin[i-1]; - } + } } diff --git a/src/cmd/venti/srv/syncindex0.c b/src/cmd/venti/srv/syncindex0.c index be3a2ea0..9928ca03 100644 --- a/src/cmd/venti/srv/syncindex0.c +++ b/src/cmd/venti/srv/syncindex0.c @@ -11,10 +11,10 @@ syncarenaindex(Arena *arena, u64int a0) ClumpInfo ci; IAddr ia; AState as; - + if(arena->diskstats.clumps == arena->memstats.clumps) return 0; - + memset(&as, 0, sizeof as); as.arena = arena; as.stats = arena->diskstats; @@ -68,10 +68,10 @@ syncindex(Index *ix) continue; } flushdcache(); - + if(arena->memstats.clumps == arena->diskstats.clumps) continue; - + fprint(2, "%T %s: indexing %d clumps...\n", arena->name, arena->memstats.clumps - arena->diskstats.clumps); diff --git a/src/cmd/venti/srv/venti.c b/src/cmd/venti/srv/venti.c index 2a3cc669..1725537a 100644 --- a/src/cmd/venti/srv/venti.c +++ b/src/cmd/venti/srv/venti.c @@ -159,7 +159,7 @@ threadmain(int argc, char *argv[]) /* * block cache: need a block for every arena and every process */ - minbcmem = maxblocksize * + minbcmem = maxblocksize * (mainindex->narenas + mainindex->nsects*4 + 16); if(bcmem < minbcmem) bcmem = minbcmem; diff --git a/src/cmd/venti/srv/verifyarena.c b/src/cmd/venti/srv/verifyarena.c index f53d17f2..47340dcf 100644 --- a/src/cmd/venti/srv/verifyarena.c +++ b/src/cmd/venti/srv/verifyarena.c @@ -127,12 +127,12 @@ verifyarena(char *name, vlong len) scorecp(arena.score, &data[arena.blocksize - VtScoreSize]); if(namecmp(arena.name, head.name) != 0){ - fprint(2, "%T %s: wrong name in trailer: %s vs. %s\n", + fprint(2, "%T %s: wrong name in trailer: %s vs. %s\n", name, head.name, arena.name); return; } if(arena.version != head.version){ - fprint(2, "%T %s: wrong version in trailer: %d vs. %d\n", + fprint(2, "%T %s: wrong version in trailer: %d vs. %d\n", name, head.version, arena.version); return; } @@ -160,7 +160,7 @@ static int shouldcheck(char *name, char **s, int n) { int i; - + if(n == 0) return 1; @@ -209,7 +209,7 @@ threadmain(int argc, char *argv[]) verifyarena("", 0); threadexitsall(nil); } - + if((part = initpart(argv[0], OREAD)) == nil) sysfatal("open partition %s: %r", argv[0]); fd = part->fd; @@ -228,7 +228,7 @@ threadmain(int argc, char *argv[]) if(preadblock((uchar*)table, ap.tabsize, ap.tabbase) < 0) sysfatal("reading arena part directory: %r"); table[ap.tabsize] = 0; - + nline = atoi(table); p = strchr(table, '\n'); if(p) diff --git a/src/cmd/venti/srv/wrarena.c b/src/cmd/venti/srv/wrarena.c index 1e274ca7..df8f7fd8 100644 --- a/src/cmd/venti/srv/wrarena.c +++ b/src/cmd/venti/srv/wrarena.c @@ -45,7 +45,7 @@ vtsendthread(void *v) } /* * All the send threads try to exit right when - * threadmain is calling threadexitsall. + * threadmain is calling threadexitsall. * Either libthread or the Linux NPTL pthreads library * can't handle this condition (I suspect NPTL but have * not confirmed this) and we get a seg fault in exit. diff --git a/src/cmd/venti/srv/xml.c b/src/cmd/venti/srv/xml.c index e91afa05..9538d778 100644 --- a/src/cmd/venti/srv/xml.c +++ b/src/cmd/venti/srv/xml.c @@ -65,4 +65,3 @@ void xmlamap(Hio *hout, AMap *s, char *tag, int indent){ xmlu64int(hout, s->stop, "stop"); hprint(hout, "/>\n"); } - diff --git a/src/cmd/venti/srv/zblock.c b/src/cmd/venti/srv/zblock.c index afff0801..80b24064 100644 --- a/src/cmd/venti/srv/zblock.c +++ b/src/cmd/venti/srv/zblock.c @@ -93,4 +93,3 @@ zblock2packet(ZBlock *zb, u32int size) packetappend(p, zb->data, size); return p; } - diff --git a/src/cmd/venti/sync.c b/src/cmd/venti/sync.c index 9d817a72..965f19ed 100644 --- a/src/cmd/venti/sync.c +++ b/src/cmd/venti/sync.c @@ -20,7 +20,7 @@ threadmain(int argc, char *argv[]) fmtinstall('V', vtscorefmt); fmtinstall('F', vtfcallfmt); - + ARGBEGIN{ case 'h': host = EARGF(usage()); diff --git a/src/cmd/venti/writefile.c b/src/cmd/venti/writefile.c index 21117126..3aff69dd 100644 --- a/src/cmd/venti/writefile.c +++ b/src/cmd/venti/writefile.c @@ -85,13 +85,13 @@ threadmain(int argc, char *argv[]) if(vtfilegetentry(f, &e) < 0) sysfatal("vtfilegetentry: %r"); vtfileunlock(f); - + // write directory entry memset(&root, 0, sizeof root); vtentrypack(&e, buf, 0); if(vtwrite(z, root.score, VtDirType, buf, VtEntrySize) < 0) sysfatal("vtwrite dir: %r"); - + // write root strcpy(root.name, "data"); strcpy(root.type, "file"); @@ -99,8 +99,7 @@ threadmain(int argc, char *argv[]) vtrootpack(&root, buf); if(vtwrite(z, score, VtRootType, buf, VtRootSize) < 0) sysfatal("vtwrite root: %r"); - + print("file:%V\n", score); threadexitsall(0); } - -- cgit v1.2.3