mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
btrfs: bail out earlier from need_preemptive_reclaim() if we have tickets
Instead of doing some calculations and then return false if it turns out we have queued tickets, check first if we have tickets and return false immediately if we have tickets, without wasting time on doing those computations. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
6f4779faa0
commit
49f204be22
@@ -937,10 +937,17 @@ static bool need_preemptive_reclaim(const struct btrfs_space_info *space_info)
|
||||
u64 thresh;
|
||||
u64 used;
|
||||
|
||||
thresh = mult_perc(space_info->total_bytes, 90);
|
||||
|
||||
lockdep_assert_held(&space_info->lock);
|
||||
|
||||
/*
|
||||
* We have tickets queued, bail so we don't compete with the async
|
||||
* flushers.
|
||||
*/
|
||||
if (space_info->reclaim_size)
|
||||
return false;
|
||||
|
||||
thresh = mult_perc(space_info->total_bytes, 90);
|
||||
|
||||
/* If we're just plain full then async reclaim just slows us down. */
|
||||
if ((space_info->bytes_used + space_info->bytes_reserved +
|
||||
global_rsv_size) >= thresh)
|
||||
@@ -960,13 +967,6 @@ static bool need_preemptive_reclaim(const struct btrfs_space_info *space_info)
|
||||
if (used - global_rsv_size <= SZ_128M)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* We have tickets queued, bail so we don't compete with the async
|
||||
* flushers.
|
||||
*/
|
||||
if (space_info->reclaim_size)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* If we have over half of the free space occupied by reservations or
|
||||
* pinned then we want to start flushing.
|
||||
|
||||
Reference in New Issue
Block a user