From 047fb83b62dcc9fdd833c633a20f73037758b67b Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 29 Jul 2025 01:59:30 -0500 Subject: [PATCH] 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. --- lfs3.c | 1 - tests/test_dread.toml | 3 --- 2 files changed, 4 deletions(-) diff --git a/lfs3.c b/lfs3.c index 33e062b1..167234bf 100644 --- a/lfs3.c +++ b/lfs3.c @@ -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; } diff --git a/tests/test_dread.toml b/tests/test_dread.toml index dbe6c067..c1469ecf 100644 --- a/tests/test_dread.toml +++ b/tests/test_dread.toml @@ -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