Reverting alternate redund block layout in lfsr_mdir_t

See the previous commit for the reason. The alternate redund block
layout is just inferior in terms of both code and RAM.
This commit is contained in:
Christopher Haster
2023-11-26 12:44:00 -06:00
parent 9d182c2055
commit 51e39747c0
6 changed files with 810 additions and 847 deletions
+27 -24
View File
@@ -176,22 +176,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -332,22 +333,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BLOCK) {
printf("traversal: 0x%x block 0x%x\n",
@@ -478,22 +480,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BLOCK) {
printf("traversal: 0x%x block 0x%x\n",
+75 -73
View File
@@ -120,7 +120,7 @@ code = '''
lfsr_btree_alloc(&lfs, &btree) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 0);
@@ -154,7 +154,7 @@ code = '''
LFSR_DATA_BUF("a", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -196,7 +196,7 @@ code = '''
LFSR_DATA_BUF("b", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -243,7 +243,7 @@ code = '''
LFSR_DATA_BUF("a", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -293,7 +293,7 @@ code = '''
LFSR_DATA_BUF("c", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 3);
@@ -348,7 +348,7 @@ code = '''
LFSR_DATA_BUF("a", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 3);
@@ -412,7 +412,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n);
@@ -465,7 +465,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n);
@@ -549,7 +549,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -605,7 +605,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n*W);
@@ -727,7 +727,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -810,7 +810,7 @@ code = '''
LFSR_DATA_BUF("A", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -856,7 +856,7 @@ code = '''
LFSR_DATA_BUF("B", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -912,7 +912,7 @@ code = '''
LFSR_DATA_BUF("C", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 3);
@@ -969,7 +969,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -983,7 +983,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -991,7 +991,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == N);
@@ -1042,7 +1042,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1089,7 +1089,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == N);
@@ -1139,7 +1139,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1153,7 +1153,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1161,7 +1161,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == N*W);
@@ -1228,7 +1228,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1294,7 +1294,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -1377,7 +1377,7 @@ code = '''
lfsr_btree_pop(&lfs, &btree, 0) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 0);
@@ -1394,7 +1394,7 @@ code = '''
LFSR_DATA_BUF("A", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -1433,7 +1433,7 @@ code = '''
lfsr_btree_pop(&lfs, &btree, 1) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -1456,7 +1456,7 @@ code = '''
LFSR_DATA_BUF("B", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -1501,7 +1501,7 @@ code = '''
lfsr_btree_pop(&lfs, &btree, 0) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -1524,7 +1524,7 @@ code = '''
LFSR_DATA_BUF("A", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -1571,7 +1571,7 @@ code = '''
lfsr_btree_pop(&lfs, &btree, 2) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -1600,7 +1600,7 @@ code = '''
LFSR_DATA_BUF("C", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 3);
@@ -1654,7 +1654,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1667,7 +1667,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1676,7 +1676,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == REMAINING);
@@ -1746,7 +1746,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1759,7 +1759,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1767,7 +1767,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == REMAINING);
@@ -1839,7 +1839,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1887,7 +1887,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -1938,7 +1938,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1951,7 +1951,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -1959,7 +1959,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == REMAINING*W);
@@ -2079,7 +2079,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
return;
}
@@ -2136,7 +2136,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -2228,7 +2228,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n);
@@ -2318,7 +2318,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -2377,7 +2377,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n*W);
@@ -2518,7 +2518,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -2621,7 +2621,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -2687,7 +2687,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -2748,7 +2748,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -2818,7 +2818,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -2932,7 +2932,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -3074,7 +3074,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -3150,7 +3150,7 @@ code = '''
lfsr_btree_alloc(&lfs, &btree) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 0);
@@ -3188,7 +3188,7 @@ code = '''
LFSR_ATTR(0, DATA, 0, BUF("0", 1)))) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 1);
@@ -3244,7 +3244,7 @@ code = '''
LFSR_TAG_DATA, 1, LFSR_DATA_BUF("1", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 2);
@@ -3312,7 +3312,7 @@ code = '''
LFSR_TAG_DATA, 1, LFSR_DATA_BUF("2", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 3);
@@ -3388,7 +3388,7 @@ code = '''
LFSR_TAG_DATA, 1, LFSR_DATA_BUF("1", 1)) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == 3);
@@ -3478,7 +3478,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n);
@@ -3593,7 +3593,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -3665,7 +3665,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n*W);
@@ -3808,7 +3808,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -3991,7 +3991,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -4193,7 +4193,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
lfs_size_t total_weight = 0;
@@ -4264,7 +4264,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == n);
@@ -4306,10 +4306,11 @@ code = '''
binfo.bid,
binfo.tag,
binfo.weight,
binfo.u.rbyd.block, binfo.u.rbyd.trunk);
binfo.u.rbyd.blocks[0], binfo.u.rbyd.trunk);
// keep track of seen blocks
seen[binfo.u.rbyd.block / 8] |= 1 << (binfo.u.rbyd.block % 8);
seen[binfo.u.rbyd.blocks[0] / 8]
|= 1 << (binfo.u.rbyd.blocks[0] % 8);
} else if (binfo.tag == LFSR_TAG_DATA) {
printf("traversal: %d 0x%x w%d data %d\n",
@@ -4417,7 +4418,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
@@ -4458,10 +4459,11 @@ code = '''
binfo.bid,
binfo.tag,
binfo.weight,
binfo.u.rbyd.block, binfo.u.rbyd.trunk);
binfo.u.rbyd.blocks[0], binfo.u.rbyd.trunk);
// keep track of seen blocks
seen[binfo.u.rbyd.block / 8] |= 1 << (binfo.u.rbyd.block % 8);
seen[binfo.u.rbyd.blocks[0] / 8]
|= 1 << (binfo.u.rbyd.blocks[0] % 8);
} else if (binfo.tag == LFSR_TAG_DATA) {
printf("traversal: %d 0x%x w%d data %d\n",
@@ -4506,7 +4508,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.block,
btree.blocks[0],
btree.trunk);
assert(btree.weight == sim_size);
+89 -115
View File
@@ -2741,14 +2741,10 @@ code = '''
// this test only works if these all fit in the mroot
assert(lfsr_mtree_ismptr(&lfs));
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=0,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=1,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=0, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2795,14 +2791,10 @@ code = '''
// this test only works if these all fit in the mroot
assert(lfsr_mtree_ismptr(&lfs));
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=0,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=1,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=0, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2842,14 +2834,10 @@ code = '''
// this test only works if these all fit in the mroot
assert(lfsr_mtree_ismptr(&lfs));
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=0,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=1,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=0, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2891,14 +2879,10 @@ code = '''
// this test only works if these all fit in the mroot
assert(lfsr_mtree_ismptr(&lfs));
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=0,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=1,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=0, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2975,14 +2959,10 @@ code = '''
// this test only works if these all fit in the mroot
assert(lfsr_mtree_ismptr(&lfs));
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=0,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=1,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=0, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3081,14 +3061,10 @@ code = '''
assert(lfsr_mtree_weight(&lfs) == 1*lfsr_mweight(&lfs));
assert(mdir.rbyd.weight == 3);
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=mdir.mid+0,
.blocks={mdir.blocks[0], mdir.blocks[1]},
.rbyd=mdir.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=mdir.mid+2,
.blocks={mdir.blocks[0], mdir.blocks[1]},
.rbyd=mdir.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=mdir.mid+0, .rbyd=mdir.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=mdir.mid+2, .rbyd=mdir.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3162,14 +3138,10 @@ code = '''
// this test only works if these all fit in the mroot
assert(lfsr_mtree_ismptr(&lfs));
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=0,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=1,
.blocks={lfs.mroot.blocks[0], lfs.mroot.blocks[1]},
.rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=0, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3259,14 +3231,10 @@ code = '''
assert(lfsr_mtree_weight(&lfs) == 1*lfsr_mweight(&lfs));
assert(mdir.rbyd.weight == 3);
lfsr_openedmdir_t left_neighbor = {.mdir={
.mid=mdir.mid+0,
.blocks={mdir.blocks[0], mdir.blocks[1]},
.rbyd=mdir.rbyd}};
lfsr_openedmdir_t right_neighbor = {.mdir={
.mid=mdir.mid+2,
.blocks={mdir.blocks[0], mdir.blocks[1]},
.rbyd=mdir.rbyd}};
lfsr_openedmdir_t left_neighbor = {
.mdir={.mid=mdir.mid+0, .rbyd=mdir.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=mdir.mid+2, .rbyd=mdir.rbyd}};
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3542,22 +3510,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -3657,22 +3626,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -3784,22 +3754,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -3903,22 +3874,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -4033,22 +4005,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -4192,22 +4165,23 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
// keep track of seen blocks
seen[tinfo.u.mdir.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.blocks[1] % 8);
seen[tinfo.u.mdir.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.blocks[0] % 8);
seen[tinfo.u.mdir.rbyd.blocks[1] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[1] % 8);
seen[tinfo.u.mdir.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.mdir.rbyd.blocks[0] % 8);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
} else {
// this shouldn't happen
@@ -4289,13 +4263,13 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
} else {
// this shouldn't happen
+533 -533
View File
File diff suppressed because it is too large Load Diff