Added support for handling corrupted blocks

This provides a limited form of wear leveling. While wear is
not actually balanced across blocks, the filesystem can recover
from corrupted blocks and extend the lifetime of a device nearly
as much as dynamic wear leveling.

For use-cases where wear is important, it would be better to use
a full form of dynamic wear-leveling at the block level. (or
consider a logging filesystem).

Corrupted block handling was simply added on top of the existing
logic in place for the filesystem, so it's a bit more noodly than
it may have to be, but it gets the work done.
This commit is contained in:
Christopher Haster
2017-05-14 12:01:45 -05:00
parent b35d761196
commit fd1da602d7
8 changed files with 634 additions and 311 deletions

View File

@@ -10,8 +10,8 @@ tests/test.py << TEST
TEST
echo "--- Invalid superblocks ---"
ln -f -s /dev/null blocks/0
ln -f -s /dev/null blocks/1
ln -f -s /dev/zero blocks/0
ln -f -s /dev/zero blocks/1
tests/test.py << TEST
lfs_format(&lfs, &cfg) => LFS_ERR_CORRUPT;
TEST