mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-11-16 12:34:34 +00:00
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:
@@ -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 = {
|
||||
|
||||
@@ -91,6 +91,7 @@ intmax_t test_define(size_t define);
|
||||
#define ERASE_CYCLES_i 8
|
||||
#define BADBLOCK_BEHAVIOR_i 9
|
||||
#define POWERLOSS_BEHAVIOR_i 10
|
||||
#define DISK_VERSION_i 11
|
||||
|
||||
#define READ_SIZE TEST_DEFINE(READ_SIZE_i)
|
||||
#define PROG_SIZE TEST_DEFINE(PROG_SIZE_i)
|
||||
@@ -103,6 +104,7 @@ intmax_t test_define(size_t define);
|
||||
#define ERASE_CYCLES TEST_DEFINE(ERASE_CYCLES_i)
|
||||
#define BADBLOCK_BEHAVIOR TEST_DEFINE(BADBLOCK_BEHAVIOR_i)
|
||||
#define POWERLOSS_BEHAVIOR TEST_DEFINE(POWERLOSS_BEHAVIOR_i)
|
||||
#define DISK_VERSION TEST_DEFINE(DISK_VERSION_i)
|
||||
|
||||
#define TEST_IMPLICIT_DEFINES \
|
||||
TEST_DEF(READ_SIZE, PROG_SIZE) \
|
||||
@@ -115,9 +117,10 @@ intmax_t test_define(size_t define);
|
||||
TEST_DEF(ERASE_VALUE, 0xff) \
|
||||
TEST_DEF(ERASE_CYCLES, 0) \
|
||||
TEST_DEF(BADBLOCK_BEHAVIOR, LFS_EMUBD_BADBLOCK_PROGERROR) \
|
||||
TEST_DEF(POWERLOSS_BEHAVIOR, LFS_EMUBD_POWERLOSS_NOOP)
|
||||
TEST_DEF(POWERLOSS_BEHAVIOR, LFS_EMUBD_POWERLOSS_NOOP) \
|
||||
TEST_DEF(DISK_VERSION, 0)
|
||||
|
||||
#define TEST_IMPLICIT_DEFINE_COUNT 11
|
||||
#define TEST_IMPLICIT_DEFINE_COUNT 12
|
||||
#define TEST_GEOMETRY_DEFINE_COUNT 4
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user