v2.3
What's new?
Thanks to @maximevince, @renesas-billgesner, and @roykuper13, we now have two impactful compile-time options for littlefs!
-
LFS_READONLY
Define
LFS_READONLY
to enable read-only mode. This will limit littlefs to functions that do not modify the disk, but will reduce the code cost to ~1/3. This is a great addition for bootloaders or other applications where a small, read-only storage blob is useful. -
LFS_THREADSAFE
Define
LFS_THREADSAFE
to enable thread-safe mode. Note this needs thelock
andunlock
callbacks in the lfs_config struct.When defined, littlefs will call the related
lock
andunlock
callbacks when necessary to synchronize the filesystem. Allowing easy integration into an RTOS without needing an OS or wrapper layer.
In addition, this release brings in a number of improvements:
- More strict user asserts on common file/dir open mistakes thanks to @NoahGorny (#443)
- More efficient, 8-byte lfs_bd_cmp thanks to @gmpy (see #395 for measurements)
- A number of wear-leveling fixes thanks to @guiserle and @gtaska (#487)
- Fixes for allocation-eviction math thanks to @tim-nordell-nimbelink (#490)
Here are the current code costs for the different littlefs configurations in CI:
Arm Thumb | x86-64 | MIPS | PowerPC | |
---|---|---|---|---|
default | 14.53 KB | 25.55 KB | 28.76 KB | 23.53 KB |
LFS_READONLY | 5.56 KB (-61.73%) | 9.53 KB (-62.72%) | 11.08 KB (-61.47%) | 8.90 KB (-62.17%) |
LFS_THREADSAFE | 15.36 KB (+5.75%) | 27.79 KB (+8.76%) | 30.98 KB (+7.73%) | 25.64 KB (+8.99%) |
Changes
6a70127 Renamed internal lfs_*raw -> lfs_raw* functions
288a5cb Bumped minor version to v2.3
2bb5234 Moved lfs_mlist_isopen checks into the API wrappers
7388b29 Deprecate LFS_F_OPENED and use lfs_mlist_isused instead
a99a93f Added thread-safe build+size reporting to CI
45afded Moved LFS_TRACE calls to API wrapper functions
00a9ba7 Tweaked thread-safe implementation
fc6988c make raw functions static. formatting tweaks
d0f055d Squash of thread-safe PR cleanup
2efebf8 Added read-only build+size reporting to CI
754b4c3 Squash of LFS_READONLY cleanup
008ebc3 Add lfs_mlist_append/remove helper
b8dcf10 Changed lfs_dir_alloc to maximize block cycles for new metadata pairs
0aba71d Fixed single unchecked bit during commit verification
0ea2871 Fixed typo in scripts/readtree.py
d04c139 Fixed allocation-eviction issue when erase state is multiple of block_cycles+1
f215027 Switched to CRC as seed collection function instead of xor
1ae4b36 Removed unnecessary randomization of offsets in lfs_alloc_reset
480cdd9 Fixed incorrect modulus in lfs_alloc_reset
6303558 Use LFS_O_RDWR instead of magic number in lfs_file_* asserts
4bd653d Assert that file/dir struct is not reused in lfs_file_opencfg/lfs_dir_open
8e6826c Add LFS_READYONLY define, to allow smaller builds providing read-only mode
10ac6b9 add thread safe wrappers
87a2cb0 Fix assert
6d0ec5e Added littlefs-python to the related projects section
64f70f5 lfs_bd_cmp() compares more bytes at one time