diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/venti/srv/bloom.c | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/venti/srv/bloom.c')
-rw-r--r-- | src/cmd/venti/srv/bloom.c | 26 |
1 files changed, 13 insertions, 13 deletions
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; i<n; i++) - ones += countbits(a[i]); + ones += countbits(a[i]); addstat(StatBloomOnes, ones); if(b->size == 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; i<n; i++) @@ -251,7 +251,7 @@ bloomwriteproc(void *v) int ret; Bloom *b; - threadsetname("bloomwriteproc"); + threadsetname("bloomwriteproc"); b = v; for(;;){ recv(b->writechan, 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); } |