Files
thirdparty-littlefs/lfs.c
Christopher Haster b24ddac95e Added revision sum as tracking for filesystem stability
The idea is pretty simple: The revision count for each metadata block
only really needs 3 distinct states. The additional bit-width of the
revision count is available for other information. In this case, we can
sum all revision counts in the filesystem to encode state that can be
updated for free during any metadata block update.

The obvious state to store first is if the filesystem is in a bad state
that requires a deorphan step.

The allows us to sidestep the expensive O(n^2) operation for the O(n)
sum in the much more common case.

This patch adds the following rule:
If the sum of all revision count is odd, the filesystem was caught
mid-operation and must be deorphaned.
2017-10-10 18:27:56 -05:00

62 KiB