Skip to content

Block count disable and shrink #1

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sosthene-nitrokey
Copy link
Collaborator

@sosthene-nitrokey sosthene-nitrokey commented Apr 30, 2025

Merge of the patches

On top of 2.9 for use in littlefs2-sys

Should not be merged to main (because main is on top of 2.10)

This PR adds a new `lfs_fs_shrink`, which functions similarly to
`lfs_fs_grow`, but supports reducing the block count.

This functions first checks that none of the removed block are in use.
If it is the case, it will fail.
When the block count check was added to `lfs_mount` in [littlefs-project#584][]
it was mentionned to have a mount flag to disable this check in the future.

Therefore, this PR:

- Adds a new `flags` field to lfs_config
- Defines a new `lfs_fs_flags` enum that contains these flags
- Defines one flag `LFS_CFG_DISABLE_BLOCK_COUNT_CHECK` that disables
  the check inserted in [littlefs-project#584][]

[littlefs-project#584]: littlefs-project#584
Copy link
Member

@robin-nitrokey robin-nitrokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I’d propose to merge this into a new v2.9-trussed branch and create a v2.9-trussed.1 tag so that the commits don’t get lost and we don’t have build problems in the future.

@sosthene-nitrokey
Copy link
Collaborator Author

I've got some feedback on the upstream PRs, I'll apply it so that ideally when we move to 2.10.x we can go back to using upstream.

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.

3 participants