summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-10-17 15:48:30 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-10-17 15:48:30 +0200
commit1ee5cd7425b2bcaaef4d83092c3a9453fb33588f (patch)
tree8c84a7c32976a28299a730d53ee386bf667568d6 /sys/lib
parente51845797bf3253096b15b7a86a8c900c751bb37 (diff)
kernel: mnt cache rework
avoid double entries in the cache for copen() and properly handle locking so we wont just give up if we cant lock the Mntcache entry, but drop the cache lock, qlock the Mntcache entry, and then recheck the cache. general cleanup (cdev -> ccache, use eqchantdqid())
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/acid/kernel36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/lib/acid/kernel b/sys/lib/acid/kernel
index 68c484b5d..7d082ec12 100644
--- a/sys/lib/acid/kernel
+++ b/sys/lib/acid/kernel
@@ -74,6 +74,20 @@ defn chans() {
}
}
+defn findchan(dev,type,path) {
+ local c;
+
+ c = (Chan)chanalloc.list;
+ while c != 0 do {
+ if c.ref != 0 then {
+ if c.dev == dev && c.type == type && c.qid.path == path then
+ return c;
+ }
+ c=(Chan)c.link;
+ }
+ return 0;
+}
+
defn nchans() {
local c, n;
@@ -159,6 +173,27 @@ defn badchans() {
}
}
+NHASH=128;
+defn mntcache() {
+ local i, m, c;
+
+ i=0; loop 1,NHASH do {
+ m = cache.hash[i];
+ while m != 0 do {
+ complex Mntcache m;
+ print(m\X, " dev ", m.dev\D, " type ", m.type, " qid (",
+ m.qid.path, " ", m.qid.vers\D, ")\n");
+ c = findchan(m.dev, m.type, m.qid.path);
+ if c != 0 then {
+ print(" ");
+ chan(c);
+ }
+ m = m.hash;
+ }
+ i = i+1;
+ }
+}
+
// manipulate processes
defn proctab(x) {
return procalloc.arena+sizeofProc*x;
@@ -379,5 +414,6 @@ if (map()[2]) != {} then { // map has more than two elements -> active proc
needacid("proc");
needacid("chan");
needacid("segment");
+ needacid("cache");
}
}