fix cache bug (Eoghan Sherry)

This commit is contained in:
rsc 2006-07-23 02:36:04 +00:00
parent 1cba594e51
commit 981672ae7e

View file

@ -510,6 +510,7 @@ if(0)fprint(2, "vtblockput: %d: %x %d %d\n", getpid(), b->addr, c->nheap, b->ios
case BioVenti: case BioVenti:
/*if(b->addr != NilBlock) print("blockput %d\n", b->addr); */ /*if(b->addr != NilBlock) print("blockput %d\n", b->addr); */
b->used = c->now++; b->used = c->now++;
/* fall through */
case BioVentiError: case BioVentiError:
heapins(b); heapins(b);
break; break;
@ -541,6 +542,7 @@ vtblockwrite(VtBlock *b)
memmove(b->score, score, VtScoreSize); memmove(b->score, score, VtScoreSize);
qlock(&c->lk); qlock(&c->lk);
b->addr = NilBlock; /* now on venti */
b->iostate = BioVenti; b->iostate = BioVenti;
h = (u32int)(score[0]|(score[1]<<8)|(score[2]<<16)|(score[3]<<24)) % c->nhash; h = (u32int)(score[0]|(score[1]<<8)|(score[2]<<16)|(score[3]<<24)) % c->nhash;
b->next = c->hash[h]; b->next = c->hash[h];