Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

littlefs don't read config information from the superblock #505

Open
lucckb opened this issue Dec 17, 2020 · 1 comment
Open

littlefs don't read config information from the superblock #505

lucckb opened this issue Dec 17, 2020 · 1 comment

Comments

@lucckb
Copy link

lucckb commented Dec 17, 2020

When mount existing filesystem littlefs library assumes that block size and block count is given during configuration time. Block size and number of blocks are stored in the superblock and when existing filesystem is mounted config should be updated from the super block structure instead of use default values from the config struct. config block_size blocks_count should be only used only when the blocks_size and count isn't know for example when lfs_format is used

@lucckb lucckb changed the title littlefs don't read config information from superblock littlefs don't read config information from the superblock Dec 17, 2020
@geky
Copy link
Member

geky commented Dec 18, 2020

This is something that's been looked at, but it's a bit more complicated than it first appears: #349

There's a sort of chicken-and-egg problem where littlefs needs to know the block_size in order to read the superblock. So reading the block_size requires knowing the block_size, which is a bit of a problem. There's some ideas around scanning the block device to find a valid superblock, but the problem there is that such a scan may have to read the entire disk if lfs_mount fails.

The block_count, on the other hand, is pretty easy to read, it just hasn't been a priority since usually block_count is provided by partition information anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants