Dropped erase_count, block_count makes it redundant
Aside from asserts (which can be implemented in block devices), erase_count provides no useful info aside from what's known with block_count and risks mistakes during configuration. Each set of known/unknown block_size-related variables has a well-defined mount behavior: block_size block_count known known => known bs, O(1) known unknown => known bs, O(1) unknown known => bs search, O(d(n)) unknown unknown => bs search, O(n) If block_size is unknown, block_count uses the erase_size as a unit, which is the only reasonable option since block_size must be >= prog/read/cache_size.
This commit is contained in:
@@ -205,17 +205,6 @@ struct lfs_config {
|
||||
// backwards compatibility.
|
||||
lfs_size_t erase_size;
|
||||
|
||||
// Number of erase blocks on the device.
|
||||
//
|
||||
// If zero, the block_count is used as the erase_count. This is mostly for
|
||||
// backwards compatibility.
|
||||
//
|
||||
// If zero and block_count is zero, this is treated as unknown.
|
||||
//
|
||||
// If non-zero, littlefs will assume block_size is a factor of
|
||||
// erase_size*erase_count to speed up mount when no superblock is found.
|
||||
lfs_size_t erase_count;
|
||||
|
||||
// Size of a logical block in bytes. This does not impact RAM consumption
|
||||
// and may be a multiple of the physical erase_size.
|
||||
//
|
||||
@@ -228,14 +217,17 @@ struct lfs_config {
|
||||
// block_size, but it can take time to fail if a superblock is not found:
|
||||
//
|
||||
// - O(block_size) if a superblock is found
|
||||
// - O(d(erase_count)) if erase_count is non-zero
|
||||
// - O(log(erase_count)) if erase_count is a power of 2
|
||||
// - O(erase_count) if erase_count is zero
|
||||
// - O(d(block_count)) if block_count is non-zero
|
||||
// - O(log(block_count)) if block_count is a power of 2
|
||||
// - O(block_count) if block_count is zero
|
||||
lfs_size_t block_size;
|
||||
|
||||
// Number of logical blocks on the device.
|
||||
//
|
||||
// If zero, littlefs uses the block_count stored in the superblock.
|
||||
//
|
||||
// If non-zero, littlefs will assume block_size is a factor of
|
||||
// erase_size*erase_count to speed up mount when no superblock is found.
|
||||
lfs_size_t block_count;
|
||||
|
||||
// Number of erase cycles before littlefs evicts metadata logs and moves
|
||||
@@ -441,7 +433,6 @@ typedef struct lfs {
|
||||
|
||||
const struct lfs_config *cfg;
|
||||
lfs_size_t erase_size;
|
||||
lfs_size_t erase_count;
|
||||
lfs_size_t block_size;
|
||||
lfs_size_t block_count;
|
||||
lfs_size_t name_max;
|
||||
|
||||
Reference in New Issue
Block a user