shithub: gefs

Download patch

ref: 1d8c682b27015c8c6d7265decd4837f2f6ecbe5c
parent: 18e0d62947b311ee6b5067272503befa4c479d19
author: Ori Bernstein <[email protected]>
date: Tue Feb 27 17:57:57 EST 2024

snap: the snap dlist does not get flushed to the tree

--- a/snap.c
+++ b/snap.c
@@ -19,9 +19,12 @@
 	enqueue(dl->ins);
 	dropblk(dl->ins);
 	dl->ins = nil;
-	m.op = Oinsert;
-	dlist2kv(dl, &m, kvbuf, sizeof(kvbuf));
-	btupsert(&fs->snap, &m, 1);
+	/* special case: the snap dlist has gen -1, skip it */
+	if(dl->gen != -1){
+		m.op = Oinsert;
+		dlist2kv(dl, &m, kvbuf, sizeof(kvbuf));
+		btupsert(&fs->snap, &m, 1);
+	}
 }
 
 static void
@@ -121,7 +124,7 @@
 {
 	Dlist *dt;
 
-	if(dl == &fs->snapdl)
+	if(dl->gen == -1)
 		return;
 	dlcachedel(dl, 0);
 	while(fs->dltail != nil && fs->dlcount >= fs->dlcmax){
@@ -151,7 +154,7 @@
 	char *p;
 
 	bp = dl->hd;
-	if(dl != &fs->snapdl){
+	if(dl->gen != -1){
 		m.op = Odelete;
 		dlist2kv(dl, &m, buf, sizeof(buf));
 		btupsert(&fs->snap, &m, 1);