Skip to content

Add a unstable-disable-block-count-check feature that removes the block count check#26

Merged
sosthene-nitrokey merged 1 commit intomainfrom
remove-mount-block-count
Apr 16, 2025
Merged

Add a unstable-disable-block-count-check feature that removes the block count check#26
sosthene-nitrokey merged 1 commit intomainfrom
remove-mount-block-count

Conversation

@sosthene-nitrokey
Copy link
Contributor

Upstream PR: littlefs-project/littlefs#584 introduced a check that the block count matches the superblock.

However that can cause some issues for filesystem that were formatted with a wrong block count and later corrected.

Comment on lines 24 to 28
+ if (lfs->cfg->block_count) {
+ lfs->block_count = lfs->cfg->block_count;
+ }
Copy link
Member

Choose a reason for hiding this comment

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

AFAIS this breaks the case where lfs->cfg->block_count is zero. We should either handle it or return LFS_ERR_INVAL in that case.

Suggested change
+ if (lfs->cfg->block_count) {
+ lfs->block_count = lfs->cfg->block_count;
+ }
+ if (lfs->cfg->block_count) {
+ lfs->block_count = lfs->cfg->block_count;
+ } else {
+ lfs->block_count = superblock.block_count;
+ }

@sosthene-nitrokey sosthene-nitrokey force-pushed the remove-mount-block-count branch from 268e33e to 7800070 Compare April 15, 2025 12:22
+ if (lfs->cfg->block_count) {
+ lfs->block_count = lfs->cfg->block_count;
+ } else {
+
Copy link
Member

Choose a reason for hiding this comment

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

Missing line?

…lock count check

Upstream PR: littlefs-project/littlefs#584 introduced a check
that the block count matches the superblock.

However that can cause some issues for filesystem that were formatted with a wrong block count
and later corrected.
@sosthene-nitrokey sosthene-nitrokey merged commit 55d0f97 into main Apr 16, 2025
6 checks passed
@sosthene-nitrokey sosthene-nitrokey deleted the remove-mount-block-count branch April 16, 2025 09:04
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