diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-11-08 22:31:26 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-11-08 22:31:26 +0100 |
commit | 2bc9e8e5e3b3eab7063c718fc6711b0a1cd14dbe (patch) | |
tree | 70d785f0e8d268ba48d6626e18e647761f546773 /sys/src/9/port/portdat.h | |
parent | 18e515511f45c115acbed2dc40dd1895b2ea6890 (diff) |
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.
Diffstat (limited to 'sys/src/9/port/portdat.h')
-rw-r--r-- | sys/src/9/port/portdat.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/src/9/port/portdat.h b/sys/src/9/port/portdat.h index 2cad12930..4edd4e732 100644 --- a/sys/src/9/port/portdat.h +++ b/sys/src/9/port/portdat.h @@ -344,16 +344,15 @@ struct Swapalloc struct Image { Ref; - Chan *c; /* channel to text file */ + long pgref; /* number of cached pages (pgref <= ref) */ + Chan *c; /* channel to text file, nil when not used */ Qid qid; /* Qid for page cache coherence */ - Qid mqid; - Chan *mchan; + ulong dev; /* Device id of owning channel */ ushort type; /* Device type of owning channel */ Segment *s; /* TEXT segment for image if running */ Image *hash; /* Qid hash chains */ Image *next; /* Free list */ char notext; /* no file associated */ - char nocache; /* no freelist page caching */ }; struct Pte |