From 72bcbfc0ae424fa9e61fcc6259e4ed64502b9f38 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 3 Sep 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-09-03 --- port/cache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/port/cache.c b/port/cache.c index 85b0e43e063bc3d0e890dbc9e9e1330671fedf46..2754f11a1b2f8456ad5480330f4d5765d9e05bd1 100644 --- a/port/cache.c +++ b/port/cache.c @@ -58,6 +58,7 @@ struct Ecache static Image fscache; static Cache cache; static Ecache ecache; +static int maxcache = MAXCACHE; static void extentfree(Extent* e) @@ -109,6 +110,9 @@ cinit(void) cache.head = xalloc(sizeof(Mntcache)*NFILE); m = cache.head; + if(conf.npage*BY2PG > 200*MB) + maxcache = 10*MAXCACHE; + for(i = 0; i < NFILE-1; i++) { m->next = m+1; m->prev = m-1; @@ -290,7 +294,7 @@ cread(Chan *c, uchar *buf, int len, vlong off) int o, l, total; ulong offset; - if(off+len > MAXCACHE) + if(off+len > maxcache) return 0; m = c->mcp; @@ -453,7 +457,7 @@ cupdate(Chan *c, uchar *buf, int len, vlong off) int o, ee, eblock; ulong offset; - if(off > MAXCACHE || len == 0) + if(off > maxcache || len == 0) return; m = c->mcp; @@ -563,7 +567,7 @@ cwrite(Chan* c, uchar *buf, int len, vlong off) Extent *p, *f, *e, *tail; ulong offset; - if(off > MAXCACHE || len == 0) + if(off > maxcache || len == 0) return; m = c->mcp;