kernel: make image cache not hold onto the channel, remove nocache flag

the image cache should not hold onto the text file channel
when not neccesary. now, the image keeps track of the number
of page cache references in Image.pgref. if the number of
page cache references and Image.ref are equal, this means
all the references to this image are from the page cache.
so no segments are using this image. in that case, we can
close the channel, but keep the Image in the hash table.

when attachimage() finds our image, it will check if Image.c
is nil and reattach the channel to the image before it is
used.

the Image.nocache flag isnt needed anymore.
This commit is contained in:
cinap_lenrek 2013-11-08 22:31:26 +01:00
parent 18e515511f
commit 2bc9e8e5e3
4 changed files with 51 additions and 31 deletions

View file

@ -29,9 +29,18 @@ defn path(p) {
// print Image cache contents
IHASHSIZE = 64;
defn imagecacheline(h) {
local d, p, q;
while h != 0 do {
complex Image h;
print (h\X, " ", qid(h.qid), " type ", h.type\D, " ref ", h.ref, " next ", h.next\X, " ", path(h.c.path), "\n");
d=(Dev)(*(devtab+4*h.type));
p = "*closed*";
if h.c != 0 then
p = path(h.c.path);
q = h.qid;
print (h\X, " ref=", h.ref, " pgref=", h.pgref, "\t#", d.dc\r, h.dev\D, " (",
q.path, " ", q.vers\D, " ", q.type\X, ") ", p, "\n");
h = h.hash;
}
}