dread: Fixed lingering orphans affecting dir positions

We need to adjust mids to ignore orphans during dir traversal, but we
shouldn't also adjust the dir position. In theory it shouldn't matter if
we use adjusted/non-adjusted dir positions, but it becomes a problem if
intermediate writes cause those orphans to be cleaned up. Now all your
dir positions are wrong.

Not entirely sure why this only started to fail with the bmap. I'm
guessing it's just due to the additional gstate causing the mdirs to
split differently.

Code changes minimal:

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

Tangential, but toss this on the pile of problems with dir positions.
I'm increasingly convinced we should just remove the concept if we can
get away with it.
This commit is contained in:
Christopher Haster
2025-07-29 01:59:30 -05:00
parent 726cccfe76
commit 047fb83b62
2 changed files with 0 additions and 4 deletions
-1
View File
@@ -12095,7 +12095,6 @@ int lfs3_dir_read(lfs3_t *lfs3, lfs3_dir_t *dir, struct lfs3_info *info) {
// skip orphans, we pretend these don't exist
if (tag == LFS3_TAG_ORPHAN) {
dir->h.mdir.mid += 1;
dir->pos += 1;
continue;
}
-3
View File
@@ -4,9 +4,6 @@
# are needed to validate the directory tree works
after = 'test_dirs'
# TODO bmap workaround?
ifndef = 'LFS3_BMAP'
# test some dir functions