summaryrefslogtreecommitdiff
path: root/fs/btrfs/async-thread.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-08-15 15:34:17 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:06 -0400
commit4854ddd0ed0a687fc2d7c45a529c406232e31e7b (patch)
tree6de9774969875cc30c21c96e145294727c56e73b /fs/btrfs/async-thread.c
parent5443be45f5cb57d02fd895a0bcaf7e7d9890b1df (diff)
downloadlinux-stable-4854ddd0ed0a687fc2d7c45a529c406232e31e7b.tar.gz
linux-stable-4854ddd0ed0a687fc2d7c45a529c406232e31e7b.tar.bz2
linux-stable-4854ddd0ed0a687fc2d7c45a529c406232e31e7b.zip
Btrfs: Wait for kernel threads to make progress during async submission
Before this change, btrfs would use a bdi congestion function to make sure there weren't too many pending async checksum work items. This change makes the process creating async work items wait instead, leading to fewer congestion returns from the bdi. This improves pdflush background_writeout scanning. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/async-thread.c')
-rw-r--r--fs/btrfs/async-thread.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index 5f2f5a8c2289..958cd8b5f0d7 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -48,6 +48,7 @@ struct btrfs_worker_thread {
/* number of things on the pending list */
atomic_t num_pending;
+ unsigned long sequence;
/* protects the pending list. */
spinlock_t lock;
@@ -197,6 +198,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
spin_lock_irq(&workers->lock);
list_add_tail(&worker->worker_list, &workers->idle_list);
+ worker->idle = 1;
workers->num_workers++;
spin_unlock_irq(&workers->lock);
}
@@ -238,7 +240,10 @@ static struct btrfs_worker_thread *next_worker(struct btrfs_workers *workers)
*/
next = workers->worker_list.next;
worker = list_entry(next, struct btrfs_worker_thread, worker_list);
- list_move_tail(next, &workers->worker_list);
+ atomic_inc(&worker->num_pending);
+ worker->sequence++;
+ if (worker->sequence % 4 == 0)
+ list_move_tail(next, &workers->worker_list);
return worker;
}