diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 53677ecb8c15..bd206fc300e7 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -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.