Skip to content

Make SPIFFS be an integer number of blocks #5989

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

Merged
merged 10 commits into from
Jul 9, 2019

Conversation

earlephilhower
Copy link
Collaborator

Fixes #3621

boards.txt.py simply calculated SPIFFS end and start using flash sizes, but
in cases where an 8K page was used (>512KB SPIFFS), this could leave a
4K half-block left at the end of SPIFFS.

mkspiffs and the SPIFFS code uses integer division to calculate the
maximum block number, so it worked fine in practice and the code simply
ignored the extra, fractional block.

Now actually take block size into account when calculating the end of
SPIFFS, ensuring no fractional blocks are passed in. Does not result in
data loss on pre-existing SPIFFS filesystems.

boards.txt.py simply calculated the end and start using flash sizes, but
in cases where an 8K page was used (>512KB SPIFFS), this could leave a
4K half-block left at the end of SPIFFS.

mkspiffs and the SPIFFS code uses integer division to calculate the
maximum block number, so it worked fine in practice and the code simply
ignored the extra, fractional block.

Now actually take block size into account when calculating the end of
SPIFFS, ensuring no fractional blocks are passed in.  Does not result in
data loss on pre-existing SPIFFS filesystems.
@earlephilhower earlephilhower added this to the 2.6.0 milestone Apr 15, 2019
Ensure that no SPIFFS_block in the LD files is modified from the
original to endure correct backwards compatibility
@TD-er
Copy link
Contributor

TD-er commented Apr 17, 2019

Could this also be the reason why I was not able to make a working 16M/14M SPIFFS layout with 32k block size?

@earlephilhower
Copy link
Collaborator Author

@TD-er that's pretty unlikely. Everything just integer divides the size which always rounds down, so the extra blocks at the end of space would never be touched or used. This specific change should be a no-op functionally, and only affect the "code aesthetics" by keeping all input values consistent.

@d-a-v
Copy link
Collaborator

d-a-v commented Jul 4, 2019

@earlephilhower in order to fix conflicts, can you regenerate boards.txt.py files ?

@d-a-v d-a-v merged commit 828857d into esp8266:master Jul 9, 2019
@d-a-v d-a-v changed the title Make SPIFFS be an integer number of blocks (BREAKING) Make SPIFFS be an integer number of blocks Sep 18, 2019
@earlephilhower earlephilhower changed the title (BREAKING) Make SPIFFS be an integer number of blocks Make SPIFFS be an integer number of blocks Sep 19, 2019
@earlephilhower
Copy link
Collaborator Author

#6537 will un-breaking this...

@earlephilhower earlephilhower deleted the fix-spiffs-size branch September 19, 2019 21:08
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.

SPIFFS size is not an integer multiple of block size.
3 participants