bmap: Added error propagation to ckpoints and cleaned up test TODOs

The main change is error propagation in lfs3_alloc_ckpoint. Since
lfs3_alloc_ckpoint writes to disk during bmap rebuilds, it can now fail
in all sorts of ways. Fortunately lfs3_alloc_ckpoint should only ever be
called by write operations, where these errors are be expected.

With bmap rebuild errors now reported correctly, this unblocks most of
the remaining test TODOs:

- Passing test_badblocks
- Passing test_ck
- Passing test_trvs

With this, LFS3_YES_BMAP is now passing all but two tests, which are
still ifndef-disabled as a temporary measure:

- test_btree - We make some low-level assumptions about the lookahead
  allocator when testing btrees. It's probably not worth trying to get
  this passing with the bmap allocator.

- test_grow - This one does need fixing! We currently don't update
  on-disk bmaps correctly when growing the filesystem.

Code changes minimal:

                code          stack          ctx
  before:      36912           2368          684
  after:       36912 (+0.0%)   2368 (+0.0%)  684 (+0.0%)

                code          stack          ctx
  bmap before: 38456           2400          812
  bmap after:  38512 (+0.1%)   2400 (+0.0%)  812 (+0.0%)
This commit is contained in:
Christopher Haster
2025-07-30 11:44:36 -05:00
parent 41be512272
commit 27e3e10634
6 changed files with 580 additions and 172 deletions
+5 -9
View File
@@ -9,11 +9,7 @@
#
after = ['test_mtree', 'test_bmap', 'test_dirs', 'test_files']
# TODO should we rename these to test_lookahead?
# TODO or extend to test the bmap as well?
#
# these are really tuned to test the lookahead allocator
#ifndef = 'LFS3_BMAP'
defines.INIT_BLOCKS = 'LFS3_IFDEF_BMAP(3, 2)'
# test that we can alloc
[cases.test_alloc_alloc]
@@ -26,7 +22,7 @@ defines.COUNT = [
'2',
]
defines.ERASE = [false, true]
if = 'COUNT >= LFS3_IFDEF_BMAP(3, 2)'
if = 'COUNT >= INIT_BLOCKS'
in = 'lfs3.c'
code = '''
// test various block counts
@@ -73,7 +69,7 @@ defines.COUNT = [
'2',
]
defines.ERASE = [false, true]
if = 'COUNT >= LFS3_IFDEF_BMAP(3, 2)'
if = 'COUNT >= INIT_BLOCKS'
in = 'lfs3.c'
code = '''
// test various block counts
@@ -659,7 +655,7 @@ defines.COUNT = [
'5',
'2',
]
if = 'COUNT >= LFS3_IFDEF_BMAP(3, 2)'
if = 'COUNT >= INIT_BLOCKS'
code = '''
// test various block counts
struct lfs3_cfg cfg = *CFG;
@@ -742,7 +738,7 @@ defines.SIZE = [
'2*BLOCK_SIZE',
'8*BLOCK_SIZE',
]
if = 'COUNT >= LFS3_IFDEF_BMAP(3, 2)'
if = 'COUNT >= INIT_BLOCKS'
code = '''
// test various block counts
struct lfs3_cfg cfg = *CFG;