Added support for writing on-disk version lfs2.0

The intention is to help interop with older minor versions of littlefs.

Unfortunately, since lfs2.0 drivers cannot mount lfs2.1 images, there are
situations where it would be useful to write to write strictly lfs2.0
compatible images. The solution here adds a "disk_version" configuration
option which determines the behavior of lfs2.1 dependent features.

Normally you would expect this to only change write behavior. But since the
main change in lfs2.1 increased validation of erased data, we also need to
skip this extra validation (fcrc) or see terrible slowdowns when writing.
This commit is contained in:
Christopher Haster
2023-06-07 02:03:31 -05:00
parent 265692e709
commit b72c96d440
7 changed files with 169 additions and 61 deletions
+5
View File
@@ -1346,6 +1346,7 @@ static void run_powerloss_none(
.block_cycles = BLOCK_CYCLES,
.cache_size = CACHE_SIZE,
.lookahead_size = LOOKAHEAD_SIZE,
.disk_version = DISK_VERSION,
};
struct lfs_emubd_config bdcfg = {
@@ -1415,6 +1416,7 @@ static void run_powerloss_linear(
.block_cycles = BLOCK_CYCLES,
.cache_size = CACHE_SIZE,
.lookahead_size = LOOKAHEAD_SIZE,
.disk_version = DISK_VERSION,
};
struct lfs_emubd_config bdcfg = {
@@ -1501,6 +1503,7 @@ static void run_powerloss_log(
.block_cycles = BLOCK_CYCLES,
.cache_size = CACHE_SIZE,
.lookahead_size = LOOKAHEAD_SIZE,
.disk_version = DISK_VERSION,
};
struct lfs_emubd_config bdcfg = {
@@ -1585,6 +1588,7 @@ static void run_powerloss_cycles(
.block_cycles = BLOCK_CYCLES,
.cache_size = CACHE_SIZE,
.lookahead_size = LOOKAHEAD_SIZE,
.disk_version = DISK_VERSION,
};
struct lfs_emubd_config bdcfg = {
@@ -1767,6 +1771,7 @@ static void run_powerloss_exhaustive(
.block_cycles = BLOCK_CYCLES,
.cache_size = CACHE_SIZE,
.lookahead_size = LOOKAHEAD_SIZE,
.disk_version = DISK_VERSION,
};
struct lfs_emubd_config bdcfg = {