aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/async-thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/async-thread.c')
-rw-r--r--fs/btrfs/async-thread.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index e0f071f6b5a7..63d197724519 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -86,6 +86,20 @@ btrfs_work_owner(struct btrfs_work *work)
86 return work->wq->fs_info; 86 return work->wq->fs_info;
87} 87}
88 88
89bool btrfs_workqueue_normal_congested(struct btrfs_workqueue *wq)
90{
91 /*
92 * We could compare wq->normal->pending with num_online_cpus()
93 * to support "thresh == NO_THRESHOLD" case, but it requires
94 * moving up atomic_inc/dec in thresh_queue/exec_hook. Let's
95 * postpone it until someone needs the support of that case.
96 */
97 if (wq->normal->thresh == NO_THRESHOLD)
98 return false;
99
100 return atomic_read(&wq->normal->pending) > wq->normal->thresh * 2;
101}
102
89BTRFS_WORK_HELPER(worker_helper); 103BTRFS_WORK_HELPER(worker_helper);
90BTRFS_WORK_HELPER(delalloc_helper); 104BTRFS_WORK_HELPER(delalloc_helper);
91BTRFS_WORK_HELPER(flush_delalloc_helper); 105BTRFS_WORK_HELPER(flush_delalloc_helper);