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

Add lfs_fs_mkconsistent #812

Merged
merged 1 commit into from
May 1, 2023
Merged

Add lfs_fs_mkconsistent #812

merged 1 commit into from
May 1, 2023

Conversation

geky
Copy link
Member

@geky geky commented Apr 27, 2023

lfs_fs_mkconsistent allows running the internal consistency operations (desuperblock/deorphan/demove) on demand and without any other filesystem changes.

This can be useful for front-loading and persisting consistency operations when you don't want to pay for this cost on the first write to the filesystem.

littlefs/lfs.h

Lines 680 to 688 in 259535e

// Attempt to make the filesystem consistent and ready for writing
//
// Calling this function is not required, consistency will be implicitly
// enforced on the first operation that writes to the filesystem, but this
// function allows the work to be performed earlier and without other
// filesystem changes.
//
// Returns a negative error code on failure.
int lfs_fs_mkconsistent(lfs_t *lfs);

This also offers a way to force the on-disk minor version to bump, if that is wanted behavior. An on-disk minor version bump is being added in #497, so this is convenient timing.


Not entirely sure about the name, open to suggestions though I think this is an improvement over lfs_fs_forceconsistency which was really meant to be internal only and may imply abnormal behavior.

Idea from @kasper0
See #604 for more info

lfs_fs_mkconsistent allows running the internal consistency operations
(desuperblock/deorphan/demove) on demand and without any other
filesystem changes.

This can be useful for front-loading and persisting consistency operations
when you don't want to pay for this cost on the first write to the
filesystem.

Conveniently, this also offers a way to force the on-disk minor version
to bump, if that is wanted behavior.

Idea from kasper0
@geky
Copy link
Member Author

geky commented May 1, 2023

Going ahead and bringing this in so it makes it into the next minor release

@geky geky merged commit 405f332 into devel May 1, 2023
93 checks passed
@geky geky mentioned this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant