Skip to content

Commit c915fca

Browse files
committed
Renamed lfs->cfg->shrub_size -> lfs->cfg->inline_size
While I think shrub_size is probably the more correct name at a technical level, inline_size is probably more what users expect and doesn't require a deeper understanding of filesystem details. The only risk is that users may think inline_size has no effect on large files, when in fact it still controls how much of the btree root can be inlined. There's also the point that sticking with inline_size maintains compatibility with both the upstream version and any future version that has other file representations. May revisit this, but renaming to lfs->cfg->inline_size for now.
1 parent a9b061a commit c915fca

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

lfs.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6276,7 +6276,7 @@ static int lfsr_bshrub_commit_(lfs_t *lfs, lfsr_bshrub_t *bshrub,
62766276
//
62776277
// Instead, we keep track of an estimate of how many bytes have
62786278
// been progged to the shrub since the last estimate, and recalculate
6279-
// the estimate when this overflows our shrub_size. This mirrors how
6279+
// the estimate when this overflows our inline_size. This mirrors how
62806280
// block_size and rbyds interact, and amortizes the estimate cost.
62816281

62826282
// figure out how much data this commit progs
@@ -6285,27 +6285,27 @@ static int lfsr_bshrub_commit_(lfs_t *lfs, lfsr_bshrub_t *bshrub,
62856285
commit_estimate += lfs->rat_estimate + lfsr_rat_size(rats[i]);
62866286
}
62876287

6288-
// does our estimate exceed our shrub_size? need to recalculate an
6288+
// does our estimate exceed our inline_size? need to recalculate an
62896289
// accurate estimate
62906290
lfs_ssize_t estimate = (alloc) ? (lfs_size_t)-1 : bshrub->shrub.eoff;
62916291
// this double condition avoids overflow issues
6292-
if ((lfs_size_t)estimate > lfs->cfg->shrub_size
6293-
|| estimate + commit_estimate > lfs->cfg->shrub_size) {
6292+
if ((lfs_size_t)estimate > lfs->cfg->inline_size
6293+
|| estimate + commit_estimate > lfs->cfg->inline_size) {
62946294
estimate = lfsr_bshrub_estimate(lfs, bshrub);
62956295
if (estimate < 0) {
62966296
return estimate;
62976297
}
62986298

62996299
// two cases where we evict:
6300-
// - overflow shrub_size/2 - don't penalize for commits here
6301-
// - overflow shrub_size - must include commits or we risk overflow
6300+
// - overflow inline_size/2 - don't penalize for commits here
6301+
// - overflow inline_size - must include commits or risk overflow
63026302
//
63036303
// the 1/2 here prevents runaway performance with the shrub is
63046304
// near full, but it's a heuristic, so including the commit would
63056305
// just be mean
63066306
//
6307-
if ((lfs_size_t)estimate > lfs->cfg->shrub_size/2
6308-
|| estimate + commit_estimate > lfs->cfg->shrub_size) {
6307+
if ((lfs_size_t)estimate > lfs->cfg->inline_size/2
6308+
|| estimate + commit_estimate > lfs->cfg->inline_size) {
63096309
goto relocate;
63106310
}
63116311
}
@@ -12823,8 +12823,8 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
1282312823
LFS_ASSERT(lfs->cfg->gc_compact_thresh == (lfs_size_t)-1
1282412824
|| lfs->cfg->gc_compact_thresh <= lfs->cfg->block_size);
1282512825

12826-
// shrub_size must be <= block_size/4
12827-
LFS_ASSERT(lfs->cfg->shrub_size <= lfs->cfg->block_size/4);
12826+
// inline_size must be <= block_size/4
12827+
LFS_ASSERT(lfs->cfg->inline_size <= lfs->cfg->block_size/4);
1282812828
// fragment_size must be <= block_size/4
1282912829
LFS_ASSERT(lfs->cfg->fragment_size <= lfs->cfg->block_size/4);
1283012830

lfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ struct lfs_config {
438438
// blocksize/4.
439439
//
440440
// 0 disables shrubs.
441-
lfs_size_t shrub_size;
441+
lfs_size_t inline_size;
442442

443443
// Maximum size of a non-block B-tree leaf in bytes. Smaller values may
444444
// make small random-writes cheaper, but increase metadata overhead. Must

runners/bench_runner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
117117
BENCH_DEFINE(GC_FLAGS, 0 ) \
118118
BENCH_DEFINE(GC_STEPS, 0 ) \
119119
BENCH_DEFINE(GC_COMPACT_THRESH, 0 ) \
120-
BENCH_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
120+
BENCH_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
121121
BENCH_DEFINE(FRAGMENT_SIZE, BLOCK_SIZE/8 ) \
122122
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
123123
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
@@ -146,7 +146,7 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
146146
.lookahead_size = LOOKAHEAD_SIZE, \
147147
BENCH_GC_CFG \
148148
.gc_compact_thresh = GC_COMPACT_THRESH, \
149-
.shrub_size = SHRUB_SIZE, \
149+
.inline_size = INLINE_SIZE, \
150150
.fragment_size = FRAGMENT_SIZE, \
151151
.crystal_thresh = CRYSTAL_THRESH,
152152

runners/test_runner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
108108
TEST_DEFINE(GC_FLAGS, 0 ) \
109109
TEST_DEFINE(GC_STEPS, 0 ) \
110110
TEST_DEFINE(GC_COMPACT_THRESH, 0 ) \
111-
TEST_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
111+
TEST_DEFINE(INLINE_SIZE, BLOCK_SIZE/4 ) \
112112
TEST_DEFINE(FRAGMENT_SIZE, BLOCK_SIZE/8 ) \
113113
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
114114
TEST_DEFINE(ERASE_VALUE, 0xff ) \
@@ -137,7 +137,7 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
137137
.lookahead_size = LOOKAHEAD_SIZE, \
138138
TEST_GC_CFG \
139139
.gc_compact_thresh = GC_COMPACT_THRESH, \
140-
.shrub_size = SHRUB_SIZE, \
140+
.inline_size = INLINE_SIZE, \
141141
.fragment_size = FRAGMENT_SIZE, \
142142
.crystal_thresh = CRYSTAL_THRESH
143143

tests/test_ck.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ code = '''
16571657
defines.BADBIT = -1
16581658
defines.BADBLOCK_BEHAVIOR = 'LFS_EMUBD_BADBLOCK_PROGFLIP'
16591659
# force the file to create a btree
1660-
defines.SHRUB_SIZE = 0
1660+
defines.INLINE_SIZE = 0
16611661
defines.CRYSTAL_THRESH = -1
16621662
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
16631663
defines.SIZE = '2*FRAGMENT_SIZE'
@@ -1956,7 +1956,7 @@ code = '''
19561956
[cases.test_ck_ckfetches_btree]
19571957
defines.BADBIT = -1
19581958
# force the file to create a btree
1959-
defines.SHRUB_SIZE = 0
1959+
defines.INLINE_SIZE = 0
19601960
defines.CRYSTAL_THRESH = -1
19611961
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
19621962
defines.SIZE = '2*FRAGMENT_SIZE'
@@ -2213,7 +2213,7 @@ defines.BADBLOCK_BEHAVIOR = [
22132213
'LFS_EMUBD_BADBLOCK_READFLIP',
22142214
]
22152215
# force the file to create a btree
2216-
defines.SHRUB_SIZE = 0
2216+
defines.INLINE_SIZE = 0
22172217
defines.CRYSTAL_THRESH = -1
22182218
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
22192219
defines.SIZE = '2*FRAGMENT_SIZE'

tests/test_fwrite.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ code = '''
103103
defines.N = [0, 1, 2, 3, 4]
104104
defines.SIZE = 'N*FRAGMENT_SIZE'
105105
# force a btree node
106-
defines.SHRUB_SIZE = 0
106+
defines.INLINE_SIZE = 0
107107
defines.CRYSTAL_THRESH = -1
108108
defines.SYNC = [false, true]
109109
in = 'lfs.c'
@@ -487,7 +487,7 @@ defines.N = [0, 1, 2, 3, 4]
487487
defines.SIZE = 'N*FRAGMENT_SIZE'
488488
defines.CHUNK = [32, 8, 1]
489489
# force a btree node
490-
defines.SHRUB_SIZE = 0
490+
defines.INLINE_SIZE = 0
491491
defines.CRYSTAL_THRESH = -1
492492
defines.SYNC = [false, true]
493493
defines.REMOUNT = [false, true]

tests/test_powerloss.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ defines.POWERLOSS_BEHAVIOR = [
128128
]
129129
defines.MKCONSISTENT = [false, true]
130130
# inlining has a tendency to hide sync issues, so try without
131-
defines.SHRUB_SIZE = ['BLOCK_SIZE/4', '0']
131+
defines.INLINE_SIZE = ['BLOCK_SIZE/4', '0']
132132
defines.N = [1, 2, 4, 8, 16, 32, 64]
133133
defines.SIZE = [
134134
'0',
@@ -228,7 +228,7 @@ defines.POWERLOSS_BEHAVIOR = [
228228
]
229229
defines.MKCONSISTENT = [false, true]
230230
# inlining has a tendency to hide sync issues, so try without
231-
defines.SHRUB_SIZE = ['BLOCK_SIZE/4', '0']
231+
defines.INLINE_SIZE = ['BLOCK_SIZE/4', '0']
232232
defines.N = [1, 2, 4, 8, 16, 32, 64]
233233
defines.OPS = 256
234234
defines.SIZE = [
@@ -458,7 +458,7 @@ defines.POWERLOSS_BEHAVIOR = [
458458
]
459459
defines.MKCONSISTENT = [false, true]
460460
# inlining has a tendency to hide sync issues, so try without
461-
defines.SHRUB_SIZE = ['BLOCK_SIZE/4', '0']
461+
defines.INLINE_SIZE = ['BLOCK_SIZE/4', '0']
462462
# note dirs x files grows O(n^2)
463463
defines.N = [1, 2, 4, 8]
464464
defines.M = 'N'

tests/test_traversal.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ defines.LOOKAHEAD = [false, true]
22862286
defines.CKMETA = [false, true]
22872287
defines.CKDATA = [false, true]
22882288
defines.SIZE = '2*BLOCK_SIZE'
2289-
defines.SHRUB_SIZE = 0
2289+
defines.INLINE_SIZE = 0
22902290
defines.TRUNC = [false, true]
22912291
code = '''
22922292
lfs_t lfs;
@@ -2569,7 +2569,7 @@ defines.LOOKAHEAD = [false, true]
25692569
defines.CKMETA = [false, true]
25702570
defines.CKDATA = [false, true]
25712571
defines.SIZE = '2*BLOCK_SIZE'
2572-
defines.SHRUB_SIZE = 0
2572+
defines.INLINE_SIZE = 0
25732573
code = '''
25742574
lfs_t lfs;
25752575
lfsr_format(&lfs, LFS_F_RDWR, CFG) => 0;
@@ -2858,7 +2858,7 @@ defines.LOOKAHEAD = [false, true]
28582858
defines.CKMETA = [false, true]
28592859
defines.CKDATA = [false, true]
28602860
defines.SIZE = '2*BLOCK_SIZE'
2861-
defines.SHRUB_SIZE = 0
2861+
defines.INLINE_SIZE = 0
28622862
defines.DESYNC = [false, true]
28632863
code = '''
28642864
lfs_t lfs;
@@ -6652,7 +6652,7 @@ defines.LOOKAHEAD = [false, true]
66526652
defines.CKMETA = [false, true]
66536653
defines.CKDATA = [false, true]
66546654
# limit files to very simple btrees
6655-
defines.SHRUB_SIZE = 0
6655+
defines.INLINE_SIZE = 0
66566656
defines.CRYSTAL_THRESH = -1
66576657
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
66586658
defines.SIZE = '2*FRAGMENT_SIZE'
@@ -6812,7 +6812,7 @@ defines.LOOKAHEAD = [false, true]
68126812
defines.CKMETA = [false, true]
68136813
defines.CKDATA = [false, true]
68146814
# limit files to very simple btrees
6815-
defines.SHRUB_SIZE = 0
6815+
defines.INLINE_SIZE = 0
68166816
defines.CRYSTAL_THRESH = -1
68176817
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
68186818
defines.SIZE = '2*FRAGMENT_SIZE'
@@ -6971,7 +6971,7 @@ defines.CKMETA = [false, true]
69716971
defines.CKDATA = [false, true]
69726972
# this configuration should create a 2-layer bshrub, which may be
69736973
# a bit delicate
6974-
defines.SHRUB_SIZE = 'BLOCK_SIZE/4'
6974+
defines.INLINE_SIZE = 'BLOCK_SIZE/4'
69756975
defines.CRYSTAL_THRESH = -1
69766976
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
69776977
defines.SIZE = 'BLOCK_SIZE'
@@ -7140,7 +7140,7 @@ defines.CKMETA = [false, true]
71407140
defines.CKDATA = [false, true]
71417141
# this configuration should create a 2-layer bshrub, which may be
71427142
# a bit delicate
7143-
defines.SHRUB_SIZE = 'BLOCK_SIZE/4'
7143+
defines.INLINE_SIZE = 'BLOCK_SIZE/4'
71447144
defines.CRYSTAL_THRESH = -1
71457145
defines.FRAGMENT_SIZE = 'BLOCK_SIZE/8'
71467146
defines.SIZE = 'BLOCK_SIZE'

0 commit comments

Comments
 (0)