X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Ffs%2Fbtrfs%2Fasync-thread.c;h=a09264d8b853312057ee3502d5ae10256b78196c;hb=52f993b8e89487ec9ee15a7fb4979e0f09a45b27;hp=9aba42b78253e33a2d0d1d6a06f83ba0cf122ad0;hpb=c189ccac5702322ed843fe17057035b7222a59b6;p=kvmfornfv.git diff --git a/kernel/fs/btrfs/async-thread.c b/kernel/fs/btrfs/async-thread.c index 9aba42b78..a09264d8b 100644 --- a/kernel/fs/btrfs/async-thread.c +++ b/kernel/fs/btrfs/async-thread.c @@ -70,6 +70,20 @@ void btrfs_##name(struct work_struct *arg) \ normal_work_helper(work); \ } +bool btrfs_workqueue_normal_congested(struct btrfs_workqueue *wq) +{ + /* + * We could compare wq->normal->pending with num_online_cpus() + * to support "thresh == NO_THRESHOLD" case, but it requires + * moving up atomic_inc/dec in thresh_queue/exec_hook. Let's + * postpone it until someone needs the support of that case. + */ + if (wq->normal->thresh == NO_THRESHOLD) + return false; + + return atomic_read(&wq->normal->pending) > wq->normal->thresh * 2; +} + BTRFS_WORK_HELPER(worker_helper); BTRFS_WORK_HELPER(delalloc_helper); BTRFS_WORK_HELPER(flush_delalloc_helper);