Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor release: v2.8 #877

Merged
merged 26 commits into from
Sep 22, 2023
Merged

Minor release: v2.8 #877

merged 26 commits into from
Sep 22, 2023

Conversation

geky
Copy link
Member

@geky geky commented Sep 21, 2023

This release brings in some useful community-driven features. Thanks everyone who has put up PRs!

Bringing in:

Draft of release notes follows:


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.

BrianPugh and others added 26 commits August 16, 2023 22:23
Some block-device bound-checks are disabled during superblock search.
This would result in two passes through the superblock chain during
mount, when we can access everything we need to in one.
In separating the configuration of littlefs from the physical geometry
of the underlying device, we can no longer rely solely on lfs_config to
contain all of the information necessary for the simulated block devices
we use for testing.

This adds a new lfs_*bd_config struct for each of the block devices, and
new erase_size/erase_count fields. The erase_* name was chosen since
these reflect the (simulated) physical erase size and count of
erase-sized blocks, unlike the block_* variants which represent logical
block sizes used for littlefs's bookkeeping.

It may be worth adopting erase_size/erase_count in littlefs's config at
some point in the future, but at the moment doesn't seem necessary.

Changing the lfs_bd_config structs to be required is probably a good
idea anyways, as it moves us more towards separating the bds from
littlefs. Though we can't quite get rid of the lfs_config parameter
because of the block-device API in lfs_config. Eventually it would be
nice to get rid of it, but that would require API breakage.
These were cherry-picked from some previous work on a related feature.
Mainly to match superblock ordering and emphasize these are logical
blocks.
The initial implementation for this was provided by kaetemi, originally
as a mount flag. However, it has been modified here to be self-contained
in an explicit runtime function that can be called after mount.

The reasons for an explicit function:

1. lfs_mount stays a strictly readonly operation, and avoids pulling in
   all of the write machinery.

2. filesystem-wide operations such as lfs_fs_grow can be a bit risky,
   and irreversable. The action of growing the filesystem should be very
   intentional.

---

One concern with this change is that this will be the first function
that changes metadata in the superblock. This might break tools that
expect the first valid superblock entry to contain the most recent
metadata, since only the last superblock in the superblock chain will
contain the updated metadata.
Infer block_count from superblock if not provided in config.
Add lfs_fs_grow to enable limited resizing of the filesystem
…esn't exist move it for whole lookahead size.
This adds the tracing and optional locking for the littlefs API.

Also updated to match the code style, and added LFS_READONLY guards
where necessary.
- Test that the code actually runs.

- Test that lfs_fs_findfreeblocks does not break block allocations.

- Test that lfs_fs_findfreeblocks does not error when no space is
  available, it should only errors when the block is actually needed.
The idea is in the future this function may be extended to support other
block janitorial work. In such a case calling this lfs_fs_gc provides a
more general name that can include other operations.

This is currently just wishful thinking, however.
Add lfs_fs_gc to enable proactive finding of free blocks
@geky geky added this to the v2.8 milestone Sep 21, 2023
@geky geky changed the title Devel Minor release: v2.8 Sep 21, 2023
@geky-bot
Copy link
Collaborator

Tests passed ✓, Code: 16838 B (+1.0%), Stack: 1448 B (+1.1%), Structs: 800 B (+1.5%)
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%)

@geky geky merged commit f77214d into master Sep 22, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants