• Josef Bacik's avatar
    btrfs: rework btrfs_calc_reclaim_metadata_size · 9f42d377
    Josef Bacik authored
    
    
    Currently btrfs_calc_reclaim_metadata_size does two things, it returns
    the space currently required for flushing by the tickets, and if there
    are no tickets it calculates a value for the preemptive flushing.
    
    However for the normal ticketed flushing we really only care about the
    space required for tickets.  We will accidentally come in and flush one
    time, but as soon as we see there are no tickets we bail out of our
    flushing.
    
    Fix this by making btrfs_calc_reclaim_metadata_size really only tell us
    what is required for flushing if we have people waiting on space.  Then
    move the preemptive flushing logic into need_preemptive_reclaim().  We
    ignore btrfs_calc_reclaim_metadata_size() in need_preemptive_reclaim()
    because if we are in this path then we made our reservation and there
    are not pending tickets currently, so we do not need to check it, simply
    do the fuzzy logic to check if we're getting low on space.
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    9f42d377
space-info.c 50 KB