git: 9front

Download patch

ref: 96128fa26814941985c8f017389ebe5b7a304eac
parent: a81e1c90c2a8e2e38111f098faca167dd0f58fd4
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Feb 15 01:19:38 EST 2026

gefs: fix accounting on deadlist cache

this could make our deadlist cache grow too large; instead
just keep track of the number of live deadlist nodes.

--- a/sys/src/cmd/gefs/snap.c
+++ b/sys/src/cmd/gefs/snap.c
@@ -56,7 +56,6 @@
 		dl->cprev->cnext = dl->cnext;
 	dl->cnext = nil;
 	dl->cprev = nil;
-	fs->dlcount--;
 }
 
 static Dlist*
@@ -88,6 +87,7 @@
 		return dl;
 	dl = emalloc(sizeof(Dlist), 1);
 	if(waserror()){
+		fs->dlcount--;
 		free(dl);
 		nexterror();
 	}
@@ -109,6 +109,7 @@
 	dl->hd.addr = -1;
 	dl->tl.addr = -1;
 	dl->ins = nil;
+	fs->dlcount++;
 
 	m.op = Oinsert;
 	dlist2kv(dl, &m, kvbuf, sizeof(kvbuf));
@@ -131,6 +132,7 @@
 		return;
 	dlcachedel(dl, 0);
 	while(fs->dlcount >= fs->dlcmax && (dt = fs->dltail) != nil){
+		fs->dlcount--;
 		dlcachedel(dt, 1);
 		dlflush(dt);
 		assert(dt->ins == nil);
@@ -144,7 +146,6 @@
 	if(fs->dlhead != nil)
 		fs->dlhead->cprev = dl;
 	fs->dlhead = dl;
-	fs->dlcount++;
 }
 
 void
--