diff options
| author | rsc <devnull@localhost> | 2004-03-11 19:14:09 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2004-03-11 19:14:09 +0000 |
| commit | 24998851775d2d2a737a172dc614d9b5c91706dc (patch) | |
| tree | 6b249cd18b9ca71aec829c7a4686974f0594cf88 /src/cmd/venti/index.c | |
| parent | d49a2e4801752c8a1211c7fac8cc08055a6b6fa5 (diff) | |
| download | plan9port-24998851775d2d2a737a172dc614d9b5c91706dc.tar.gz plan9port-24998851775d2d2a737a172dc614d9b5c91706dc.zip | |
Implement write buffer.
Diffstat (limited to 'src/cmd/venti/index.c')
| -rw-r--r-- | src/cmd/venti/index.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cmd/venti/index.c b/src/cmd/venti/index.c index 9d3ad8c4..0f2d2438 100644 --- a/src/cmd/venti/index.c +++ b/src/cmd/venti/index.c @@ -624,12 +624,14 @@ storeientry(Index *ix, IEntry *ie) h = bucklook(ie->score, ie->ia.type, ib.data, ib.n); if(h & 1){ h ^= 1; + dirtydblock(b, DirtyIndex); packientry(ie, &ib.data[h]); ok = writebucket(is, buck, &ib, b); break; } if(ib.n < is->buckmax){ + dirtydblock(b, DirtyIndex); memmove(&ib.data[h + IEntrySize], &ib.data[h], ib.n * IEntrySize - h); ib.n++; @@ -648,14 +650,19 @@ storeientry(Index *ix, IEntry *ie) static int writebucket(ISect *is, u32int buck, IBucket *ib, DBlock *b) { - if(buck >= is->blocks) + assert(b->dirty == DirtyIndex); + + if(buck >= is->blocks){ seterr(EAdmin, "index write out of bounds: %d >= %d\n", buck, is->blocks); + return -1; + } qlock(&stats.lock); stats.indexwrites++; qunlock(&stats.lock); packibucket(ib, b->data); - return writepart(is->part, is->blockbase + ((u64int)buck << is->blocklog), b->data, is->blocksize); + // return writepart(is->part, is->blockbase + ((u64int)buck << is->blocklog), b->data, is->blocksize); + return 0; } /* |
