bmap: Taught littlefs how to traverse the gbmap

Fortunately the btree traversal logic is pretty reusable, so this just
required an additional tstate (LFS3_TSTATE_BMAP).

This raises an interesting question: _when_ do we traverse the bmap? We
need to wait until at least mtree traversal completes for gstate to be
reconstructed during lfs3_mount, but I think traversing before file
btrees makes sense.
This commit is contained in:
Christopher Haster
2025-07-24 00:16:14 -05:00
parent 1537f6a430
commit 59a4ae6f61
2 changed files with 37 additions and 15 deletions
+7 -6
View File
@@ -162,12 +162,13 @@ FLAGS = [
0x00000000, "Tstate = mroot-anchor" ),
('^_MROOTCHAIN', 0x00010000, "Tstate = mroot-chain" ),
('^_MTREE', 0x00020000, "Tstate = mtree" ),
('^_MDIRS', 0x00030000, "Tstate = mtree-mdirs" ),
('^_MDIR', 0x00040000, "Tstate = mdir" ),
('^_BTREE', 0x00050000, "Tstate = btree" ),
('^_HANDLES', 0x00060000, "Tstate = open-mdirs" ),
('^_HBTREE', 0x00070000, "Tstate = open-btree" ),
('^_DONE', 0x00080000, "Tstate = done" ),
('^_BMAP', 0x00030000, "Tstate = bmap" ),
('^_MDIRS', 0x00040000, "Tstate = mtree-mdirs" ),
('^_MDIR', 0x00050000, "Tstate = mdir" ),
('^_BTREE', 0x00060000, "Tstate = btree" ),
('^_HANDLES', 0x00070000, "Tstate = open-mdirs" ),
('^_HBTREE', 0x00080000, "Tstate = open-btree" ),
('^_DONE', 0x00090000, "Tstate = done" ),
('t_BTYPE', 0x00f00000, "The current block type" ),
('^_MDIR', 0x00100000, "Btype = mdir" ),
('^_BTREE', 0x00200000, "Btype = btree" ),