Solved rbyd grow/insert ambiguity by adding a device-only "mk" bit

This "mk" bit must not be written to disk, it would conflict with the
other non-tree tag encodings. But we can use this bit in the context of
lfsr_tag_append to disambiguate tags changing weight from inserting new
tags.

Note that in the context of rbyd compactions, this will make things a bit
weird, since it's no longer just a direct one-to-one copy of each tag.

To make compactions a bit easier, this implementation allows the "mk"
bit to be set on any tag and ignores it when the weight delta is zero.

It turns out that this scheme greatly simplifies the awkward
leaf-split-alt calculation that previously had several if statements to
handle different corner cases, with the caveat that "mk" tags need their
ids adjusted by +1. Added this adjustment directly into lfsr_rbyd_append
for now, so the upper-level interface can be a bit more intuitive.
Though this may need to change later if it is more confusing than
helpful.
This commit is contained in:
Christopher Haster
2023-03-30 15:28:28 -05:00
parent 5a1c36f210
commit 85bd28951c
3 changed files with 342 additions and 327 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ def show_log(block_size, data, rev, off, *,
if not tag & 0x2:
# attach tag to lifetime
i, id_ = index(weights, lower_)
i, id_ = index(weights, id)
if i < len(weights):
lifetimes[i].add(j)