diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2017-01-09 10:12:25 -0800 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2017-01-09 10:12:25 -0800 |
| commit | 712517177d3f0df8ff8e402241d0f5a69208a95b (patch) | |
| tree | c20bb1beb8dfa95dd6023cca2e16845861742c47 /fs/btrfs/async-thread.c | |
| parent | aceae9be74c70f993ddd8d6a157f1a256591c43f (diff) | |
| parent | a3edc7b2e537e36bb26c94fa9efcc249ef3a5862 (diff) | |
Merge tag 'v4.4.40' into android-4.4.y
This is the 4.4.40 stable release
Diffstat (limited to 'fs/btrfs/async-thread.c')
| -rw-r--r-- | fs/btrfs/async-thread.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 9aba42b78253..a09264d8b853 100644 --- a/fs/btrfs/async-thread.c +++ b/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); |
