Files
scoutfs/kmod/src/compact.h
Zach Brown 822ce205c5 Let compaction skip segments as needed
Previously the only clever compaction avoidance we'd try was in the
manifest walk.  If we found that there were no overlapping segments in
the next level we'd just move the entry down a level and skip compaction
entirely.

But that's just one specific instance of the general case: either of the
lower or upper segments don't overlap with each other.  There can be
many lower level segments that intersect with the full range of keys in
the upper level segment but which don't actually intersect with any
items in the upper segment.

So we refactor the compaction to notice this case.  We get the first and
last keys and use them to skip each segment as we first start to iterate
through it.

We don't want to read segments that we never actually have to copy items
from so we read each segment on demand instead of concurrently as the
compaction starts.  This means that item iteration can now have to read
a segment and can now return errors.

Signed-off-by: Zach Brown <zab@versity.com>
2017-04-18 13:44:54 -07:00

13 lines
356 B
C

#ifndef _SCOUTFS_COMPACT_H_
#define _SCOUTFS_COMPACT_H_
void scoutfs_compact_kick(struct super_block *sb);
int scoutfs_compact_add(struct super_block *sb, void *data, struct kvec *first,
struct kvec *last, u64 segno, u64 seq, u8 level);
int scoutfs_compact_setup(struct super_block *sb);
void scoutfs_compact_destroy(struct super_block *sb);
#endif