Commit Diff


commit - 8d271d6cc3e14e5f7817dfbad2148ca86a6097a6
commit + 07029cdbbd9be6ad780bd594c98d26babec7ee67
blob - ede277986eedf9676d65dbc28aef4140ba810260
blob + 1c9dce3d1a7b6afe571df296ba8142a4710b0eec
--- src/cmd/venti/srv/dat.h
+++ src/cmd/venti/srv/dat.h
@@ -439,10 +439,6 @@ struct Index
 	u32int		buckets;		/* last bucket used in disk hash table */
 	u32int		blocksize;
 	u32int		tabsize;		/* max. bytes in index config */
-	u32int		bitblocks;	/* XXX remove these fields */
-	u32int		maxdepth;
-	u32int		bitkeylog;
-	u32int		bitkeymask;
 
 	int		mapalloc;		/* first arena to check when adding a lump */
 	Arena		**arenas;		/* arenas in the mapping */
blob - a0eb6b1645f2b342e0d1a86e8149b027b35c3a49
blob + d24e0619f8eab6e063e056dd1d2d24dc67d66116
--- src/cmd/venti/srv/fmtindex.c
+++ src/cmd/venti/srv/fmtindex.c
@@ -103,8 +103,8 @@ threadmain(int argc, char *argv[])
 	if(0){
 		fprint(2, "configured index=%s with arenas=%d and storage=%lld\n",
 			ix->name, n, addr - IndexBase);
-		fprint(2, "\tbitblocks=%d maxdepth=%d buckets=%d\n",
-			ix->bitblocks, ix->maxdepth, ix->buckets);
+		fprint(2, "\tbuckets=%d\n",
+			ix->buckets);
 	}
 	fprint(2, "fmtindex: %,d arenas, %,d index buckets, %,lld bytes storage\n",
 		n, ix->buckets, addr-IndexBase);
blob - 003abb1856ba386f5402cc94860febb24ef99985
blob + 2d3ed47c55d88b185454f3999ddc0cfac3a06b55
--- src/cmd/venti/srv/icachewrite.c
+++ src/cmd/venti/srv/icachewrite.c
@@ -110,7 +110,7 @@ icachewritesect(Index *ix, ISect *is, u8int *buf)
 
 		trace(TraceProc, "icachewritesect readpart 0x%llux+0x%ux", addr, nbuf);
 		if(readpart(is->part, addr, buf, nbuf) < 0){
-			/* XXX */
+			/* XXX more details here */
 			fprint(2, "icachewriteproc readpart: %r\n");
 			err  = -1;
 			continue;
@@ -154,7 +154,18 @@ icachewritesect(Index *ix, ISect *is, u8int *buf)
 					break;
 			}
 			packibucket(&ib, buf+off, is->bucketmagic);
-			/* XXX not right - must update cache after writepart */
+			/* XXX
+			 * This is not quite right - it's good that we 
+			 * update the cached block (if any) here, but
+			 * since the block doesn't get written until writepart
+			 * below, we also need to make sure that the cache 
+			 * doesn't load the stale block before we write it to
+			 * disk below.  We could lock the disk cache during
+			 * the writepart, but that's pretty annoying.
+			 * Another possibility would be never to cache
+			 * index partition blocks.  The hit rate on those is
+			 * miniscule anyway.
+			 */
 			if((b = _getdblock(is->part, naddr, ORDWR, 0)) != nil){
 				memmove(b->data, buf+off, bsize);
 				putdblock(b);
@@ -165,7 +176,7 @@ icachewritesect(Index *ix, ISect *is, u8int *buf)
 
 		trace(TraceProc, "icachewritesect writepart", addr, nbuf);
 		if(writepart(is->part, addr, buf, nbuf) < 0){
-			/* XXX */
+			/* XXX more details here */
 			fprint(2, "icachewriteproc writepart: %r\n");
 			err = -1;
 			continue;
blob - 87361aa9fd5aded47c079b6c1dc55efa4df1736b
blob + 16b37a07c28b737ff1d2612ed1aaf742072f32ba
--- src/cmd/venti/srv/index.c
+++ src/cmd/venti/srv/index.c
@@ -243,7 +243,7 @@ newindex(char *name, ISect **sects, int n)
 	Index *ix;
 	AMap *smap;
 	u64int nb;
-	u32int div, ub, xb, fb, start, stop, blocksize, tabsize;
+	u32int div, ub, xb, start, stop, blocksize, tabsize;
 	int i, j;
 
 	if(n < 1){
@@ -292,7 +292,6 @@ newindex(char *name, ISect **sects, int n)
 		return nil;
 	}
 
-	fb = 0;
 	div = (((u64int)1 << 32) + nb - 1) / nb;
 	ub = (((u64int)1 << 32) - 1) / div + 1;
 	if(div < 100){
@@ -347,7 +346,6 @@ newindex(char *name, ISect **sects, int n)
 	ix->buckets = ub;
 	ix->tabsize = tabsize;
 	ix->div = div;
-	ix->bitblocks = fb;
 
 	if(initindex1(ix) < 0){
 		free(smap);
blob - 25418beb1ff3d66be453f916901b24ea242c3e0f
blob + ed642c95bb785cd2b9acc135cf5d99ac39a55cd1
--- src/cmd/venti/srv/printarenapart.c
+++ src/cmd/venti/srv/printarenapart.c
@@ -106,18 +106,14 @@ threadmain(int argc, char *argv[])
 	ap.tabbase = (PartBlank+HeadSize+ap.blocksize-1)&~(ap.blocksize-1);
 	ap.tabsize = ap.arenabase - ap.tabbase;
 
-print("A");
 	table = malloc(ap.tabsize+1);
 	if(readpart(part, ap.tabbase, (uchar*)table, ap.tabsize) < 0)
 		sysfatal("read %s: %r", file);
 	table[ap.tabsize] = 0;
 
-print("A");
 	partblocksize(part, ap.blocksize);
 	initdcache(8 * MaxDiskBlock);
 
-print("A");
-/* XXX - read the number of arenas from the first line */
 	for(p=table; p && *p; p=strchr(p, '\n')){
 		if(*p == '\n')
 			p++;
@@ -127,7 +123,6 @@ print("A");
 			fprint(2, "bad line: %s\n", name);
 			break;
 		}
-print("%p\n", p);
 		offset = strtoull(p, nil, 0);
 		if(readpart(part, offset, buf, sizeof buf) < 0){
 			fprint(2, "%s: read %s: %r\n", argv0, file);
blob - 8e63a20b222263b794269d4add5bec88ef94cd1e
blob + 6e0edd7f3f980e1625ae1a67847520b7ae14d70e
--- src/cmd/venti/srv/tester
+++ src/cmd/venti/srv/tester
@@ -8,7 +8,7 @@ fn reformat {
 	if(! test -f $vtmp/arena)
 		dd bs'='1048576 count'='100 if'='/dev/zero of'='$vtmp/arena
 	if(! test -f $vtmp/bloom)
-		dd bs'='1048576 count'='10 if'='/dev/zero of'='$vtmp/bloom
+		dd bs'='1048576 count'='128 if'='/dev/zero of'='$vtmp/bloom
 	if(! test -f $vtmp/isect)
 		dd bs'='1048576 count'='10 if'='/dev/zero of'='$vtmp/isect
 	if(! test -f $vtmp/check)
@@ -29,7 +29,7 @@ fn reformat {
 	' >$vtmp/vtmp.conf
 
 	./o.fmtarenas -a 40M -b 8k arenas $vtmp/arena
-	./o.fmtbloom -s 10M $vtmp/bloom
+	./o.fmtbloom $vtmp/bloom
 	./o.fmtisect -b 8k isect $vtmp/isect
 	./o.fmtindex vtmp.conf
 }
blob - 87c31765a8cf037243302c2ddf85be8bf5da0c6f
blob + afff0801034208de33871d0b407c0f9225cb964c
--- src/cmd/venti/srv/zblock.c
+++ src/cmd/venti/srv/zblock.c
@@ -16,6 +16,9 @@ fmtzbinit(Fmt *f, ZBlock *b)
 
 #define ROUNDUP(p, n) ((void*)(((uintptr)(p)+(n)-1)&~(uintptr)((n)-1)))
 
+enum {
+	OverflowCheck = 32
+};
 static char zmagic[] = "1234567890abcdefghijklmnopqrstuvxyz";
 
 ZBlock *
@@ -29,7 +32,7 @@ alloczblock(u32int size, int zeroed, uint blocksize)
 	if(blocksize == 0)
 		blocksize = 32;	/* try for cache line alignment */
 
-	n = size+32/*XXX*/+sizeof(ZBlock)+blocksize+8;
+	n = size+OverflowCheck+sizeof(ZBlock)+blocksize+8;
 	p = malloc(n);
 	if(p == nil){
 		seterr(EOk, "out of memory");
@@ -37,7 +40,7 @@ alloczblock(u32int size, int zeroed, uint blocksize)
 	}
 
 	data = ROUNDUP(p, blocksize);
-	b = ROUNDUP(data+size+32/*XXX*/, 8);
+	b = ROUNDUP(data+size+OverflowCheck, 8);
 	if(0) fprint(2, "alloc %p-%p data %p-%p b %p-%p\n",
 		p, p+n, data, data+size, b, b+1);
 	*b = z;
@@ -47,7 +50,7 @@ alloczblock(u32int size, int zeroed, uint blocksize)
 	b->_size = size;
 	if(zeroed)
 		memset(b->data, 0, size);
-	memmove(b->data+size, zmagic, 32/*XXX*/);
+	memmove(b->data+size, zmagic, OverflowCheck);
 	return b;
 }
 
@@ -55,9 +58,9 @@ void
 freezblock(ZBlock *b)
 {
 	if(b){
-		if(memcmp(b->data+b->_size, zmagic, 32) != 0)
+		if(memcmp(b->data+b->_size, zmagic, OverflowCheck) != 0)
 			abort();
-		memset(b->data+b->_size, 0, 32);
+		memset(b->data+b->_size, 0, OverflowCheck);
 		free(b->free);
 	}
 }