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 <nbori...@suse.com>
Signed-off-by: Josef Bacik <jo...@toxicpanda.com>
---
 fs/btrfs/space-info.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index e68cd73b4222..c3c586b33b4b 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -812,6 +812,13 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info 
*fs_info,
        if ((space_info->bytes_used + space_info->bytes_reserved) >= thresh)
                return 0;
 
+       /*
+        * We have tickets queued, bail so we don't compete with the async
+        * flushers.
+        */
+       if (space_info->reclaim_size)
+               return 0;
+
        if (!btrfs_calc_reclaim_metadata_size(fs_info, space_info))
                return 0;
 
-- 
2.26.2

Reply via email to