diff options
author | Josef Bacik <[email protected]> | 2021-04-28 13:38:44 -0400 |
---|---|---|
committer | David Sterba <[email protected]> | 2021-06-21 15:19:04 +0200 |
commit | 610a6ef44ea83ef1c1e10b8270bbd157fbde3181 (patch) | |
tree | 82bf6343b8070932618d91e579360fdf1d6014e8 | |
parent | 0aae4ca9e952b83f71ce50af1290f0f5d9ab9df6 (diff) |
btrfs: take into account global rsv in need_preemptive_reclaim
Global rsv can't be used for normal allocations, and for very full file
systems we can decide to try and async flush constantly even though
there's really not a lot of space to reclaim. Deal with this by
including the global block rsv size in the "total used" calculation.
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
Signed-off-by: David Sterba <[email protected]>
-rw-r--r-- | fs/btrfs/space-info.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 33edab17af0d..e341f995a7dd 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -792,12 +792,14 @@ btrfs_calc_reclaim_metadata_size(struct btrfs_fs_info *fs_info, static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info, struct btrfs_space_info *space_info) { + u64 global_rsv_size = fs_info->global_block_rsv.reserved; u64 ordered, delalloc; u64 thresh = div_factor_fine(space_info->total_bytes, 98); u64 used; /* If we're just plain full then async reclaim just slows us down. */ - if ((space_info->bytes_used + space_info->bytes_reserved) >= thresh) + if ((space_info->bytes_used + space_info->bytes_reserved + + global_rsv_size) >= thresh) return false; /* |