Tweaked lfs3_mdir_commit to imply lfs3_alloc_ckpoint

Now that lfs3_alloc_ckpoint is more complicated, and can error, it makes
sense for lfs3_alloc_ckpoint to be implied by lfs3_mdir_commit.

Most lfs3_mdir_commit calls represent an atomic transaction from one
state -> another, so this saves a bit of code:

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

                code          stack          ctx
  bmap before: 38512           2400          812
  bmap after:  38436 (-0.2%)   2400 (+0.0%)  812 (+0.0%)

The notable exception being bshrub-related commits in
lfs3_bshrub_commitroot_. Bshrub commits are trying to resolve an
in-flight btree, so the relevant blocks are very much _not_ at rest.

---

I've been hesitant to adopt this mostly just because it makes the
lfs3_mdir_commit* names even more of a mess:

- lfs3_mdir_commit__   -> lfs3_mdir_commit___
- lfs3_mdir_commit_    -> lfs3_mdir_commit__
- lfs3_mdir_commit     -> lfs3_mdir_commit_
- added lfs3_mdir_commit
- lfs3_mdir_compact    -> lfs3_mdir_compact_
- add lfs3_mdir_compact
- lfs3_mdir_alloc__    -> lfs3_mdir_alloc___
- lfs3_mdir_estimate__ -> lfs3_mdir_estimate___
- lfs3_mdir_swap__     -> lfs3_mdir_swap___
This commit is contained in:
Christopher Haster
2025-07-30 12:00:53 -05:00
parent 27e3e10634
commit 7289619859
2 changed files with 63 additions and 105 deletions
+2 -2
View File
@@ -6083,7 +6083,7 @@ code = '''
// we should not have split yet
assert(lfs3.mtree.r.weight == 0);
// we need internals to check this
lfs3_ssize_t estimate = lfs3_mdir_estimate__(&lfs3,
lfs3_ssize_t estimate = lfs3_mdir_estimate___(&lfs3,
&file1.b.h.mdir, -1, -1,
NULL);
assert(estimate >= 0);
@@ -6531,7 +6531,7 @@ code = '''
// we should not have split yet
assert(lfs3.mtree.r.weight == orig);
// we need internals to check this
lfs3_ssize_t estimate = lfs3_mdir_estimate__(&lfs3,
lfs3_ssize_t estimate = lfs3_mdir_estimate___(&lfs3,
&file2.b.h.mdir, -1, -1,
NULL);
assert(estimate >= 0);