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:
+9
-3
@@ -13,11 +13,17 @@ void test_log(const char *s, uintmax_t v) {{
|
||||
|
||||
void test_assert(const char *file, unsigned line,
|
||||
const char *s, uintmax_t v, uintmax_t e) {{
|
||||
static const char *last[2] = {{0, 0}};
|
||||
if (v != e || !(last[0] == s || last[1] == s)) {{
|
||||
static const char *last[6] = {{0, 0}};
|
||||
if (v != e || !(last[0] == s || last[1] == s ||
|
||||
last[2] == s || last[3] == s ||
|
||||
last[4] == s || last[5] == s)) {{
|
||||
test_log(s, v);
|
||||
last[0] = last[1];
|
||||
last[1] = s;
|
||||
last[1] = last[2];
|
||||
last[2] = last[3];
|
||||
last[3] = last[4];
|
||||
last[4] = last[5];
|
||||
last[5] = s;
|
||||
}}
|
||||
|
||||
if (v != e) {{
|
||||
|
||||
Reference in New Issue
Block a user