Reimplemented the block-allocator over mtree traversal
Took the opportunity to make some allocator tweaks: - Renamed lfs.free -> lfs.lookahead, it's previous name did cause some confusion. - Renamed lfs.free.off -> lfs.lookahead.start - Renamed lfs.free.i -> lfs.lookahead.next - Renamed lfs.free.ack -> lfs.lookahead.acked - Changed bitmap from using 32-bit words to using 8-bit bytes, dropping the alignment requirement. One of the reasons for 32-bit alignment was an attempt at future proofing for some sort of free-list. This never landed, and if it did, it could have been provided without breaking backwards compatiblity via an additional config option, at a minor RAM cost. We never used ffs/clz instructions for this bitmap, so I don't think using 32-bit words offers much advantage. It just creates another potential issue for users if their lookahead buffer is unaligned. These changes should probably also be upstreamed to the current version. They don't depend on anything rbyd specific. Note, at some point lfs_alloc will need to be extended to mark block tags, etc, as in-use during traversal.
This commit is contained in:
@@ -1,3 +1,177 @@
|
||||
|
||||
# Tests covering properties of the block allocator
|
||||
|
||||
# TODO test all of these with weird block sizes? would be nice to make this
|
||||
# easy via the test_runner, either by handling it there or letting a single
|
||||
# config limit the block count by a couple blocks
|
||||
|
||||
# test that we can alloc
|
||||
[cases.test_alloc_blocks]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
|
||||
// start allocating
|
||||
lfs_alloc_ack(&lfs);
|
||||
lfs_size_t alloced = 0;
|
||||
while (true) {
|
||||
lfs_block_t block;
|
||||
int err = lfs_alloc(&lfs, &block);
|
||||
assert(!err || err == LFS_ERR_NOSPC);
|
||||
|
||||
if (err == LFS_ERR_NOSPC) {
|
||||
break;
|
||||
}
|
||||
alloced += 1;
|
||||
|
||||
// our allocator should stop at some point...
|
||||
assert(alloced < 2*BLOCK_COUNT);
|
||||
}
|
||||
|
||||
// excluding our mroot, we should have allocated exactly
|
||||
// block_count-2 blocks
|
||||
printf("alloced %d/%d blocks\n", alloced, (lfs_block_t)BLOCK_COUNT);
|
||||
assert(alloced == BLOCK_COUNT-2);
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# test that we can realloc after an ack
|
||||
[cases.test_alloc_reuse]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
|
||||
// start allocating
|
||||
lfs_alloc_ack(&lfs);
|
||||
lfs_size_t alloced = 0;
|
||||
while (true) {
|
||||
lfs_block_t block;
|
||||
int err = lfs_alloc(&lfs, &block);
|
||||
assert(!err || err == LFS_ERR_NOSPC);
|
||||
|
||||
if (err == LFS_ERR_NOSPC) {
|
||||
break;
|
||||
}
|
||||
alloced += 1;
|
||||
|
||||
// our allocator should stop at some point...
|
||||
assert(alloced < 2*BLOCK_COUNT);
|
||||
}
|
||||
|
||||
// excluding our mroot, we should have allocated exactly
|
||||
// block_count-2 blocks
|
||||
printf("alloced %d/%d blocks\n", alloced, (lfs_block_t)BLOCK_COUNT);
|
||||
assert(alloced == BLOCK_COUNT-2);
|
||||
|
||||
// ack again, effectively releasing all the previously alloced blocks
|
||||
lfs_alloc_ack(&lfs);
|
||||
alloced = 0;
|
||||
while (true) {
|
||||
lfs_block_t block;
|
||||
int err = lfs_alloc(&lfs, &block);
|
||||
assert(!err || err == LFS_ERR_NOSPC);
|
||||
|
||||
if (err == LFS_ERR_NOSPC) {
|
||||
break;
|
||||
}
|
||||
alloced += 1;
|
||||
|
||||
// our allocator should stop at some point...
|
||||
assert(alloced < 2*BLOCK_COUNT);
|
||||
}
|
||||
|
||||
// excluding our mroot, we should have allocated exactly
|
||||
// block_count-2 blocks
|
||||
printf("alloced %d/%d blocks\n", alloced, (lfs_block_t)BLOCK_COUNT);
|
||||
assert(alloced == BLOCK_COUNT-2);
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
# test that we can alloc an mtree, the difference between this and mtree tests
|
||||
# is we expect this to be able to handle wrap-around
|
||||
[cases.test_alloc_mtree]
|
||||
in = 'lfs.c'
|
||||
code = '''
|
||||
const char *alphas = "abcdefghijklmnopqrstuvwxyz";
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
|
||||
lfsr_mdir_t mdir;
|
||||
lfsr_mtree_lookup(&lfs, lfsr_mtree_weight(&lfs)-1, &mdir) => 0;
|
||||
lfs_ssize_t rid = 0;
|
||||
|
||||
lfs_size_t count = 0;
|
||||
while (true) {
|
||||
// at least try to catch infinite loops
|
||||
assert(count < BLOCK_SIZE * BLOCK_COUNT/2);
|
||||
|
||||
// ack before each commit to reset the allocator
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// keep creating new metadata entries until we run out of space
|
||||
int err = lfsr_mdir_commit(&lfs, &mdir, &rid, LFSR_ATTRS(
|
||||
LFSR_ATTR(rid, INLINED, +1, &alphas[count % 26], 1)));
|
||||
assert(!err || err == LFS_ERR_NOSPC);
|
||||
if (err == LFS_ERR_NOSPC) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t buffer[4];
|
||||
lfsr_mdir_get(&lfs, &mdir, rid, LFSR_TAG_INLINED,
|
||||
buffer, 4) => 1;
|
||||
assert(memcmp(buffer, &alphas[count % 26], 1) == 0);
|
||||
|
||||
count += 1;
|
||||
rid += 1;
|
||||
}
|
||||
|
||||
printf("alloced %d metadata entries in %d blocks\n",
|
||||
count, (lfs_block_t)BLOCK_COUNT);
|
||||
|
||||
// test that all of our metadata entries are still there
|
||||
lfs_size_t i = 0;
|
||||
for (lfs_ssize_t mid = (lfsr_mtree_isinlined(&lfs) ? -1 : 0);
|
||||
mid < lfsr_mtree_weight(&lfs);
|
||||
mid++) {
|
||||
lfsr_mdir_t mdir;
|
||||
lfsr_mtree_lookup(&lfs, mid, &mdir) => 0;
|
||||
for (lfs_ssize_t rid = 0;
|
||||
rid < (lfs_ssize_t)lfsr_mdir_weight(&mdir);
|
||||
rid++) {
|
||||
uint8_t buffer[4];
|
||||
lfsr_mdir_get(&lfs, &mdir, rid, LFSR_TAG_INLINED,
|
||||
buffer, 4) => 1;
|
||||
assert(memcmp(buffer, &alphas[i % 26], 1) == 0);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
assert(i == count);
|
||||
|
||||
lfsr_unmount(&lfs) => 0;
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## allocator tests
|
||||
## note for these to work there are a number constraints on the device geometry
|
||||
#if = 'BLOCK_CYCLES == -1'
|
||||
|
||||
+184
-184
@@ -11,11 +11,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an empty tree
|
||||
@@ -42,11 +42,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -81,11 +81,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -127,11 +127,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -174,11 +174,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -228,11 +228,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -285,11 +285,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -337,11 +337,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -402,11 +402,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -486,11 +486,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -568,11 +568,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -707,11 +707,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -748,11 +748,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -799,11 +799,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -861,11 +861,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -944,11 +944,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -1039,11 +1039,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -1139,11 +1139,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -1289,11 +1289,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -1342,11 +1342,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -1409,11 +1409,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -1476,11 +1476,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -1560,11 +1560,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -1651,11 +1651,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -1754,11 +1754,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -1852,11 +1852,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -1982,11 +1982,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -2142,11 +2142,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -2211,11 +2211,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -2300,11 +2300,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -2370,11 +2370,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -2532,11 +2532,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -2660,11 +2660,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -2832,11 +2832,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a zero-entry tree
|
||||
@@ -2863,11 +2863,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a single-entry tree
|
||||
@@ -2910,11 +2910,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -2968,11 +2968,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -3037,11 +3037,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a two-entry tree
|
||||
@@ -3107,11 +3107,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -3184,11 +3184,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -3292,11 +3292,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -3371,11 +3371,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -3532,11 +3532,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -3717,11 +3717,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
@@ -3939,11 +3939,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a tree with N elements
|
||||
@@ -4070,11 +4070,11 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfs_init(&lfs, cfg) => 0;
|
||||
// create free lookahead
|
||||
memset(lfs.free.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.free.off = 0;
|
||||
lfs.free.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
memset(lfs.lookahead.buffer, 0, lfs.cfg->lookahead_size);
|
||||
lfs.lookahead.start = 0;
|
||||
lfs.lookahead.size = lfs_min(8*lfs.cfg->lookahead_size,
|
||||
lfs.cfg->block_count);
|
||||
lfs.free.i = 0;
|
||||
lfs.lookahead.next = 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create a btree
|
||||
|
||||
@@ -20,6 +20,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -58,6 +59,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
// force mroot to compact
|
||||
@@ -99,6 +101,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
for (lfs_size_t i = 0; i < N; i++) {
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -141,6 +144,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -212,6 +216,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -282,6 +287,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -380,6 +386,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create entries
|
||||
lfsr_mdir_t mdir;
|
||||
@@ -473,6 +480,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -577,6 +585,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -643,6 +652,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -712,6 +722,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -768,6 +779,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an mdir that needs to be split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -832,6 +844,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an mdir that needs to be split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -896,6 +909,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an mdir that needs to be split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -943,6 +957,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1034,6 +1049,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1125,6 +1141,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1203,6 +1220,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create entries
|
||||
lfsr_mdir_t mdir;
|
||||
@@ -1298,6 +1316,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
for (lfs_size_t cycle = 0; cycle < CYCLES; cycle++) {
|
||||
// create entries
|
||||
@@ -1392,6 +1411,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -1521,6 +1541,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1613,6 +1634,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1704,6 +1726,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1795,6 +1818,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1851,6 +1875,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1906,6 +1931,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -1970,6 +1996,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2073,6 +2100,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2183,6 +2211,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create an uninlined mdir
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -2262,6 +2291,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// force mroot to compact once, so the second compact below will trigger
|
||||
// a relocation
|
||||
@@ -2347,6 +2377,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// force mroot to compact once, so the second compact below will trigger
|
||||
// a relocation
|
||||
@@ -2443,6 +2474,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -2580,6 +2612,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -2664,6 +2697,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -2705,6 +2739,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -2774,6 +2809,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -2843,6 +2879,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -2936,6 +2973,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -2997,6 +3035,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// setup our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -3085,6 +3124,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// insert a new entry, this should update our neighbors
|
||||
lfsr_mdir_commit(&lfs, &lfs.mroot, &(lfs_ssize_t){-1}, LFSR_ATTRS(
|
||||
@@ -3181,6 +3221,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with a large attr so the next entry can not fit
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3310,6 +3351,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create 2 large entries that needs to be uninlined and split
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3441,6 +3483,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3551,6 +3594,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// create entries
|
||||
lfsr_mdir_t mdir;
|
||||
@@ -3701,6 +3745,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// at least keep track of the number of entries we expect
|
||||
lfs_size_t count = 0;
|
||||
@@ -3860,6 +3905,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
uint8_t buffer[LFSR_MPTR_DSIZE];
|
||||
lfs_ssize_t d = lfsr_mptr_todisk(&lfs, LFSR_MPTR_MROOTANCHOR, buffer);
|
||||
@@ -3944,6 +3990,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
@@ -3998,6 +4045,7 @@ code = '''
|
||||
lfs_t lfs;
|
||||
lfsr_format(&lfs, cfg) => 0;
|
||||
lfsr_mount(&lfs, cfg) => 0;
|
||||
lfs_alloc_ack(&lfs);
|
||||
|
||||
// prepare mroot with an attr
|
||||
uint8_t buffer[SIZE];
|
||||
|
||||
Reference in New Issue
Block a user