shithub: gefs

Download patch

ref: bbc98169d5712dc73dfc9f880546799e77fd3030
parent: 24cb0baaaaffe67972734d90765b50b7ef6b45db
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 16 20:22:48 EST 2023

better debugging

--- a/blk.c
+++ b/blk.c
@@ -239,6 +239,8 @@
 	Blk *lb;
 
 	lb = a->logbuf[a->lbidx++ % nelem(a->logbuf)];
+	if(lb->bp.addr != -1)
+		cachedel(lb->bp.addr);
 	initblk(lb, o, -1, Tlog);
 	finalize(lb);
 	if(syncblk(lb) == -1)
@@ -446,6 +448,8 @@
 		if(b->logsz >= Logspc - Logslop){
 			a->nlog++;
 			nb = a->logbuf[a->lbidx++ % nelem(a->logbuf)];
+			if(nb->bp.addr != -1)
+				cachedel(nb->bp.addr);
 			initblk(nb, blks[i++], -1, Tlog);
 			b->logp = nb->bp;
 			setflag(b, Bdirty);
@@ -740,6 +744,7 @@
 	i = ihash(bp.addr) % nelem(fs->blklk);
 	qlock(&fs->blklk[i]);
 	if((b = cacheget(bp.addr)) != nil){
+		b->lasthold = getcallerpc(&bp);
 		qunlock(&fs->blklk[i]);
 		return b;
 	}
@@ -768,6 +773,7 @@
 		}
 	}
 	b->bp.gen = bp.gen;
+	b->lasthold = getcallerpc(&bp);
 	cacheins(b);
 	qunlock(&fs->blklk[i]);