ref: 50609183e154ee4b88ce36c24c89df81be6d1e8b
parent: f07ada305d9acac789b8fcf6e3a00557ca7de112
author: Ori Bernstein <[email protected]>
date: Sat Nov 4 15:25:31 EDT 2023
ream: separate out the mutable trees from the forked empty tree
--- a/check.c
+++ b/check.c
@@ -122,8 +122,7 @@
switch(my.op){
case Oinsert: /* new kvp */
case Odelete: /* delete kvp */
- case Oclearb: /* delete kvp if exists */
- case Oclearb: /* free block ptr if exists */
+ case Oclearb: /* delete bp if exists */
case Oclobber: /* remove file if it exists */
break;
case Owstat: /* kvp dirent */
--- a/ream.c
+++ b/ream.c
@@ -104,18 +104,19 @@
setval(s, &kv);
lbl2kv("empty", 0, 0, &kv, buf, sizeof(buf));
setval(s, &kv);
- lbl2kv("main", 0, Lmut, &kv, buf, sizeof(buf));
+ lbl2kv("main", 2, Lmut, &kv, buf, sizeof(buf));
setval(s, &kv);
p = buf;
e = p + sizeof(buf);
+ /* empty */
kv.k = p;
p = packsnap(buf, e - p, 0);
kv.nk = p - kv.k;
-
kv.v = p;
memset(&t, 0, sizeof(Tree));
+ t.flag = Tforked;
t.nsucc = 1;
t.nlbl = 2;
t.ht = 1;
@@ -129,10 +130,10 @@
p = buf;
e = p + sizeof(buf);
+ /* adm */
kv.k = p;
p = packsnap(p, e - p, 1);
kv.nk = p - kv.k;
-
kv.v = p;
memset(&t, 0, sizeof(Tree));
t.nsucc = 0;
@@ -141,6 +142,25 @@
t.gen = fs->nextgen++;
t.prev = -1ULL;
t.bp = a->bp;
+ p = packtree(p, e - p, &t);
+ kv.nv = p - kv.v;
+ setval(s, &kv);
+
+ p = buf;
+ e = p + sizeof(buf);
+
+ /* main */
+ kv.k = p;
+ p = packsnap(buf, e - p, 2);
+ kv.nk = p - kv.k;
+ kv.v = p;
+ memset(&t, 0, sizeof(Tree));
+ t.nsucc = 1;
+ t.nlbl = 1;
+ t.ht = 1;
+ t.gen = fs->nextgen++;
+ t.prev = -1ULL;
+ t.bp = r->bp;
p = packtree(p, e - p, &t);
kv.nv = p - kv.v;
setval(s, &kv);