Skip to content

v2.9

Compare
Choose a tag to compare
@geky-bot geky-bot released this 23 Jan 18:59
f53a0cc

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