diff options
author | rsc <devnull@localhost> | 2006-07-18 15:26:33 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-07-18 15:26:33 +0000 |
commit | 28b49df3542a635cca788f3de213385f3fcb6334 (patch) | |
tree | a3a30774249929e66988bf77e76df9459acb50bc /src/cmd/venti/srv/lumpcache.c | |
parent | 686bd37d9d8db5e3b969a3aa2d5b455e0976b262 (diff) | |
download | plan9port-28b49df3542a635cca788f3de213385f3fcb6334.tar.gz plan9port-28b49df3542a635cca788f3de213385f3fcb6334.tar.bz2 plan9port-28b49df3542a635cca788f3de213385f3fcb6334.zip |
assorted changes from Plan 9
Diffstat (limited to 'src/cmd/venti/srv/lumpcache.c')
-rw-r--r-- | src/cmd/venti/srv/lumpcache.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/cmd/venti/srv/lumpcache.c b/src/cmd/venti/srv/lumpcache.c index f183e128..b989c3cb 100644 --- a/src/cmd/venti/srv/lumpcache.c +++ b/src/cmd/venti/srv/lumpcache.c @@ -11,7 +11,7 @@ enum { HashLog = 9, HashSize = 1<<HashLog, - HashMask = HashSize - 1 + HashMask = HashSize - 1, }; struct LumpCache @@ -175,7 +175,6 @@ again: * remove it from the heap, and fix up the heap. */ size = packetasize(p); -/*ZZZ */ while(lumpcache.avail < size){ trace(TraceLump, "insertlump bump"); CHECK(checklumpcache()); @@ -277,6 +276,15 @@ bumplump(void) return b; } +void +emptylumpcache(void) +{ + qlock(&lumpcache.lock); + while(bumplump()) + ; + qunlock(&lumpcache.lock); +} + /* * delete an arbitrary block from the heap */ @@ -415,3 +423,4 @@ checklumpcache(void) if(lumpcache.nheap + nfree + refed != lumpcache.nblocks) sysfatal("lc: missing blocks: %d %d %d %d", lumpcache.nheap, refed, nfree, lumpcache.nblocks); } + |