Open robin-nitrokey opened 5 months ago
This should significantly reduce bootup time. With logging enabled (log-semihosting,log-info
), removing the is_mountable
call reduces the mount time from 1 000 ms to 500 ms and the total bootup time from 2 300 ms to 1 800 ms. Unfortunately, the borrow checker does not allow us to re-try the mount in the error case because of the static lifetime of the returned filesystem. Maybe we can find a workaround.
We could have a mount_or_format
method in littlefs2
?
I'm not sure I see the borrow checker error. Is this NLL case N°3
again?
Yes, we can do it in littlefs2
but not directly in the firmware.
Filesystem::is_mountable
callsFilesystem::mount
, checks the result and drops the mounted filesystem. This means that code that first callsis_mountable
and thenmount
on the same storage mounts the storage twice.https://github.com/Nitrokey/nitrokey-3-firmware/blob/6f032b5733b9c40621069cb29ef00bed028863fd/components/boards/src/store.rs#L275-L283
Instead we should first call
Filesystem::mount
and handle the error case directly.