Skip to content

Commit ab59ab7

Browse files
committed
Bump default inline_max up to 1/4 block size
As noted by amgross, the current inline_max default (when littlefs switches from inline files to CTZ skip-lists) does not match the theoretical value in DESIGN.md. The reason for this is 1/8 was chosen as a safer default during development, due to concerns that 1/4 + mdirs splitting at 1/2 would lead to poor distribution of large inline files in mdirs. However, two things have happened since then: 1. Experiments have show "wasted" mdir space is less of a concern than initially thought. Extra mdir space contributes to logging, delays mdir compaction, and can overall lead to better performance. 2. inline_size was added as a configuration option, so if 1/4 is problematic users can always override it. So bumping this back up to 1/4 may make sense.
1 parent 8e251dd commit ab59ab7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4331,7 +4331,7 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
43314331
LFS_ASSERT(lfs->cfg->inline_max == (lfs_size_t)-1
43324332
|| lfs->cfg->inline_max <= ((lfs->cfg->metadata_max)
43334333
? lfs->cfg->metadata_max
4334-
: lfs->cfg->block_size)/8);
4334+
: lfs->cfg->block_size)/4);
43354335
lfs->inline_max = lfs->cfg->inline_max;
43364336
if (lfs->inline_max == (lfs_size_t)-1) {
43374337
lfs->inline_max = 0;
@@ -4342,7 +4342,7 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
43424342
lfs->attr_max,
43434343
((lfs->cfg->metadata_max)
43444344
? lfs->cfg->metadata_max
4345-
: lfs->cfg->block_size)/8));
4345+
: lfs->cfg->block_size)/4));
43464346
}
43474347

43484348
// setup default state

lfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct lfs_config {
277277
// Optional upper limit on inlined files in bytes. Inlined files live in
278278
// metadata and decrease storage requirements, but may be limited to
279279
// improve metadata-related performance. Must be <= cache_size, <=
280-
// attr_max, and <= block_size/8. Defaults to the largest possible
280+
// attr_max, and <= block_size/4. Defaults to the largest possible
281281
// inline_max when zero.
282282
//
283283
// Set to -1 to disable inlined files.

0 commit comments

Comments
 (0)