gbmap: Added an lfs3_alloc_ckpoint to lfs3_fs_mkconsistent

lfs3_fs_mkconsistent is already limited to call sites where
lfs3_alloc_ckpoint is valid (lfs3_fs_mkconsistent internally relies on
lfs3_mdir_commit), so might as well include an unconditional
lfs3_alloc_ckpoint to populate allocators and save some code:

                       code          stack          ctx
  no-gbmap before:    37168           2352          684
  no-gbmap after:     37164 (-0.0%)   2352 (+0.0%)  684 (+0.0%)

                       code          stack          ctx
  maybe-gbmap before: 39720           2376          848
  maybe-gbmap after:  39708 (-0.0%)   2376 (+0.0%)  848 (+0.0%)

                       code          stack          ctx
  yes-gbmap before:   39208           2376          848
  yes-gbmap after:    39204 (-0.0%)   2376 (+0.0%)  848 (+0.0%)
This commit is contained in:
Christopher Haster
2025-10-12 14:09:56 -05:00
parent 61dc21ccb7
commit 5bfa2a1071

17
lfs3.c
View File

@ -16824,6 +16824,16 @@ int lfs3_fs_mkconsistent(lfs3_t *lfs3) {
}
}
// go ahead and checkpoint the allocator
//
// this isn't always needed, but redundant alloc ckpoints are noops,
// so might as well to eagerly populate allocators and save some
// code
int err = lfs3_alloc_ckpoint(lfs3);
if (err) {
return err;
}
return 0;
}
#endif
@ -17137,13 +17147,6 @@ int lfs3_fs_mkgbmap(lfs3_t *lfs3) {
return err;
}
// checkpoint the allocator
// TODO, should lfs3_fs_mkconsistent also checkpoint the allocator?
err = lfs3_alloc_ckpoint(lfs3);
if (err) {
return err;
}
// create an empty gbmap
lfs3_gbmap_init(&lfs3->gbmap);