From 652a6417046de7d102a1520fee11a30d91ad7f2f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 27 Jul 2015 06:42:41 +0200 Subject: kernel: clunk the cache when removing cache flag on a channel, only call cread() chen CCACHE flag is set to avoid double caching, attachimage() and setswapchan() clear the CCACHE flag on the channel but this keeps the read ahread state of the cache arround (until the chan gets closed), so also call cclunk() to detach the mcp and free the read ahead state. avoid the call to cread() when CCACHE flag is clear. --- sys/src/9/port/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/src/9/port/segment.c') diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c index 987f984cc..d7124caef 100644 --- a/sys/src/9/port/segment.c +++ b/sys/src/9/port/segment.c @@ -232,6 +232,9 @@ attachimage(int type, Chan *c, uintptr base, ulong len) { Image *i, **l; + c->flag &= ~CCACHE; + cclunk(c); + lock(&imagealloc); /* @@ -272,7 +275,6 @@ found: unlock(&imagealloc); if(i->c == nil){ i->c = c; - c->flag &= ~CCACHE; incref(c); } -- cgit v1.2.3