mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
btrfs: avoid unnecessary reclaim calculation in priority_reclaim_metadata_space()
If the given ticket was already served (its ->bytes is 0), then we wasted time calculating the metadata reclaim size. So calculate it only after we checked the ticket was not yet served. 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:
parent
4ddb077378
commit
afbc047ab0
|
|
@ -1501,7 +1501,6 @@ static void priority_reclaim_metadata_space(struct btrfs_space_info *space_info,
|
|||
int flush_state = 0;
|
||||
|
||||
spin_lock(&space_info->lock);
|
||||
to_reclaim = btrfs_calc_reclaim_metadata_size(space_info);
|
||||
/*
|
||||
* This is the priority reclaim path, so to_reclaim could be >0 still
|
||||
* because we may have only satisfied the priority tickets and still
|
||||
|
|
@ -1513,6 +1512,8 @@ static void priority_reclaim_metadata_space(struct btrfs_space_info *space_info,
|
|||
return;
|
||||
}
|
||||
|
||||
to_reclaim = btrfs_calc_reclaim_metadata_size(space_info);
|
||||
|
||||
while (flush_state < states_nr) {
|
||||
spin_unlock(&space_info->lock);
|
||||
flush_space(space_info, to_reclaim, states[flush_state], false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user