Renamed all -> partial in lfsr_mdir_alloc__

When you can't remember what a parameter does, it's probably a good sign
to change the name...

- all -> partial in lfsr_mdir_alloc_
- all -> relocated in relocate loops

This flips the true/false meaning in some places, but had no impact on
code size. Compilers can probably invert the representation of local
bools if it's useful anyways.
This commit is contained in:
Christopher Haster
2024-08-15 14:21:42 -05:00
parent 0dca8327a8
commit fa04c41f5c
+6 -6
View File
@@ -7413,11 +7413,11 @@ static int lfsr_mtree_lookup(lfs_t *lfs, lfsr_smid_t mid,
// low-level mdir operations needed by lfsr_mdir_commit // low-level mdir operations needed by lfsr_mdir_commit
static int lfsr_mdir_alloc__(lfs_t *lfs, lfsr_mdir_t *mdir, static int lfsr_mdir_alloc__(lfs_t *lfs, lfsr_mdir_t *mdir,
lfsr_smid_t mid, bool all) { lfsr_smid_t mid, bool partial) {
// assign the mid // assign the mid
mdir->mid = mid; mdir->mid = mid;
if (all) { if (!partial) {
// allocate one block without an erase // allocate one block without an erase
lfs_sblock_t block = lfs_alloc(lfs, false); lfs_sblock_t block = lfs_alloc(lfs, false);
if (block < 0) { if (block < 0) {
@@ -8105,7 +8105,7 @@ swap:;
relocate:; relocate:;
// needs relocation? bad prog? ok, try allocating a new mdir // needs relocation? bad prog? ok, try allocating a new mdir
err = lfsr_mdir_alloc__(lfs, &mdir_, mdir->mid, !relocated); err = lfsr_mdir_alloc__(lfs, &mdir_, mdir->mid, relocated);
if (err && !(err == LFS_ERR_NOSPC && !overcompacted)) { if (err && !(err == LFS_ERR_NOSPC && !overcompacted)) {
return err; return err;
} }
@@ -8317,15 +8317,15 @@ static int lfsr_mdir_commit(lfs_t *lfs, lfsr_mdir_t *mdir,
// shrubs are staged correctly // shrubs are staged correctly
bool left = lfsr_mid_rid(lfs, mdir->mid) < split_rid; bool left = lfsr_mid_rid(lfs, mdir->mid) < split_rid;
bool all = true; bool relocated = false;;
split_relocate:; split_relocate:;
// alloc and compact into new mdirs // alloc and compact into new mdirs
err = lfsr_mdir_alloc__(lfs, &mdir_[i^left], err = lfsr_mdir_alloc__(lfs, &mdir_[i^left],
lfs_smax(mdir->mid, 0), all); lfs_smax(mdir->mid, 0), relocated);
if (err) { if (err) {
goto failed; goto failed;
} }
all = false; relocated = true;
err = lfsr_mdir_compact__(lfs, &mdir_[i^left], err = lfsr_mdir_compact__(lfs, &mdir_[i^left],
mdir, mdir,