Attempted alternate redund block layout in lfsr_mdir_t

The idea here is to revert moving redund blocks into lfsr_rbyd_t, and
instead just keep a redundant copy of the rbyd blocks in the redund
blocks in lfsr_mdir_t.

Surprisingly, extra overhead in lfsr_mdir_t ended up with worse stack
usage than extra overhead in lfsr_rbyd_t. I guess we end up allocated
more mdirs than rbyds, which makes a bit of sense given how complicated
lfsr_mdir_commit is:

                    code          stack          structs
  redund union:    30976           2496             1072
  redund in rbyd:  30948 (-0.1%)   2528 (+1.3%)     1100 (+2.6%)
  redund in mdir:  31000 (+0.1%)   2536 (+1.6%)     1092 (+1.8%)

The mdir option does seem to improve struct overhead, but this hasn't
been a reliable measurement since it doesn't take into account how many
of each struct is allocated.

Given that the mdir option is inferior in both code and stack cost, and
requires more care to keep the rbyd/redund blocks in sync, I think I'm
going to revert this for now but keep the commit in the commit history
since it's an interesting comparison.
This commit is contained in:
Christopher Haster
2023-11-26 11:39:13 -06:00
parent becbc0c2ad
commit 9d182c2055
6 changed files with 847 additions and 810 deletions
+24 -27
View File
@@ -176,23 +176,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -333,23 +332,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else if (tinfo.tag == LFSR_TAG_BLOCK) {
printf("traversal: 0x%x block 0x%x\n",
@@ -480,23 +478,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else if (tinfo.tag == LFSR_TAG_BLOCK) {
printf("traversal: 0x%x block 0x%x\n",
+73 -75
View File
@@ -120,7 +120,7 @@ code = '''
lfsr_btree_alloc(&lfs, &btree) => 0;
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == 3);
@@ -412,7 +412,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == n);
@@ -465,7 +465,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == n);
@@ -549,7 +549,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == sim_size);
@@ -605,7 +605,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -983,7 +983,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -991,7 +991,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1089,7 +1089,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1153,7 +1153,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1161,7 +1161,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1294,7 +1294,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1667,7 +1667,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1676,7 +1676,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1759,7 +1759,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1767,7 +1767,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1887,7 +1887,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1951,7 +1951,7 @@ code = '''
if (err == LFS_ERR_NOSPC) {
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -1959,7 +1959,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
return;
}
@@ -2136,7 +2136,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
lfs_size_t total_weight = 0;
@@ -2228,7 +2228,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == n);
@@ -2318,7 +2318,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == sim_size);
@@ -2377,7 +2377,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
lfs_size_t total_weight = 0;
@@ -2621,7 +2621,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == 1);
@@ -2687,7 +2687,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == 1);
@@ -2748,7 +2748,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == 1);
@@ -2818,7 +2818,7 @@ code = '''
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == 1);
@@ -2932,7 +2932,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == 3);
@@ -3478,7 +3478,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == n);
@@ -3593,7 +3593,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == sim_size);
@@ -3665,7 +3665,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
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.blocks[0],
btree.block,
btree.trunk);
lfs_size_t total_weight = 0;
@@ -4264,7 +4264,7 @@ code = '''
}
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == n);
@@ -4306,11 +4306,10 @@ code = '''
binfo.bid,
binfo.tag,
binfo.weight,
binfo.u.rbyd.blocks[0], binfo.u.rbyd.trunk);
binfo.u.rbyd.block, binfo.u.rbyd.trunk);
// keep track of seen blocks
seen[binfo.u.rbyd.blocks[0] / 8]
|= 1 << (binfo.u.rbyd.blocks[0] % 8);
seen[binfo.u.rbyd.block / 8] |= 1 << (binfo.u.rbyd.block % 8);
} else if (binfo.tag == LFSR_TAG_DATA) {
printf("traversal: %d 0x%x w%d data %d\n",
@@ -4418,7 +4417,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == sim_size);
@@ -4459,11 +4458,10 @@ code = '''
binfo.bid,
binfo.tag,
binfo.weight,
binfo.u.rbyd.blocks[0], binfo.u.rbyd.trunk);
binfo.u.rbyd.block, binfo.u.rbyd.trunk);
// keep track of seen blocks
seen[binfo.u.rbyd.blocks[0] / 8]
|= 1 << (binfo.u.rbyd.blocks[0] % 8);
seen[binfo.u.rbyd.block / 8] |= 1 << (binfo.u.rbyd.block % 8);
} else if (binfo.tag == LFSR_TAG_DATA) {
printf("traversal: %d 0x%x w%d data %d\n",
@@ -4508,7 +4506,7 @@ code = '''
printf("]\n");
printf("btree: w%d 0x%x.%x\n",
btree.weight,
btree.blocks[0],
btree.block,
btree.trunk);
assert(btree.weight == sim_size);
+115 -89
View File
@@ -2741,10 +2741,14 @@ 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, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2791,10 +2795,14 @@ 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, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2834,10 +2842,14 @@ 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, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2879,10 +2891,14 @@ 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, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -2959,10 +2975,14 @@ 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, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3061,10 +3081,14 @@ 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, .rbyd=mdir.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=mdir.mid+2, .rbyd=mdir.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3138,10 +3162,14 @@ 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, .rbyd=lfs.mroot.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=1, .rbyd=lfs.mroot.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3231,10 +3259,14 @@ 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, .rbyd=mdir.rbyd}};
lfsr_openedmdir_t right_neighbor = {
.mdir={.mid=mdir.mid+2, .rbyd=mdir.rbyd}};
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_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &left_neighbor);
lfsr_mdir_addopened(&lfs, LFS_TYPE_INTERNAL, &right_neighbor);
@@ -3510,23 +3542,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -3626,23 +3657,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -3754,23 +3784,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -3874,23 +3903,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -4005,23 +4033,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -4165,23 +4192,22 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
// keep track of seen blocks
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);
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);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
// keep track of seen blocks
seen[tinfo.u.rbyd.blocks[0] / 8]
|= 1 << (tinfo.u.rbyd.blocks[0] % 8);
seen[tinfo.u.rbyd.block / 8] |= 1 << (tinfo.u.rbyd.block % 8);
} else {
// this shouldn't happen
@@ -4263,13 +4289,13 @@ code = '''
if (tinfo.tag == LFSR_TAG_MDIR) {
printf("traversal: 0x%x mdir 0x{%x,%x}\n",
tinfo.tag,
tinfo.u.mdir.rbyd.blocks[0],
tinfo.u.mdir.rbyd.blocks[1]);
tinfo.u.mdir.blocks[0],
tinfo.u.mdir.blocks[1]);
} else if (tinfo.tag == LFSR_TAG_BRANCH) {
printf("traversal: 0x%x btree 0x%x.%x\n",
tinfo.tag,
tinfo.u.rbyd.blocks[0], tinfo.u.rbyd.trunk);
tinfo.u.rbyd.block, tinfo.u.rbyd.trunk);
} else {
// this shouldn't happen
+533 -533
View File
File diff suppressed because it is too large Load Diff