code: plan9front

Download patch

ref: 5c0670bfaefe6411157322437e6f220e63aefda4
parent: 828c577e03e15f59a69bff965893e3a670a8f10f
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 2 14:53:43 EDT 2024

gefs: remove vestigial bucket lock

it was doing nothing

--- a/sys/src/cmd/gefs/cache.c
+++ b/sys/src/cmd/gefs/cache.c
@@ -84,9 +84,7 @@
 	bkt = &fs->bcache[h % fs->cmax];
 	qlock(&fs->lrulk);
 	traceb("cache", b->bp);
-	lock(bkt);
 	if(checkflag(b, Bcached)){
-		unlock(bkt);
 		qunlock(&fs->lrulk);
 		return;
 	}
@@ -97,7 +95,6 @@
 	b->cached = getcallerpc(&b);
 	b->hnext = bkt->b;
 	bkt->b = b;
-	unlock(bkt);
 	qunlock(&fs->lrulk);
 }
 
@@ -114,7 +111,6 @@
 	tracex("uncache", Zb, addr, getcallerpc(&addr));
 	h = ihash(addr);
 	bkt = &fs->bcache[h % fs->cmax];
-	lock(bkt);
 	p = &bkt->b;
 	for(b = bkt->b; b != nil; b = b->hnext){
 		if(b->bp.addr == addr){
@@ -126,7 +122,6 @@
 		}
 		p = &b->hnext;
 	}
-	unlock(bkt);
 }
 void
 cachedel(vlong addr)
@@ -147,11 +142,9 @@
 	h = ihash(addr);
 	bkt = &fs->bcache[h % fs->cmax];
 	qlock(&fs->lrulk);
-	lock(bkt);
 	for(b = bkt->b; b != nil; b = b->hnext)
 		if(b->bp.addr == addr)
 			setflag(b, flg);
-	unlock(bkt);
 	qunlock(&fs->lrulk);
 
 }
@@ -166,7 +159,6 @@
 	h = ihash(addr);
 	bkt = &fs->bcache[h % fs->cmax];
 	qlock(&fs->lrulk);
-	lock(bkt);
 	for(b = bkt->b; b != nil; b = b->hnext){
 		if(b->bp.addr == addr){
 			holdblk(b);
@@ -175,7 +167,6 @@
 			break;
 		}
 	}
-	unlock(bkt);
 	qunlock(&fs->lrulk);
 
 	return b;
--- a/sys/src/cmd/gefs/dat.h
+++ b/sys/src/cmd/gefs/dat.h
@@ -377,7 +377,6 @@
 };
 
 struct Bucket {
-	Lock;
 	Blk	*b;
 };