mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-26 09:08:30 +00:00
Fixed new bshrub roots and related bug fixing
It turned out by implicitly handling root allocation in lfsr_btree_commit_, we were never allowing lfsr_bshrub_commit to intercept new roots as new bshrubs. Fixing this required moving the root allocation logic up into lfsr_btree_commit. This resulted in quite a bit of small bug fixing because it turns out if you can never create non-inlined bshrubs you never test non-inlined bshrubs: - Our previous rbyd.weight == btree.weight check for if we've reached the root no longer works, changed to an explicit check that the blocks match. Fortunately, now that new roots set trunk=0 new roots are no longer a problematic case. - We need to only evict when we calculate an accurate estimate, the previous code had a bug where eviction occurred early based only on the progged-since-last-estimate. - We need to manually set bshrub.block=mdir.block on new bshrubs, otherwise the lfsr_bshrub_isbshrub check fails in mdir commit staging. Also updated btree/bshrub following code in the dbg scripts, which mostly meant making them accept both BRANCH and SHRUBBRANCH tags as btree/bshrub branches. Conveniently very little code needs to change to extend btree read operations to support bshrubs.
This commit is contained in:
@@ -910,7 +910,7 @@ class Rbyd:
|
||||
rid_, w = rid__, w_
|
||||
|
||||
# catch any branches
|
||||
if tag == TAG_BRANCH:
|
||||
if tag & 0xfff == TAG_BRANCH:
|
||||
branch = (tag, j, d, data)
|
||||
|
||||
tags.append((tag, j, d, data))
|
||||
@@ -1017,7 +1017,10 @@ class Rbyd:
|
||||
))
|
||||
|
||||
d_ += max(bdepths.get(d, 0), 1)
|
||||
leaf = (bid-(w-1), d, rid-(w-1), TAG_BRANCH)
|
||||
leaf = (bid-(w-1), d, rid-(w-1),
|
||||
next((tag for tag, _, _, _ in tags
|
||||
if tag & 0xfff == TAG_BRANCH),
|
||||
TAG_BRANCH))
|
||||
|
||||
# remap branches to leaves if we aren't showing inner branches
|
||||
if not inner:
|
||||
|
||||
Reference in New Issue
Block a user