shithub: gefs

Download patch

ref: fa36d7f22f788a5c4aac2c41d31a689ce1ee702f
parent: e6792282e43bdd043dbdd2e8949a0e19457f4911
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Nov 10 12:26:43 EST 2023

snap: keep in-mem refcounts in sync with on-disk refcounts

--- a/snap.c
+++ b/snap.c
@@ -365,6 +365,7 @@
 		n->gen = aincv(&fs->nextgen, 1);
 		n->memgen = aincv(&fs->nextgen, 1);
 
+		t->nref++;
 		m[i].op = Orelink;
 		retag2kv(t->gen, t->succ, 0, 1, &m[i], buf[i], sizeof(buf[i]));
 		i++;
@@ -376,7 +377,6 @@
 		i++;
 	}else{
 		t->nlbl++;
-
 		m[i].op = Orelink;
 		retag2kv(t->gen, t->succ, 1, 0, &m[i], buf[i], sizeof(buf[i]));
 		i++;