mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-05 15:15:30 +00:00
Minor improvement to documentation over block_cycles
Suggested by haneefmubarak
This commit is contained in:
10
lfs.c
10
lfs.c
@@ -3192,11 +3192,15 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
|
|||||||
LFS_ASSERT(4*lfs_npw2(0xffffffff / (lfs->cfg->block_size-2*4))
|
LFS_ASSERT(4*lfs_npw2(0xffffffff / (lfs->cfg->block_size-2*4))
|
||||||
<= lfs->cfg->block_size);
|
<= lfs->cfg->block_size);
|
||||||
|
|
||||||
// block_cycles = 0 is no longer supported, must either set a number
|
// block_cycles = 0 is no longer supported.
|
||||||
// of erase cycles before moving logs to another block (~500 suggested),
|
//
|
||||||
// or explicitly disable wear-leveling with -1.
|
// block_cycles is the number of erase cycles before littlefs evicts
|
||||||
|
// metadata logs as a part of wear leveling. Suggested values are in the
|
||||||
|
// range of 100-1000, or set block_cycles to -1 to disable block-level
|
||||||
|
// wear-leveling.
|
||||||
LFS_ASSERT(lfs->cfg->block_cycles != 0);
|
LFS_ASSERT(lfs->cfg->block_cycles != 0);
|
||||||
|
|
||||||
|
|
||||||
// setup read cache
|
// setup read cache
|
||||||
if (lfs->cfg->read_buffer) {
|
if (lfs->cfg->read_buffer) {
|
||||||
lfs->rcache.buffer = lfs->cfg->read_buffer;
|
lfs->rcache.buffer = lfs->cfg->read_buffer;
|
||||||
|
|||||||
7
lfs.h
7
lfs.h
@@ -190,9 +190,10 @@ struct lfs_config {
|
|||||||
// Number of erasable blocks on the device.
|
// Number of erasable blocks on the device.
|
||||||
lfs_size_t block_count;
|
lfs_size_t block_count;
|
||||||
|
|
||||||
// Number of erase cycles before we should move logs to another block.
|
// Number of erase cycles before littlefs evicts metadata logs and moves
|
||||||
// Suggested values are in the range 100-1000, with large values having
|
// the metadata to another block. Suggested values are in the
|
||||||
// better performance at the cost of less consistent wear distribution.
|
// 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.
|
// Set to -1 to disable block-level wear-leveling.
|
||||||
int32_t block_cycles;
|
int32_t block_cycles;
|
||||||
|
|||||||
Reference in New Issue
Block a user