aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/venti/srv/icache.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2007-10-29 14:33:17 -0400
committerRuss Cox <rsc@swtch.com>2007-10-29 14:33:17 -0400
commit45ac814c8609174199cadb6f1bbb4baf7c12c94a (patch)
tree49f4b2120a36b080a0ffe8f9988c21db7b97656c /src/cmd/venti/srv/icache.c
parentc5a183de108e5685305734d5cf984b58bb0d614a (diff)
downloadplan9port-45ac814c8609174199cadb6f1bbb4baf7c12c94a.tar.gz
plan9port-45ac814c8609174199cadb6f1bbb4baf7c12c94a.tar.bz2
plan9port-45ac814c8609174199cadb6f1bbb4baf7c12c94a.zip
venti: fix sync deadlock, add /proc stub
Diffstat (limited to 'src/cmd/venti/srv/icache.c')
-rw-r--r--src/cmd/venti/srv/icache.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/cmd/venti/srv/icache.c b/src/cmd/venti/srv/icache.c
index 384fd2c1..b1935d42 100644
--- a/src/cmd/venti/srv/icache.c
+++ b/src/cmd/venti/srv/icache.c
@@ -20,6 +20,7 @@ struct ICache
IEntry dirty;
u32int maxdirty;
u32int ndirty;
+ AState as;
ISum **sum;
int nsum;
@@ -398,7 +399,7 @@ icachelookup(u8int score[VtScoreSize], int type, IAddr *ia)
}
int
-insertscore(u8int score[VtScoreSize], IAddr *ia, int state)
+insertscore(u8int score[VtScoreSize], IAddr *ia, int state, AState *as)
{
ISum *toload;
@@ -409,6 +410,13 @@ insertscore(u8int score[VtScoreSize], IAddr *ia, int state)
else{
assert(state == IEDirty);
toload = nil;
+ if(as == nil)
+ fprint(2, "%T insertscore IEDirty without as; called from %lux\n", getcallerpc(&score));
+ else{
+ if(icache.as.aa > as->aa)
+ fprint(2, "%T insertscore: aa moving backward: %#llux -> %#llux\n", icache.as.aa, as->aa);
+ icache.as = *as;
+ }
}
qunlock(&icache.lock);
if(toload){
@@ -443,7 +451,7 @@ lookupscore_untimed(u8int score[VtScoreSize], int type, IAddr *ia)
if(loadientry(mainindex, score, type, &d) < 0)
return -1;
- insertscore(score, &d.ia, IEClean);
+ insertscore(score, &d.ia, IEClean, nil);
*ia = d.ia;
return 0;
}
@@ -507,6 +515,16 @@ icachedirty(u32int lo, u32int hi, u64int limit)
return dirty;
}
+AState
+icachestate(void)
+{
+ AState as;
+
+ qlock(&icache.lock);
+ as = icache.as;
+ qunlock(&icache.lock);
+ return as;
+}
/*
* The singly-linked non-circular list of index entries ie