forked from Imagelibrary/littlefs
Still missing quite a bit, but rudimentary inlined-trees are now working
And by working, I mean you can create inlined trees, just don't compact/split/move/etc anything. But this does outline the path files take when writing buffers into inlined trees. "Inlined trees" in littlefs are entire small rbyd trees embedded as secondary trees in an mdir's main rbyd tree. When fetching, we can indicate if a given trunk belongs to the main tree or secondary tree by setting one of the unused mode bits in the trunk's tag, now called the "deferred" bit. This bit doesn't need to be included in the alt's "key" field, so there's no issue with it conflicting with the alt's mode bits. This requires a bit of tweaking lfsr_rbyd_fetch, since it needs to fall back to the previous trunk if it discovers the most recent trunk belongs to an inlined tree. But as a benefit we can leverage the full power of rbyds in inlined files, including holes, partial updates, etc. One downside is it looks like these inlined trees may involve more work in maintining their state correctly, since they need to be sort of "brought along" when mdirs are compacted, even if they don't actually have a reference in the mdir yet. But the sheer amount of flexibility this gives inlined files may make this overhead worth it.
This commit is contained in:
@@ -32,6 +32,7 @@ TAG_REG = 0x0202
|
||||
TAG_DIR = 0x0203
|
||||
TAG_STRUCT = 0x0300
|
||||
TAG_INLINED = 0x0300
|
||||
TAG_TRUNK = 0x0304
|
||||
TAG_BLOCK = 0x0308
|
||||
TAG_BTREE = 0x030c
|
||||
TAG_MDIR = 0x0311
|
||||
@@ -178,6 +179,7 @@ def tagrepr(tag, w, size, off=None):
|
||||
elif (tag & 0xff00) == TAG_STRUCT:
|
||||
return '%s%s %d' % (
|
||||
'inlined' if tag == TAG_INLINED
|
||||
else 'trunk' if tag == TAG_TRUNK
|
||||
else 'block' if tag == TAG_BLOCK
|
||||
else 'btree' if tag == TAG_BTREE
|
||||
else 'mdir' if tag == TAG_MDIR
|
||||
|
||||
Reference in New Issue
Block a user