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>
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
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);