diff options
author | Christopher Haster <chaster@utexas.edu> | 2019-07-18 01:05:20 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2019-07-18 01:05:20 +0300 |
commit | 53a6e0471215b680426f97d9afce241d739ee49d (patch) | |
tree | b7e0a835e0a3e44eeed0321b5581ac3ab878c335 /lfs.h | |
parent | abd90cb84c818a663b584575b019258d01d0065e (diff) |
Changed block_cycles disable from 0 to -1
As it is now, block_cycles = 0 disables wear leveling. This was a
mistake as 0 is the "default" value for several other config options.
It's even worse when migrating from v1 as it's easy to miss the addition
of block_cycles and end up with a filesystem that is not actually
wear-leveling.
Clearly, block_cycles = 0 should do anything but disable wear-leveling.
Here, I've changed block_cycles = 0 to assert. Forcing users to set a
value for block_cycles (500 is suggested). block_cycles can be set to -1
to explicitly disable wear leveling if desired.
Diffstat (limited to 'lfs.h')
-rw-r--r-- | lfs.h | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -190,9 +190,12 @@ struct lfs_config { // Number of erasable blocks on the device. lfs_size_t block_count; - // Number of erase cycles before we should move data to another block. - // May be zero, in which case no block-level wear-leveling is performed. - uint32_t block_cycles; + // Number of erase cycles before we should move logs to another block. + // Suggested values are in the range 100-1000, with large values having + // better performance at the cost of less consistent wear distribution. + // + // Set to -1 to disable block-level wear-leveling. + int32_t block_cycles; // Size of block caches. Each cache buffers a portion of a block in RAM. // The littlefs needs a read cache, a program cache, and one additional |