gbmap: Added support for gbmap in lfs3_fs_grow

In lfs3_fs_grow, we need to update any gbmaps to match the new disk
size. The actual patch to the gbmap is easy, but it does get a bit
delicate since we need to feed the gbmap with an allocator in the new
disk size.

Fortunately, the opportunistism of the gbmap allocator avoids any
catch-22 issues, as long as we make sure to not trigger any gbmap
rebuilds.

Adds a bit of code, but not much:

                 code          stack          ctx
  before:       37168           2352          684
  after:        37168 (+0.0%)   2352 (+0.0%)  684 (+0.0%)

                 code          stack          ctx
  gbmap before: 39000           2456          800
  gbmap after:  39116 (+0.3%)   2456 (+0.0%)  800 (+0.0%)
This commit is contained in:
Christopher Haster
2025-10-10 13:44:40 -05:00
parent 24d75a24c5
commit 9e45249b29
7 changed files with 196 additions and 112 deletions
+6 -5
View File
@@ -9,7 +9,8 @@
#
after = ['test_mtree', 'test_gbmap', 'test_dirs', 'test_files']
defines.INIT_BLOCKS = 'LFS3_IFDEF_GBMAP(3, 2)'
defines.FORMAT_BLOCK_COUNT = 'LFS3_IFDEF_YES_GBMAP(3, 2)'
# test that we can alloc
[cases.test_alloc_alloc]
@@ -22,7 +23,7 @@ defines.COUNT = [
'2',
]
defines.ERASE = [false, true]
if = 'COUNT >= INIT_BLOCKS'
if = 'COUNT >= FORMAT_BLOCK_COUNT'
in = 'lfs3.c'
code = '''
// test various block counts
@@ -69,7 +70,7 @@ defines.COUNT = [
'2',
]
defines.ERASE = [false, true]
if = 'COUNT >= INIT_BLOCKS'
if = 'COUNT >= FORMAT_BLOCK_COUNT'
in = 'lfs3.c'
code = '''
// test various block counts
@@ -655,7 +656,7 @@ defines.COUNT = [
'5',
'2',
]
if = 'COUNT >= INIT_BLOCKS'
if = 'COUNT >= FORMAT_BLOCK_COUNT'
code = '''
// test various block counts
struct lfs3_cfg cfg = *CFG;
@@ -738,7 +739,7 @@ defines.SIZE = [
'2*BLOCK_SIZE',
'8*BLOCK_SIZE',
]
if = 'COUNT >= INIT_BLOCKS'
if = 'COUNT >= FORMAT_BLOCK_COUNT'
code = '''
// test various block counts
struct lfs3_cfg cfg = *CFG;