From ad4051b5a24627b2d5cc62b001e60601c2a52ccf Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 17 Jul 2024 03:12:16 -0500 Subject: [PATCH] Don't bother closing lfs->gc in lfsr_unmount It makes the the are-any-files-still-open assert a bit uglier, but we really don't need to bother calling lfsr_omdir_close here. We're done with this struct anyways... Not doing something saves a bit of code: code stack before: 36240 2680 after: 36208 (-0.1%) 2680 (+0.0%) --- lfs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lfs.c b/lfs.c index 8bf77e38..1bac2b45 100644 --- a/lfs.c +++ b/lfs.c @@ -12677,13 +12677,10 @@ failed:; } int lfsr_unmount(lfs_t *lfs) { - // close any ongoing gc traversals - if (lfsr_omdir_isopen(lfs, &lfs->gc.o.o)) { - lfsr_omdir_close(lfs, &lfs->gc.o.o); - } - // all files/dirs should be closed before lfsr_unmount - LFS_ASSERT(lfs->omdirs == NULL); + LFS_ASSERT(lfs->omdirs == NULL + || (lfs->omdirs == &lfs->gc.o.o + && lfs->gc.o.o.next == NULL)); return lfs_deinit(lfs); }