trussed-dev / littlefs2

Idiomatic Rust API for littlefs

Home Page:https://lib.rs/littlefs2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve iteration capability

sosthene-nitrokey opened this issue · comments

Iteration over a directory is not very efficient, as it can't be safely paused and resumed.
This leads to issues. For example in trussed, as a consequence the iteration happens at a speed of $O(n^2)$ because of this: https://github.com/trussed-dev/trussed/blob/main/src/store/filestore.rs#L335

The raw c API exposes a lfs_dir_tell, which littlefs can use to "store" the current iteration position and return to using lfs_dir_seek

Trying to implement it lead to discovering a bug in littelfs: littlefs-project/littlefs#785