• Boris Burkov's avatar
    btrfs: periodic block_group reclaim · e4ca3932
    Boris Burkov authored
    We currently employ a edge-triggered block group reclaim strategy which
    marks block groups for reclaim as they free down past a threshold.
    
    With a dynamic threshold, this is worse than doing it in a
    level-triggered fashion periodically. That is because the reclaim
    itself happens periodically, so the threshold at that point in time is
    what really matters, not the threshold at freeing time. If we mark the
    reclaim in a big pass, then sort by usage and do reclaim, we also
    benefit from a negative feedback loop preventing unnecessary reclaims as
    we crunch through the "best" candidates.
    
    Since this is quite a different model, it requires some additional
    support. The edge triggered reclaim has a good heuristic for not
    reclaiming fresh block groups, so we need to replace that with a typical
    GC sweep mark which skips block groups that have seen an allocation
    since the last sweep.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarBoris Burkov <boris@bur.io>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    e4ca3932
space-info.h 8.34 KB