Added lfs_rbyd_rangesize (untested), some cleanup

Toying around with the idea that since rbyd trees have strict height
gaurantees after compaction (2*log2(n)+1), we can proactively calculate
the maximum on-disk space required for a worst case tree+leb128
encoding.

This would _greatly_ simplify things such as metadata compaction and
splitting, and allow unstorable file metadata (too many custom
attributes) to error early.

One issue is that this calculated worst case will likely be ~4-5x worst
than the actual encoding due to leb128 compression. Though this may be an
acceptable tradeoff for the simplification and more reliable behavior.
This commit is contained in:
Christopher Haster
2023-01-17 13:26:53 -06:00
parent 4aabb8f631
commit 8581eec433
3 changed files with 77 additions and 21 deletions
+2 -2
View File
@@ -1601,7 +1601,7 @@ code = '''
printf("] ---\n");
// build the attribute list for the current permutation
struct lfs_rattr attrs[N];
struct lfsr_attr attrs[N];
for (unsigned j = 0; j < N; j++) {
attrs[j] = *LFSR_ATTR2(
UATTR, perm[j]+1, -1,
@@ -2961,7 +2961,7 @@ code = '''
printf("] ---\n");
// build the attribute list for the current permutation
struct lfs_rattr attrs[N];
struct lfsr_attr attrs[N];
for (unsigned j = 0; j < N; j++) {
// adjust id based on future insertions
uint16_t id = perm[j];