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

Assertion on minimum block size < 128 bytes #63

Open
jnz86 opened this issue Mar 10, 2024 · 1 comment
Open

Assertion on minimum block size < 128 bytes #63

jnz86 opened this issue Mar 10, 2024 · 1 comment

Comments

@jnz86
Copy link

jnz86 commented Mar 10, 2024

There is an assertion that prevents the blocksize from being set lower than 128 bytes.

I have reasons, but I was trying to set a block size lower than that.

lfs: littlefs/lfs.c:4186: lfs_init: Assertion lfs->cfg->block_size >= 128' failed.`

Does LittleFS have that same limitation?

@geky
Copy link
Member

geky commented Mar 11, 2024

Hi @jnz86,

You're welcome to comment out that line, but the filesystem may break in unexpected ways.

You may also need to comment out the following assert which checks the CTZ skip-list related limit explicitly: here.

The 128 byte limit was chosen as it's the maximum number of pointers in a single-block in our CTZ skip-list data structure (more info here). littlefs doesn't check if this overflows, so if you create a large enough file, ~2GiB, with small blocks, this can break.

I would also be a bit concerned with metadata fitting with such small blocks. If there isn't enough space for global-state + tail-pointers in an mdir the filesystem might break in unexpected ways in hard to reach cases.


Out of curiosity what is the motivation for such small blocks? I'm assuming this is RAM/NVRAM/EEPROM?

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

No branches or pull requests

2 participants