mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-10 05:37:25 +00:00
dc47ec65e4a2db94bfb9c750b223a5a29fe223e6
We were using a trailing owner offset to iterate over btree item values from the back of the block towards the front. We did this to reclaim fragmented free space in a block to satisfy an allocation instead of having to split the block, which is expensive mostly because it has to allocate and free metadata blocks. In the before times, we used to compact items by sorting items by their offset, moving them, and then sorting them by their keys again. The sorting by keys was expensive so we added these owner offsets to be able to compact without sorting. But the complexity of maintaining the owner metadata is not worth it. We can avoid the expensive sorting by keys by allocating a temporary array of item offsets and sorting only it by the value offset. That's nice and quick, it was the key comparisons that were expensive. Then we can remove the owner offset entirely, as well as the block header final free region that compaction needed. And we also don't compact as often in the modern era because we do the bulk of our work in the item cache instead of in the btree, and we've changed the split/merge/compaction heuristics to avoid constantly splitting/merging/comapcting and an item population happens to hover right around a shared threshold. Signed-off-by: Zach Brown <zab@versity.com>
Description
No description provided
Languages
C
87.1%
Shell
9.2%
Roff
2.5%
TeX
0.9%
Makefile
0.3%