btrfs_balance_delayed_items is the sole caller of
btrfs_wq_run_delayed_node and already includes one of the checks whether
the delayed inodes should be run. On the other hand
btrfs_wq_run_delayed_node duplicates that check and performs an
additional one for wq congestion.
Let's remove the duplicate check and move the congestion one in
btrfs_balance_delayed_items, leaving btrfs_wq_run_delayed_node to only
care about setting up the wq run. No functional changes.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
 {
        struct btrfs_async_delayed_work *async_work;
 
-       if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND ||
-           btrfs_workqueue_normal_congested(fs_info->delayed_workers))
-               return 0;
-
        async_work = kmalloc(sizeof(*async_work), GFP_NOFS);
        if (!async_work)
                return -ENOMEM;
 {
        struct btrfs_delayed_root *delayed_root = fs_info->delayed_root;
 
-       if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND)
+       if ((atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND) ||
+               btrfs_workqueue_normal_congested(fs_info->delayed_workers))
                return;
 
        if (atomic_read(&delayed_root->items) >= BTRFS_DELAYED_WRITEBACK) {