Skip to content

Releases: littlefs-project/littlefs

v2.10.1

20 Dec 15:30
0494ce7
Compare
Choose a tag to compare
Code Stack Structs Coverage
Default 17104 B (-0.1%) 1448 B (+0.6%) 812 B (+0.0%) Lines 2429/2591 lines (+0.4%)
Readonly 6222 B (-0.4%) 448 B (+0.0%) 812 B (+0.0%) Branches 1278/1608 branches (+0.1%)
Threadsafe 17956 B (-0.1%) 1448 B (+0.6%) 820 B (+0.0%) Benchmarks
Multiversion 17176 B (-0.1%) 1448 B (+0.6%) 816 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18768 B (-0.3%) 1752 B (+0.9%) 816 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17884 B (-0.0%) 1440 B (+0.6%) 812 B (+0.0%) Erased 1568888832 B (+0.0%)

366100b Fixed incorrect cache reuse when seeking from end-of-block

v2.10

11 Dec 23:59
630a0d8
Compare
Choose a tag to compare

This holiday themed release brings in some minor, but highly requested, features.

Potentially breaking changes:

  • Path parsing has been reworked internally to better align with POSIX/user expectations in a number of corner cases. This changes behavior of paths with trailing slashes, navigating above root, and empty paths.

    See path changes below for a full list of what's changed.

What's new?

  • Path parsing has been reworked internally to better align with POSIX/user expectations in a number of corner cases (#1046)

    See path changes below for more details.

  • Thanks to @yamt, LFS_DEFINES now provides an easier alternative to LFS_CONFIG for partial util overrides (#1004)

    This is useful for when you want to override some parts of lfs_utils.h, but keep most of the existing definitions:

    // in my_utils.h
    #include <stddef.h>
    extern void *my_malloc(size_t sz);
    #define LFS_MALLOC(sz) my_malloc(sz)
    # in compile flags
    -DLFS_DEFINES=my_utils.h
  • @wdfk-prog found some nice code savings by deduplicating lfs_tortoise_detectcycles (#1013)

  • Thanks to @wangdongustc, littlefs now asserts if block-device callbacks are NULL (#1052)

  • Added links to ramcrc32bd and ramrsbd (#1038)

    These are two new example block devices that implement error-correction compatible with littlefs (or any filesystem really).

    littlefs currently does not provide error-correction or error-detection. These are intended to be a good starting point if this is a requirement for your system.

  • Fixed metadata compaction bug that may cause early LFS_ERR_NOSPC when using metadata_max (#1031)

  • Fixed undefined signed overflow in lfs_file_seek found by @m-kostrzewa and @lucic71 (#1027)

  • Fixed some LFS_TRACE format specifiers found by @stefano-zanotti (#997)

  • Thanks to @yamt, fixed an annoying GitHub Actions breakage (#1026)

Path changes

  • lfs_mkdir now accepts trailing slashes:

    before: lfs_mkdir("a/") => LFS_ERR_NOENT
    after:  lfs_mkdir("a/") => 0
  • lfs_stat, lfs_getattr, etc, now reject trailing slashes if the file is not a directory:

    before: lfs_stat("reg_a/") => 0
    after:  lfs_stat("reg_a/") => LFS_ERR_NOTDIR

    Note trailing slashes are accepted if the file is a directory:

    before: lfs_stat("dir_a/") => 0
    after:  lfs_stat("dir_a/") => 0
  • lfs_file_open now returns LFS_ERR_NOTDIR if the path contains trailing slashes and the file is not a directory, or LFS_O_CREAT is specified and the file does not exist:

    before: lfs_file_open("reg_a/") => LFS_ERR_NOENT
    after:  lfs_file_open("reg_a/") => LFS_ERR_NOTDIR

    Note trailing slashes return LFS_ERR_ISDIR if the file is a directory:

    before: lfs_file_open("dir_a/") => LFS_ERR_ISDIR
    after:  lfs_file_open("dir_a/") => LFS_ERR_ISDIR

    Note LFS_ERR_NOENT takes priority if LFS_O_CREAT is not specified:

    before: lfs_file_open("missing_a/") => LFS_ERR_NOENT
    after:  lfs_file_open("missing_a/") => LFS_ERR_NOENT
  • Attempting to navigate above the root directory now returns LFS_ERR_INVAL:

    before: lfs_stat("/../a") => 0
    after:  lfs_stat("/../a") => LFS_ERR_INVAL

    This actually moves away from the behavior of other filesystems, but towards, in my opinion, more reasonable behavior. It should also be more consistent with future theoretical openat-like APIs.

  • The empty path ("") no longer aliases the root directory, now returns LFS_ERR_INVAL:

    before: lfs_stat("") => 0
    after:  lfs_stat("") => LFS_ERR_INVAL

POSIX deviations

While this gets us closer to POSIX, there are still some subtle differences in behaviors. These shouldn't affect most users, but are worth documenting. Most of these are due to 1. littlefs not actually creating . and .. entries on disk and 2. not using recursion during path resolution.

  • Root modifications return EINVAL instead of EBUSY:

    littlefs: remove("/") => EINVAL
    POSIX:    remove("/") => EBUSY

    Reason: This would be the only use of EBUSY in the system.

  • We accept modifications of directories with trailing dots:

    littlefs: remove("a/.") => 0
    POSIX:    remove("a/.") => EBUSY

    Reason: Not worth implementing.

  • We do not check for existence of directories followed by dotdots:

    littlefs: stat("a/missing/..") => 0
    POSIX:    stat("a/missing/..") => ENOENT

    Reason: Difficult to implement non-recursively.

  • We accept modifications of directories with trailing dotdots:

    littlefs: rename("a/b/..", "c") => 0
    POSIX:    rename("a/b/..", "c") => EBUSY

    Reason: Not worth implementing.

Changes

Code Stack Structs Coverage
Default 17128 B (+0.4%) 1440 B (+0.0%) 812 B (+0.0%) Lines 2399/2571 lines (+0.3%)
Readonly 6250 B (+0.9%) 448 B (+0.0%) 812 B (+0.0%) Branches 1283/1616 branches (+0.8%)
Threadsafe 17976 B (+0.3%) 1440 B (+0.0%) 820 B (+0.0%) Benchmarks
Multiversion 17200 B (+0.4%) 1440 B (+0.0%) 816 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18816 B (+0.3%) 1736 B (-0.5%) 816 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17892 B (+0.8%) 1432 B (+0.0%) 812 B (+0.0%) Erased 1568888832 B (+0.0%)

3d03864 Bumped minor version to v2.10
dae656a Fix prettyasserts.py for pointer asserts
469c863 Assert on NULL IO function
215613e gha: Fixed x86-only statuses
999ef66 paths: Changed CREAT with a trailing slash to return NOTDIR
b735c8f paths: Added tests over NOENT + trailing slash/dot
3094705 paths: Extended tests to cover open with CREAT/EXCL
80ca1ea paths: Reject empty paths
815f0d8 paths: Fixed dots followed by dotdots
dc92dec paths: Reject dotdots above root
a603507 paths: Fixed/doc trailing slash/dot POSIX incompatibilities
232e736 paths: Added trailing slashes and dots tests
0de0389 paths: Reworked test_paths to cover more corner cases
1407db9 Added links to ramcrc32bd and ramrsbd
ea431bd Added some checks that metadata_max makes sense
2d62d2f Fixed metadata_max==prog_size commit->end calculation
1f82c0f Added some metadata_max testing
a2c2e49 Write the detect cycles function as a function to optimize code
abaec45 Fixed seek undefined behavior on signed integer overflow
f1c430e Added some tests around seek integer overflow/underflow
4a845be Rename LFS_USER_DEFINES to LFS_DEFINES
e1636d0 Add an alternative way to override LFS_MALLOC etc
798073c gha: Dropped minor/patch version pinning of actions
7db9e16 gha: Switched to standard da for cross-workflow downloads
2c4b262 gha: Merge artifacts on download
72a4b57 gha: Make the artifact names unique
6e72698 gha: Update github actions to the latest versions
ac20758 Fixed some more LFS_TRACE format specifiers

Sponsors

A special thanks to littlefs's sponsors: @fusedFET, @kmetabg, @Eclo

v2.9.3

29 Apr 22:00
Compare
Choose a tag to compare
Code Stack Structs Coverage
Default 17064 B (+0.2%) 1440 B (+0.6%) 812 B (+0.0%) Lines 2394/2574 lines (+0.0%)
Readonly 6194 B (+0.1%) 448 B (+0.0%) 812 B (+0.0%) Branches 1245/1584 branches (+0.0%)
Threadsafe 17924 B (+0.2%) 1440 B (+0.6%) 820 B (+0.0%) Benchmarks
Multiversion 17124 B (+0.2%) 1440 B (+0.6%) 816 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18760 B (+0.2%) 1744 B (+0.5%) 816 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17748 B (+0.2%) 1432 B (+0.6%) 812 B (+0.0%) Erased 1568888832 B (+0.0%)

0bbb8bc Reorganized external project links a bit
7808233 Added a link to mklittlefs
8336ecd Added a link to pico-littlefs-usb (FAT12 emulation)
11b036c Prevented unnecessary superblock rewrites if old version in superblock chain
25ee90f Clarified what is accessible at specific superblock offsets in SPEC.md
a60a986 Duplicate the superblock entry during superblock expansion

v2.9.2

17 Apr 18:03
68d28b5
Compare
Choose a tag to compare
Code Stack Structs Coverage
Default 17032 B (+0.0%) 1432 B (+0.0%) 812 B (+0.0%) Lines 2391/2571 lines (+0.0%)
Readonly 6190 B (+0.0%) 448 B (+0.0%) 812 B (+0.0%) Branches 1243/1582 branches (+0.0%)
Threadsafe 17896 B (+0.0%) 1432 B (+0.0%) 820 B (+0.0%) Benchmarks
Multiversion 17096 B (+0.0%) 1432 B (+0.0%) 816 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18728 B (+0.0%) 1736 B (+0.0%) 816 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17712 B (+0.0%) 1424 B (+0.0%) 812 B (+0.0%) Erased 1568888832 B (+0.0%)

1bc1493 Tweaked on-disk config comments for consistency
01b6a47 Extended test_alloc to test inferred block_count
749a456 Fix DivideByZero exception when filesystem is completely full.

v2.9.1

08 Mar 23:23
4dd30c1
Compare
Choose a tag to compare
Code Stack Structs Coverage
Default 17032 B (+0.4%) 1432 B (+0.0%) 812 B (+0.0%) Lines 2391/2571 lines (-0.0%)
Readonly 6190 B (+0.1%) 448 B (+0.0%) 812 B (+0.0%) Branches 1243/1582 branches (-0.0%)
Threadsafe 17896 B (+0.3%) 1432 B (+0.0%) 820 B (+0.0%) Benchmarks
Multiversion 17096 B (+0.4%) 1432 B (+0.0%) 816 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18728 B (+0.3%) 1736 B (+0.0%) 816 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17712 B (+0.3%) 1424 B (+0.0%) 812 B (+0.0%) Erased 1568888832 B (+0.0%)

7873d81 Fixed memory leak in emubd's out-of-order write emulation
fc2aa33 Fixed issue with exhaustive + out-of-order powerloss testing
6352185 Fixed sync issue where data writes could appear before metadata writes
f2a6f45 Added out-of-order write testing to emubd
2752d8c add nim-littlefs to readme
ddbfcaa Fixed synthetic move underflows in lfs_dir_get

v2.9

23 Jan 18:59
f53a0cc
Compare
Choose a tag to compare

Itsy-bitsy breaking changes:

  • lfs_rename now returns LFS_ERR_NOTDIR if the source is a regular file and the destination is a directory. This better aligns with POSIX.

  • Defining LFS_FILE_MAX > 2147483647 is no longer supported. It's unclear if this ever worked, and at least half the file API was unusable in this state.

What's new?

  • lfs_fs_gc can now compact metadata (#913)

    This is controlled by the new optional compact_thresh configuration option. mdirs above compact_thresh will be eagerly compacted during lfs_fs_gc, making it less likely (but still possible) for compactions to occur during file writes.

    By default, compact_thresh=0, littlefs will compact mdirs > ~88% block_size. This value may change in the future.

    compact_thresh=-1 disables mdir compaction during lfs_fs_gc.

    Note that compact_thresh has no effect on mdir compaction outside of lfs_fs_gc. mdirs must compact when full.

  • Added inline_max, which allows explicit user control over the size of inlined files (#914)

    Decreasing inline_max may improve some metadata-related performance around mdir traversal. But decreasing inline_max may also hurt metadata-related performance around mdir compaction and increase storage consumption. It is up to users to determine the best value per-application.

    By default, inline_max=0, uses the largest possible inline_max. This matches the previous behavior and is probably a good default for most use cases.

    inline_max=-1 disables inlined files.

  • Added easier util overrides for common system functions: LFS_MALLOC, LFS_FREE, LFS_CRC (#909)

    These can now be overridden with simple defines:

    -DLFS_MALLOC=my_malloc
    -DLFS_FREE=my_free
    -DLFS_CRC=my_crc
    

    Note: Overriding LFS_CRC with a non-CRC32 checksum is discouraged. This is only intended for hardware acceleration, etc.

  • Thanks to @tomscii, lfs_rename now returns LFS_ERR_NOTDIR if the source is a regular file and the destination is a directory, which better matches POSIX (#917)

  • Thanks to @BrianPugh, defining overridable limits (LFS_FILE_MAX, LFS_NAME_MAX, LFS_ATTR_MAX) to incompatible values will now result in a compile error (#886)

  • Relaxed lookahead buffer alignment to only be byte-aligned (#912)

  • Relaxed lfs_malloc alignment requirements to only be byte-aligned (#912)

Changes

Code Stack Structs Coverage
Default 16972 B (+0.9%) 1432 B (-1.1%) 812 B (+1.5%) Lines 2387/2566 lines (-0.1%)
Readonly 6186 B (+0.9%) 448 B (+0.0%) 812 B (+1.5%) Branches 1239/1576 branches (-0.1%)
Threadsafe 17836 B (+0.8%) 1432 B (-1.1%) 820 B (+1.5%) Benchmarks
Multiversion 17036 B (+0.9%) 1432 B (-1.1%) 816 B (+1.5%) Readed 29369693876 B (+0.0%)
Migrate 18664 B (+0.8%) 1736 B (-0.9%) 816 B (+1.5%) Proged 1482874766 B (+0.0%)
Error-asserts 17660 B (+1.0%) 1424 B (-1.1%) 812 B (+1.5%) Erased 1568888832 B (+0.0%)

42910bc Bumped minor version to v2.9
a70870c Renamed internal functions _raw* -> *
8b8fd14 Added inline_max, to optionally limit the size of inlined files
b5cd957 Extended lfs_fs_gc to compact metadata, compact_thresh
f522ed9 Added tests over rename type errors
4f32738 Fix return value of lfs_rename()
6691718 Restricted LFS_FILE_MAX to signed 32-bits, <2^31, <=2147483647
1fefcbb Rearranged compile-time constant checks to live near lfs_init
6056767 Relaxed alignment requirements for lfs_malloc
897b571 Changed CI to just run on ubuntu-latest
b1b10c0 Relaxed lookahead buffer alignment
1f9c3c0 Reworked the block allocator so the logic is hopefully simpler
7b68441 Renamed a number of internal block-allocator fields
9a620c7 Added LFS_CRC, easier override for lfs_crc
a0c6c54 Added LFS_MALLOC/FREE, easier overrides for lfs_malloc/free
c531a5e Replace erroneous LFS_FILE_MAX upper bound 4294967296 to 4294967295
8f9427d Add value-range checks for user-definable macros

Sponsors

A special thanks to littlefs's sponsors: @nedap, @kmetabg, @fusedFET

v2.8.2

21 Dec 06:59
3513ff1
Compare
Choose a tag to compare

Changes

Code Stack Structs Coverage
Default 16828 B (+0.0%) 1448 B (+0.0%) 800 B (+0.0%) Lines 2357/2533 lines (+0.0%)
Readonly 6130 B (+0.0%) 448 B (+0.0%) 800 B (+0.0%) Branches 1202/1528 branches (+0.0%)
Threadsafe 17696 B (+0.0%) 1448 B (+0.0%) 808 B (+0.0%) Benchmarks
Multiversion 16892 B (+0.0%) 1448 B (+0.0%) 804 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18508 B (+0.0%) 1752 B (+0.0%) 804 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17484 B (+0.0%) 1440 B (+0.0%) 800 B (+0.0%) Erased 1568888832 B (+0.0%)

99b84ee Update DESIGN.md, fix minor typo
e91a29d Fixed struct sizes missing from generated release notes
b9b95ab Increase threshold for superblock expansion from ~50% -> ~88% full
10bcff1 Update DESIGN.md minor typo

Contributors

A special thanks to all who proposed PRs: @zchen24

Sponsors

And a special thanks to littlefs's sponsors: @nedap, @kmetabg, @fusedFET

v2.8.1

31 Oct 19:00
c733d9e
Compare
Choose a tag to compare
Code Stack Structs Coverage
Default 16820 B (-0.1%) 1448 B (+0.0%) 800 B (+0.0%) Lines 2357/2533 lines (+0.0%)
Readonly 6130 B (+0.0%) 448 B (+0.0%) 800 B (+0.0%) Branches 1202/1528 branches (+0.0%)
Threadsafe 17688 B (-0.2%) 1448 B (+0.0%) 808 B (+0.0%) Benchmarks
Multiversion 16884 B (-0.1%) 1448 B (+0.0%) 804 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18500 B (-0.1%) 1752 B (+0.0%) 804 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17480 B (-0.1%) 1440 B (+0.0%) 800 B (+0.0%) Erased 1568888832 B (+0.0%)

8f3f32d Added -Wmissing-prototypes
92fc780 lfs_fs_raw* functions should be static

v2.8

22 Sep 17:44
f77214d
Compare
Choose a tag to compare

This release brings in some useful community-driven features.

What's new?

  • Thanks to @BrianPugh, littlefs no longer needs the block_count when mounting an existing filesystem (#866)

    Simply set block_count=0 in your configuration, and littlefs will automatically determine the block_count based on what's on disk. This allows you to mount a filesystem of unknown size.

  • Added lfs_fs_grow which allows you to change the size of an existing filesystem, thanks to @kaetemi (#872)

    The main use case is for changing the size of a partition as storage requirements change.

    Note: littlefs does not support shrinking a filesystem, and this is unlikely to change (it's a hard problem).

  • Added lfs_fs_gc which allows you to manually run the block allocator, thanks to @opilat (#875)

    Note: littlefs currently does not persist any found free blocks to disk, though this may change in the future.

    This limits the current value of lfs_fs_gc, but it may still be useful for moving the expensive block scan out of performance sensitive code paths.

Changes

Code Stack Structs Coverage
Default 16838 B (+1.0%) 1448 B (+1.1%) 800 B (+1.5%) Lines 2357/2533 lines (+0.3%)
Readonly 6130 B (+0.1%) 448 B (+0.0%) 800 B (+1.5%) Branches 1202/1528 branches (+0.1%)
Threadsafe 17722 B (+1.2%) 1448 B (+1.1%) 808 B (+1.5%) Benchmarks
Multiversion 16898 B (+0.9%) 1448 B (+1.1%) 804 B (+1.5%) Readed 29369693876 B (+0.0%)
Migrate 18514 B (+0.8%) 1752 B (+0.9%) 804 B (+1.5%) Proged 1482874766 B (+0.0%)
Error-asserts 17498 B (+1.1%) 1440 B (+1.1%) 800 B (+1.5%) Erased 1568888832 B (+0.0%)

f91c5bd Bumped minor version to v2.8
6b33ee5 Renamed lfs_fs_findfreeblocks -> lfs_fs_gc, tweaked documentation
63e4408 Extended alloc tests to test some properties of lfs_fs_findfreeblocks
dbe4598 Added API boilerplate for lfs_fs_findfreeblocks and consistent style
d85a0fe Move lookahead buffer offset at the first free block if such block doesn't exist move it for whole lookahead size.
b637379 Update lfs_find_free_blocks to match the latest changes.
23505fa Added lfs_fs_grow for growing the filesystem to a different block_count
2c222af Tweaked lfs_fsinfo block_size/block_count fields
127d84b Added a couple mixed/unknown block_count tests
027331b Adopted erase_size/erase_count config in test block-devices/runners
9c23329 Revert of refactor lfs_scan_* out of lfs_format
23089d5 remove previous block_count detection from lfs_format
d6098bd Add block_count and block_size to fsinfo
d6c0c6a linting
5caa83f forgot to unmount lfs in test; leaking memory
7521e0a fix newly introduced missing cleanup when an invalid superblock is found.
2ebfec7 test for failure when interpretting block count when formatting without superblock
3d0bcf4 Add test_superblocks_mount_unknown_block_count
6de3fc6 fix corruption check
df238eb Add a unit test; currently hanging on final permutation.
be68122 introduce lfs->block_count. If cfg->block_count is 0, autopopulate from superblock
6dae703 remove redundant superblock check
7328527 refactor lfs_scan_for_state_updates and lfs_scan_for_superblock out of lfs_format

v2.7.1

03 Sep 18:50
130790f
Compare
Choose a tag to compare
Code Stack Structs Coverage
Default 16678 B (+0.1%) 1432 B (+0.0%) 788 B (+0.0%) Lines 2316/2496 lines (+0.0%)
Readonly 6126 B (+0.0%) 448 B (+0.0%) 788 B (+0.0%) Branches 1184/1506 branches (-0.0%)
Threadsafe 17506 B (+0.1%) 1432 B (+0.0%) 796 B (+0.0%) Benchmarks
Multiversion 16754 B (+0.1%) 1432 B (+0.0%) 792 B (+0.0%) Readed 29369693876 B (+0.0%)
Migrate 18362 B (+0.1%) 1736 B (+0.0%) 792 B (+0.0%) Proged 1482874766 B (+0.0%)
Error-asserts 17310 B (+0.0%) 1424 B (+0.0%) 788 B (+0.0%) Erased 1568888832 B (+0.0%)

5a834b6 initlize struct lfs_diskoff disk = {0} so we don't use it uninitlized in first run
d775b46 Fixed integer conversion warning from Code Composer Studio
96fb8be Fixed release script breaking if there is no previous version