aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-08-15 15:34:16 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:06 -0400
commit5443be45f5cb57d02fd895a0bcaf7e7d9890b1df (patch)
tree88666dedb8b6e3fa0f693d76a11a05cba29ec13e
parent777e6bd706ee40897545463871de5b456fbc46dc (diff)
Btrfs: Give all the worker threads descriptive names
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/async-thread.c7
-rw-r--r--fs/btrfs/async-thread.h5
-rw-r--r--fs/btrfs/disk-io.c22
3 files changed, 24 insertions, 10 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c
index bc2980c433ef..5f2f5a8c2289 100644
--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -153,7 +153,7 @@ int btrfs_stop_workers(struct btrfs_workers *workers)
153/* 153/*
154 * simple init on struct btrfs_workers 154 * simple init on struct btrfs_workers
155 */ 155 */
156void btrfs_init_workers(struct btrfs_workers *workers, int max) 156void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max)
157{ 157{
158 workers->num_workers = 0; 158 workers->num_workers = 0;
159 INIT_LIST_HEAD(&workers->worker_list); 159 INIT_LIST_HEAD(&workers->worker_list);
@@ -161,6 +161,7 @@ void btrfs_init_workers(struct btrfs_workers *workers, int max)
161 spin_lock_init(&workers->lock); 161 spin_lock_init(&workers->lock);
162 workers->max_workers = max; 162 workers->max_workers = max;
163 workers->idle_thresh = 32; 163 workers->idle_thresh = 32;
164 workers->name = name;
164} 165}
165 166
166/* 167/*
@@ -184,7 +185,9 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers)
184 INIT_LIST_HEAD(&worker->worker_list); 185 INIT_LIST_HEAD(&worker->worker_list);
185 spin_lock_init(&worker->lock); 186 spin_lock_init(&worker->lock);
186 atomic_set(&worker->num_pending, 0); 187 atomic_set(&worker->num_pending, 0);
187 worker->task = kthread_run(worker_loop, worker, "btrfs"); 188 worker->task = kthread_run(worker_loop, worker,
189 "btrfs-%s-%d", workers->name,
190 workers->num_workers + i);
188 worker->workers = workers; 191 worker->workers = workers;
189 if (IS_ERR(worker->task)) { 192 if (IS_ERR(worker->task)) {
190 kfree(worker); 193 kfree(worker);
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h
index 3436ff897597..43e44d115dd1 100644
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -69,11 +69,14 @@ struct btrfs_workers {
69 69
70 /* lock for finding the next worker thread to queue on */ 70 /* lock for finding the next worker thread to queue on */
71 spinlock_t lock; 71 spinlock_t lock;
72
73 /* extra name for this worker */
74 char *name;
72}; 75};
73 76
74int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work); 77int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work);
75int btrfs_start_workers(struct btrfs_workers *workers, int num_workers); 78int btrfs_start_workers(struct btrfs_workers *workers, int num_workers);
76int btrfs_stop_workers(struct btrfs_workers *workers); 79int btrfs_stop_workers(struct btrfs_workers *workers);
77void btrfs_init_workers(struct btrfs_workers *workers, int max); 80void btrfs_init_workers(struct btrfs_workers *workers, char *name, int max);
78int btrfs_requeue_work(struct btrfs_work *work); 81int btrfs_requeue_work(struct btrfs_work *work);
79#endif 82#endif
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 9601b13c7d7a..1bf210dadef6 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -492,11 +492,11 @@ static int __btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
492 492
493 /* 493 /*
494 * when we're called for a write, we're already in the async 494 * when we're called for a write, we're already in the async
495 * submission context. Just jump ingo btrfs_map_bio 495 * submission context. Just jump into btrfs_map_bio
496 */ 496 */
497 if (rw & (1 << BIO_RW)) { 497 if (rw & (1 << BIO_RW)) {
498 return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio, 498 return btrfs_map_bio(BTRFS_I(inode)->root, rw, bio,
499 mirror_num, 0); 499 mirror_num, 1);
500 } 500 }
501 501
502 /* 502 /*
@@ -528,6 +528,12 @@ static int btree_writepage(struct page *page, struct writeback_control *wbc)
528{ 528{
529 struct extent_io_tree *tree; 529 struct extent_io_tree *tree;
530 tree = &BTRFS_I(page->mapping->host)->io_tree; 530 tree = &BTRFS_I(page->mapping->host)->io_tree;
531
532 if (current->flags & PF_MEMALLOC) {
533 redirty_page_for_writepage(wbc, page);
534 unlock_page(page);
535 return 0;
536 }
531 return extent_write_full_page(tree, page, btree_get_extent, wbc); 537 return extent_write_full_page(tree, page, btree_get_extent, wbc);
532} 538}
533 539
@@ -1363,8 +1369,9 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1363 * queue work function gets called at interrupt time, and so it 1369 * queue work function gets called at interrupt time, and so it
1364 * cannot dynamically grow. 1370 * cannot dynamically grow.
1365 */ 1371 */
1366 btrfs_init_workers(&fs_info->workers, fs_info->thread_pool_size); 1372 btrfs_init_workers(&fs_info->workers, "worker",
1367 btrfs_init_workers(&fs_info->submit_workers, 1373 fs_info->thread_pool_size);
1374 btrfs_init_workers(&fs_info->submit_workers, "submit",
1368 min_t(u64, fs_devices->num_devices, 1375 min_t(u64, fs_devices->num_devices,
1369 fs_info->thread_pool_size)); 1376 fs_info->thread_pool_size));
1370 1377
@@ -1374,9 +1381,10 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1374 */ 1381 */
1375 fs_info->submit_workers.idle_thresh = 64; 1382 fs_info->submit_workers.idle_thresh = 64;
1376 1383
1377 btrfs_init_workers(&fs_info->fixup_workers, 1); 1384 btrfs_init_workers(&fs_info->fixup_workers, "fixup", 1);
1378 btrfs_init_workers(&fs_info->endio_workers, fs_info->thread_pool_size); 1385 btrfs_init_workers(&fs_info->endio_workers, "endio",
1379 btrfs_init_workers(&fs_info->endio_write_workers, 1386 fs_info->thread_pool_size);
1387 btrfs_init_workers(&fs_info->endio_write_workers, "endio-write",
1380 fs_info->thread_pool_size); 1388 fs_info->thread_pool_size);
1381 1389
1382 /* 1390 /*