Skip to content

Commit a9b061a

Browse files
committed
Dropped lfs->cfg->inline_size
Now that we no longer have bmoss files, inline_size and shrub_size are effectively the same thing. We weren't using this, so no code change, but it does save a word of ctx: code stack ctx before: 36280 2576 640 after: 36280 (+0.0%) 2576 (+0.0%) 636 (-0.6%)
1 parent f7449ae commit a9b061a

File tree

8 files changed

+24
-39
lines changed

8 files changed

+24
-39
lines changed

lfs.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10717,15 +10717,6 @@ static inline lfs_size_t lfsr_file_buffersize(lfs_t *lfs,
1071710717
: lfs->cfg->file_buffer_size;
1071810718
}
1071910719

10720-
static inline lfs_size_t lfsr_file_inlinesize(lfs_t *lfs,
10721-
const lfsr_file_t *file) {
10722-
return lfs_min(
10723-
lfsr_file_buffersize(lfs, file),
10724-
lfs_min(
10725-
lfs->cfg->inline_size,
10726-
lfs->cfg->fragment_size));
10727-
}
10728-
1072910720
static inline lfs_off_t lfsr_file_size_(const lfsr_file_t *file) {
1073010721
return lfs_max(
1073110722
file->buffer.pos + file->buffer.size,
@@ -12832,8 +12823,6 @@ static int lfs_init(lfs_t *lfs, uint32_t flags,
1283212823
LFS_ASSERT(lfs->cfg->gc_compact_thresh == (lfs_size_t)-1
1283312824
|| lfs->cfg->gc_compact_thresh <= lfs->cfg->block_size);
1283412825

12835-
// inline_size must be <= block_size/4
12836-
LFS_ASSERT(lfs->cfg->inline_size <= lfs->cfg->block_size/4);
1283712826
// shrub_size must be <= block_size/4
1283812827
LFS_ASSERT(lfs->cfg->shrub_size <= lfs->cfg->block_size/4);
1283912828
// fragment_size must be <= block_size/4

lfs.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,17 @@ struct lfs_config {
422422
// // can help bound the metadata compaction time. Must be <= block_size.
423423
// // Defaults to block_size when zero.
424424
// lfs_size_t metadata_max;
425+
//
426+
// // Maximum size of inlined files in bytes. Inlined files decrease storage
427+
// // requirements, but may impact metadata-related performance. Must be <=
428+
// // block_size/4.
429+
// //
430+
// // 0 disables inline files.
431+
// lfs_size_t inline_size;
425432

426433
// TODO these are pretty low-level details, should we have reasonable
427434
// defaults? need to benchmark.
428435

429-
// Maximum size on inlined files in bytes. Inlined files decrease storage
430-
// requirements, but may impact metadata-related performance. Must be <=
431-
// block_size/4.
432-
//
433-
// 0 disables inline files.
434-
lfs_size_t inline_size;
435-
436436
// Maximum size of inlined trees (shrubs) in bytes. Shrubs reduce B-tree
437437
// root overhead, but may impact metadata-related performance. Must be <=
438438
// blocksize/4.

runners/bench_runner.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +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(INLINE_SIZE, BLOCK_SIZE/4 ) \
121-
BENCH_DEFINE(SHRUB_SIZE, INLINE_SIZE ) \
120+
BENCH_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
122121
BENCH_DEFINE(FRAGMENT_SIZE, BLOCK_SIZE/8 ) \
123122
BENCH_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
124123
BENCH_DEFINE(ERASE_VALUE, 0xff ) \
@@ -147,7 +146,6 @@ void bench_permutation(size_t i, uint32_t *buffer, size_t size);
147146
.lookahead_size = LOOKAHEAD_SIZE, \
148147
BENCH_GC_CFG \
149148
.gc_compact_thresh = GC_COMPACT_THRESH, \
150-
.inline_size = INLINE_SIZE, \
151149
.shrub_size = SHRUB_SIZE, \
152150
.fragment_size = FRAGMENT_SIZE, \
153151
.crystal_thresh = CRYSTAL_THRESH,

runners/test_runner.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +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(INLINE_SIZE, BLOCK_SIZE/4 ) \
112-
TEST_DEFINE(SHRUB_SIZE, INLINE_SIZE ) \
111+
TEST_DEFINE(SHRUB_SIZE, BLOCK_SIZE/4 ) \
113112
TEST_DEFINE(FRAGMENT_SIZE, BLOCK_SIZE/8 ) \
114113
TEST_DEFINE(CRYSTAL_THRESH, BLOCK_SIZE/8 ) \
115114
TEST_DEFINE(ERASE_VALUE, 0xff ) \
@@ -138,7 +137,6 @@ void test_permutation(size_t i, uint32_t *buffer, size_t size);
138137
.lookahead_size = LOOKAHEAD_SIZE, \
139138
TEST_GC_CFG \
140139
.gc_compact_thresh = GC_COMPACT_THRESH, \
141-
.inline_size = INLINE_SIZE, \
142140
.shrub_size = SHRUB_SIZE, \
143141
.fragment_size = FRAGMENT_SIZE, \
144142
.crystal_thresh = CRYSTAL_THRESH

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.INLINE_SIZE = 0
1660+
defines.SHRUB_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.INLINE_SIZE = 0
1959+
defines.SHRUB_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.INLINE_SIZE = 0
2216+
defines.SHRUB_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.INLINE_SIZE = 0
106+
defines.SHRUB_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.INLINE_SIZE = 0
490+
defines.SHRUB_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.INLINE_SIZE = ['BLOCK_SIZE/4', '0']
131+
defines.SHRUB_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.INLINE_SIZE = ['BLOCK_SIZE/4', '0']
231+
defines.SHRUB_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.INLINE_SIZE = ['BLOCK_SIZE/4', '0']
461+
defines.SHRUB_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.INLINE_SIZE = 0
2289+
defines.SHRUB_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.INLINE_SIZE = 0
2572+
defines.SHRUB_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.INLINE_SIZE = 0
2861+
defines.SHRUB_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.INLINE_SIZE = 0
6655+
defines.SHRUB_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.INLINE_SIZE = 0
6815+
defines.SHRUB_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.INLINE_SIZE = 'BLOCK_SIZE/4'
6974+
defines.SHRUB_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.INLINE_SIZE = 'BLOCK_SIZE/4'
7143+
defines.SHRUB_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)