v2.5
What's new?
-
Removed all recursion (#658)
On paper, littlefs promises O(1) RAM consumption, however in practice, this hasn't quite been true due to the use of recursion in several parts of the implementation. 2 instances of recursion were bounded at runtime, but 1 instance could be unbounded, though this would require many block relocations to all occur simultaneously.
These pieces have now been rewritten to strictly avoid recursion, at the cost of some code size (<=5.1%). This means littlefs now lives up to its promise of bounded RAM, and the total RAM usage can be easily evaluated using static tooling.
-
Added several new scripts for measuring RAM usage, including detection of future recursion (#658)
These have also been integrated into CI, so data, stack, and struct usage will now be reported with all CI jobs.
-
Several corner-case performance improvements thanks to @invoxiaamo and @robekras:
-
lfs_dir_traverse no longer exhibits a nasty O(n^3) performance spike when a rename occurs at the same time a directory is being compacted (#666)
@invoxiaamo notes a reduction in lfs_dir_traverse calls by 97.8% (3248 vs 148393), with a number of other proposal to improve this with additional RAM caching in #621.
This change also reduces stack consumption of lfs_dir_traverse by ~25%.
-
lfs_file_seek now avoids flushing when seeking inside the cache while reading (#632)
@robekras notes a ~90% (2 sec vs 20 sec) speedup when loading a sparse binary font file into LVGL.
-
-
Several improvements to API robustness thanks to @colin-foster-in-advantage, @nnayo, @Johnxjj, and @lmapii:
-
Attempting to mount a littlefs image with a block_size or block_count that does not match the configuration will now error (#584)
-
lfs_file_open is now omitted when building with LFS_NO_MALLOC, previously this would always be a runtime error (#614)
-
Seeking to a negative offset is now an error, instead of underflowing (#630)
-
lfs_file_open now returns LFS_ERR_NAMETOOLONG if it can't fit the name + file metadata into a metadata block, previously this would return LFS_ERR_NOSPC (#638)
-
-
The copyright notice has been appended to reflect ownership changing to "the littlefs authors" (#657)
Changes
Configuration | Code | Stack | Structs | Coverage |
---|---|---|---|---|
Default | 15722 B (+12.7%) | 1312 B (-∞%) | 772 B (+0.0%) | 92.7% of 2388 lines (-2.0%) |
Readonly | 5742 B (+7.4%) | 352 B (+4.7%) | 772 B (+0.0%) | |
Threadsafe | 16516 B (+10.9%) | 1312 B (-∞%) | 780 B (+0.0%) | |
Migrate | 17414 B (+11.5%) | 1648 B (-∞%) | 776 B (+0.0%) | |
Error-asserts | 16326 B (+12.3%) | 1304 B (-∞%) | 772 B (+0.0%) |
148e312
Bumped minor version to v2.5
abbfe8e
Reduced lfs_dir_traverse's explicit stack to 3 frames
1e038c8
Fixes to use lfs_filebd on windows platforms
c2fa1bb
Optimization of the rename case.
3b62ec1
Updated error handling for NOSPC
b898977
Set the limit, the cursor cannot be set to a negative number
cf274e6
Squash of CR changes
425dc81
Modified robekras's optimization to avoid flush for all seeks in cache
a6f01b7
Update lfs.c
2db5dc8
Update copyright notice
8109f28
Removed recursion from lfs_dir_traverse
fedf646
Removed recursion in file read/writes
84da4c0
Removed recursion from commit/relocate code path
554e4b1
Fixed Popen deadlock issue in test.py
fe8f3d4
Changed./scripts/struct.py to organize by header file
316b019
In CI, determine loop devices dynamically to avoid conflicts with Ubuntu snaps
8475c80
Limit ./scripts/structs.py to report structs in local .h files
563af5f
Cleaned up make clean
3b495ba
Fixed spurious CI failure caused by multiple writers to .o files
e4adefd
Fixed spurious encoding error
9d54603
Added new scripts to CI results
7ea2b51
A few more tweaks to scripts
55b3c53
Added ./script/summary.py
eb8be9f
Some improvements to size scripts
50ad2ad
Added make *-diff rules, quick commands to compare sizes
0a2ff3b
Added scripts/structs.py for getting sizes of structs
d7582ef
Changed script's CSV formats to allow for merging different measurements
f4c7af7
Added scripts/stack.py for viewing stack usage
20c58dc
Added coverage-sort to scripts/coverage.py
f5286ab
Added scripts/calls.py for viewing the callgraph directly
2cdabe8
Split out scripts/code.py into scripts/code.py and scripts/data.py
b045436
Added size-sort options to scripts/code.py
e334983
don't use lfs_file_open() when LFS_NO_MALLOC is set
487df12
Fail when block_size doesn't match config
3efb8e4
Fail mount when the block size changes