Skip to content

Conversation

@geky
Copy link
Member

@geky geky commented Sep 29, 2025

As noted by @amgross, the current inline_max default (when littlefs switches from inline files to CTZ skip-lists) does not match the theoretical value in DESIGN.md.

The reason for this is 1/8 was chosen as a safer default during development, due to concerns that 1/4 + mdirs splitting at 1/2 would lead to poor distribution of large inline files in mdirs.

However, two things have happened since then:

  1. Experiments have show "wasted" mdir space is less of a concern than initially thought. Extra mdir space contributes to logging, delays mdir compaction, and can overall lead to better performance.

  2. inline_size was added as a configuration option (#914), so if 1/4 is problematic users can always override it.

So bumping this back up to 1/4 may make sense. Though open to feedback if this is worthwhile in the shadow of littlefs3.

Related: #1145

Note this is actually already bumped to 1/4 in littlefs3 (#1111, unstable).

@geky geky added enhancement needs minor version new functionality only allowed in minor versions next minor labels Sep 29, 2025
@geky-bot
Copy link
Collaborator

Tests passed ✓, Code: 17112 B (+0.0%), Stack: 1448 B (+0.0%), Structs: 812 B (+0.0%)
Code Stack Structs Coverage
Default 17112 B (+0.0%) 1448 B (+0.0%) 812 B (+0.0%) Lines 2435/2595 lines (-0.0%)
Readonly 6230 B (+0.0%) 448 B (+0.0%) 812 B (+0.0%) Branches 1283/1616 branches (+0.0%)
Threadsafe 17964 B (+0.0%) 1448 B (+0.0%) 820 B (+0.0%) Benchmarks
Multiversion 17184 B (+0.0%) 1448 B (+0.0%) 816 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18776 B (+0.0%) 1752 B (+0.0%) 816 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17924 B (+0.0%) 1440 B (+0.0%) 812 B (+0.0%) Erased 1568888832 B (+0.0%)

@amgross
Copy link

amgross commented Sep 30, 2025

I think need also to change

littlefs/lfs.h

Line 280 in adad0fb

// attr_max, and <= block_size/8. Defaults to the largest possible

As noted by amgross, the current inline_max default (when littlefs
switches from inline files to CTZ skip-lists) does not match the
theoretical value in DESIGN.md.

The reason for this is 1/8 was chosen as a safer default during
development, due to concerns that 1/4 + mdirs splitting at 1/2 would
lead to poor distribution of large inline files in mdirs.

However, two things have happened since then:

1. Experiments have show "wasted" mdir space is less of a concern than
   initially thought. Extra mdir space contributes to logging, delays
   mdir compaction, and can overall lead to better performance.

2. inline_size was added as a configuration option, so if 1/4 is
   problematic users can always override it.

So bumping this back up to 1/4 may make sense.
@geky geky force-pushed the bump-default-inline-max branch from fba5f44 to ab59ab7 Compare September 30, 2025 17:15
@geky
Copy link
Member Author

geky commented Sep 30, 2025

@amgross Good eye! Should be fixed now

I grepped lfs.c, but lfs.h is notoriously not in lfs.c.

@geky-bot
Copy link
Collaborator

Tests passed ✓, Code: 17128 B (+0.0%), Stack: 1448 B (+0.0%), Structs: 812 B (+0.0%)
Code Stack Structs Coverage
Default 17128 B (+0.0%) 1448 B (+0.0%) 812 B (+0.0%) Lines 2438/2599 lines (-0.0%)
Readonly 6234 B (+0.0%) 448 B (+0.0%) 812 B (+0.0%) Branches 1288/1624 branches (-0.0%)
Threadsafe 17980 B (+0.0%) 1448 B (+0.0%) 820 B (+0.0%) Benchmarks
Multiversion 17200 B (+0.0%) 1448 B (+0.0%) 816 B (+0.0%) Readed 29000746676 B (+0.0%)
Migrate 18792 B (+0.0%) 1752 B (+0.0%) 816 B (+0.0%) Proged 1482895246 B (+0.0%)
Error-asserts 17952 B (+0.0%) 1440 B (+0.0%) 812 B (+0.0%) Erased 1568921600 B (+0.0%)

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

Labels

enhancement needs minor version new functionality only allowed in minor versions next minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants