-
Notifications
You must be signed in to change notification settings - Fork 797
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
Minor release: v2.8 #877
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This was referenced Sep 21, 2023
Tests passed ✓, Code: 16838 B (+1.0%), Stack: 1448 B (+1.1%), Structs: 800 B (+1.5%)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theblock_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.