From 83f2a3c7fcd405e125eee8b79a8fc40e2032e259 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Mon, 15 Jul 2024 16:08:27 -0500 Subject: [PATCH] t: Fixed missing lfs_alloc_ckpoint in manual btree compaction Whoops! Turns out it's easy to forget to checkpoint the allocator when most standalone operations involve lfsr_mdir_commit which checkpoints the allocator automatically... This is also the only case where we are doing btree modifications outside of either file operations or mtree updates. Easy fix, code changes minimal: code stack before: 36280 2680 after: 36288 (+0.0%) 2680 (+0.0%) --- lfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lfs.c b/lfs.c index a555d555..27986d9a 100644 --- a/lfs.c +++ b/lfs.c @@ -8785,6 +8785,9 @@ dropped:; // compactions to work correctly LFS_ASSERT(lfsr_omdir_isopen(lfs, &t->o.o)); + // checkpoint the allocator + lfs_alloc_ckpoint(lfs); + if (t->o.o.state == LFSR_TSTATE_MTREE) { err = lfsr_btree_compact_(lfs, &t->o.bshrub.u.btree, // note we may be referencing the btree root here