Zach Brown 76a73baefd scoutfs: don't lose items between segments
The refactoring of compaction to use the skip lists changed the nature
of item insertion.  Previously it would precisely count the number of
items to insert.  Now it discovers that the current output segment is
full by having _append_item() return false.

In this case the cursors currently point to the item that would have
been inserted but failed.  compact_items() caller loops around to
allocate the next segment.  Then it calls compact_items() again and it
mistakenly advances *past* the current item that still needed to be
inserted.

Hiding next_item() away from the segment loop made it hard to see this
mechanism.  Let's drop the compact_items() function and bring item
iteration and item appending into the main loop so we can more carefully
advance or not as we write and allocate new segments.

This stops losing items at segment boundaries.

Signed-off-by: Zach Brown <zab@versity.com>
2017-06-27 14:04:38 -07:00
Description
No description provided
8 MiB
Languages
C 87%
Shell 9.3%
Roff 2.5%
TeX 0.8%
Makefile 0.4%