mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-27 10:33:08 +00:00
Refilling a btree block by moving items from its siblings as it falls under the join threshold had some pretty serious mistakes. It used the target block's total item count instead of the siblings when deciding how many items to move. It didn't take item moving overruns into account when deciding to compact so it could run out of contiguous free space as it moved the last item. And once it compacted it returned without moving because the return was meant to be in the error case. This is all fixed by correctly examining the sibling block to determine if we should join a block up to 75% full or move a big chunk over, compacting if the free space doesn't have room for an excessive worst case overrun, and fixing the compaction error checking return typo. Signed-off-by: Zach Brown <zab@versity.com>