btrfs: check reclaim_size in need_preemptive_reclaim
authorJosef Bacik <josef@toxicpanda.com>
Fri, 9 Oct 2020 13:28:24 +0000 (09:28 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Feb 2021 21:58:58 +0000 (22:58 +0100)
If we're flushing space for tickets then we have
space_info->reclaim_size set and we do not need to do background
reclaim.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c

index effb9b73a4187c559a31304b66408379a7b16daf..9f30d6837eb5bb8ed000aad422cc304b7a7a2a21 100644 (file)
@@ -818,6 +818,13 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
        if ((space_info->bytes_used + space_info->bytes_reserved) >= thresh)
                return false;
 
+       /*
+        * We have tickets queued, bail so we don't compete with the async
+        * flushers.
+        */
+       if (space_info->reclaim_size)
+               return false;
+
        if (!btrfs_calc_reclaim_metadata_size(fs_info, space_info))
                return false;