ref: c79522338c7152245f804a3fe16ccc5cc2322b59
parent: 2c5178fcd862c6d75ed82a08a1aff5573b41b912
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Mar 2 12:09:21 EST 2024
snap: clear all necessary deadlists, put blocks in memgen deadlist.
--- a/blk.c
+++ b/blk.c
@@ -831,7 +831,7 @@
{
Bfree *f;
- if(t == &fs->snap || (t != nil && bp.gen <= t->gen)){
+ if(t == &fs->snap || (t != nil && bp.gen < t->memgen)){
tracex("killb", bp, getcallerpc(&t), -1);
killblk(t, bp);
return;
--- a/snap.c
+++ b/snap.c
@@ -258,6 +258,20 @@
else
freedl(&dl, 1);
}
+ if(succ != -1){
+ pfx[0] = Kdlist;
+ PACK64(pfx+1, succ);
+ btnewscan(&s, pfx, sizeof(pfx));
+ btenter(&fs->snap, &s);
+ while(1){
+ if(!btnext(&s, &s.kv))
+ break;
+ kv2dlist(&s.kv, &dl);
+
+ if(dl.bgen > prev)
+ freedl(&dl, 1);
+ }
+ }
btexit(&s);
}
@@ -558,7 +572,7 @@
if(t == &fs->snap)
dl = &fs->snapdl;
else if(bp.gen > t->base)
- dl = getdl(t->gen, bp.gen);
+ dl = getdl(t->memgen, bp.gen);
else
return;
if(waserror()){