LFSv2 + Chunked Contacts#2964
Draft
oltaco wants to merge 16 commits into
Draft
Conversation
use relocateFile() for file moves and remove old unneeded cleanup logic
This file contains hidden or 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
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 PR upgrades all LFSv1 filesystems (including UserData) to LFSv2, and in the case of ExtraFS it will reformat to 4kB blocks as well.
The monolithic contacts file is converted into chunks that each fit into a single 4kB block, and all file writes are atomic.
Identity and preferences are migrated to ExtraFS/QSPIFlash, and a "backup" copy of identity is left on UserData just in case. At load time if an identity can't be found on the storage filesystem (ExtraFS/QSPIFlash) an attempt is made to restore identity from UserData.
adv_blobs doesn't make the migration from ExtraFS because there isn't enough space in RAM to store it during the reformat to 4kB blocks. adv_blobs is basically treated as ephemeral data anyway so this shouldn't be an issue.
Maximum adv_blobs is reduced from 100 to 40 in order to free up a few blocks for the overhead required for atomic writes and the metadata compaction that happens occasionally on LFSv2. Could be increased to 45 without any extra block overhead.
I've done quite a bit of testing on nRF (Seeed WioTrackerL1, Seeed T1000e, Heltec T114, Xiao NRF52, and others), and also a limited amount of testing on ESP32, RP2040 and STM32.
Something this huge really needs a lot of testing, so please help out if you're game.
Please add the debug macros
-D MESH_DEBUG=1and-D CFG_DEBUG=1in order to get useful debug prints, especially for the first boot migration process which is where I anticipate issues might be lurking.Best effort is made to migrate your data but better to be safe than sorry, and switching back to any firmware that doesn't support LFSv2 will wipe your filesystems!
Please backup your node before testing this PR!