diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2014-02-27 21:46:11 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:17:09 -0400 |
commit | d05a33ac265c62d4be35788dd978b2665033f077 (patch) | |
tree | f71e59e7c3121a5e75f93282c104bea8267d6677 /fs | |
parent | fccb5d86d8f52161e013025ccf3101d8fab99a32 (diff) |
btrfs: Replace fs_info->rmw_workers workqueue with btrfs_workqueue.
Replace the fs_info->rmw_workers with the newly created
btrfs_workqueue.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 12 | ||||
-rw-r--r-- | fs/btrfs/raid56.c | 35 |
3 files changed, 21 insertions, 28 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 42bf0da250f5..8102fcd8f1fe 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1511,7 +1511,7 @@ struct btrfs_fs_info { | |||
1511 | struct btrfs_workqueue_struct *endio_workers; | 1511 | struct btrfs_workqueue_struct *endio_workers; |
1512 | struct btrfs_workqueue_struct *endio_meta_workers; | 1512 | struct btrfs_workqueue_struct *endio_meta_workers; |
1513 | struct btrfs_workqueue_struct *endio_raid56_workers; | 1513 | struct btrfs_workqueue_struct *endio_raid56_workers; |
1514 | struct btrfs_workers rmw_workers; | 1514 | struct btrfs_workqueue_struct *rmw_workers; |
1515 | struct btrfs_workqueue_struct *endio_meta_write_workers; | 1515 | struct btrfs_workqueue_struct *endio_meta_write_workers; |
1516 | struct btrfs_workqueue_struct *endio_write_workers; | 1516 | struct btrfs_workqueue_struct *endio_write_workers; |
1517 | struct btrfs_workqueue_struct *endio_freespace_worker; | 1517 | struct btrfs_workqueue_struct *endio_freespace_worker; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8ce0214e3bac..5f12806e96e8 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2001,7 +2001,7 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) | |||
2001 | btrfs_destroy_workqueue(fs_info->endio_workers); | 2001 | btrfs_destroy_workqueue(fs_info->endio_workers); |
2002 | btrfs_destroy_workqueue(fs_info->endio_meta_workers); | 2002 | btrfs_destroy_workqueue(fs_info->endio_meta_workers); |
2003 | btrfs_destroy_workqueue(fs_info->endio_raid56_workers); | 2003 | btrfs_destroy_workqueue(fs_info->endio_raid56_workers); |
2004 | btrfs_stop_workers(&fs_info->rmw_workers); | 2004 | btrfs_destroy_workqueue(fs_info->rmw_workers); |
2005 | btrfs_destroy_workqueue(fs_info->endio_meta_write_workers); | 2005 | btrfs_destroy_workqueue(fs_info->endio_meta_write_workers); |
2006 | btrfs_destroy_workqueue(fs_info->endio_write_workers); | 2006 | btrfs_destroy_workqueue(fs_info->endio_write_workers); |
2007 | btrfs_destroy_workqueue(fs_info->endio_freespace_worker); | 2007 | btrfs_destroy_workqueue(fs_info->endio_freespace_worker); |
@@ -2513,9 +2513,8 @@ int open_ctree(struct super_block *sb, | |||
2513 | btrfs_alloc_workqueue("endio-meta-write", flags, max_active, 2); | 2513 | btrfs_alloc_workqueue("endio-meta-write", flags, max_active, 2); |
2514 | fs_info->endio_raid56_workers = | 2514 | fs_info->endio_raid56_workers = |
2515 | btrfs_alloc_workqueue("endio-raid56", flags, max_active, 4); | 2515 | btrfs_alloc_workqueue("endio-raid56", flags, max_active, 4); |
2516 | btrfs_init_workers(&fs_info->rmw_workers, | 2516 | fs_info->rmw_workers = |
2517 | "rmw", fs_info->thread_pool_size, | 2517 | btrfs_alloc_workqueue("rmw", flags, max_active, 2); |
2518 | &fs_info->generic_worker); | ||
2519 | fs_info->endio_write_workers = | 2518 | fs_info->endio_write_workers = |
2520 | btrfs_alloc_workqueue("endio-write", flags, max_active, 2); | 2519 | btrfs_alloc_workqueue("endio-write", flags, max_active, 2); |
2521 | fs_info->endio_freespace_worker = | 2520 | fs_info->endio_freespace_worker = |
@@ -2529,8 +2528,6 @@ int open_ctree(struct super_block *sb, | |||
2529 | btrfs_init_workers(&fs_info->qgroup_rescan_workers, "qgroup-rescan", 1, | 2528 | btrfs_init_workers(&fs_info->qgroup_rescan_workers, "qgroup-rescan", 1, |
2530 | &fs_info->generic_worker); | 2529 | &fs_info->generic_worker); |
2531 | 2530 | ||
2532 | fs_info->rmw_workers.idle_thresh = 2; | ||
2533 | |||
2534 | fs_info->readahead_workers.idle_thresh = 2; | 2531 | fs_info->readahead_workers.idle_thresh = 2; |
2535 | 2532 | ||
2536 | /* | 2533 | /* |
@@ -2539,7 +2536,6 @@ int open_ctree(struct super_block *sb, | |||
2539 | */ | 2536 | */ |
2540 | ret = btrfs_start_workers(&fs_info->generic_worker); | 2537 | ret = btrfs_start_workers(&fs_info->generic_worker); |
2541 | ret |= btrfs_start_workers(&fs_info->fixup_workers); | 2538 | ret |= btrfs_start_workers(&fs_info->fixup_workers); |
2542 | ret |= btrfs_start_workers(&fs_info->rmw_workers); | ||
2543 | ret |= btrfs_start_workers(&fs_info->delayed_workers); | 2539 | ret |= btrfs_start_workers(&fs_info->delayed_workers); |
2544 | ret |= btrfs_start_workers(&fs_info->caching_workers); | 2540 | ret |= btrfs_start_workers(&fs_info->caching_workers); |
2545 | ret |= btrfs_start_workers(&fs_info->readahead_workers); | 2541 | ret |= btrfs_start_workers(&fs_info->readahead_workers); |
@@ -2553,7 +2549,7 @@ int open_ctree(struct super_block *sb, | |||
2553 | fs_info->endio_workers && fs_info->endio_meta_workers && | 2549 | fs_info->endio_workers && fs_info->endio_meta_workers && |
2554 | fs_info->endio_meta_write_workers && | 2550 | fs_info->endio_meta_write_workers && |
2555 | fs_info->endio_write_workers && fs_info->endio_raid56_workers && | 2551 | fs_info->endio_write_workers && fs_info->endio_raid56_workers && |
2556 | fs_info->endio_freespace_worker)) { | 2552 | fs_info->endio_freespace_worker && fs_info->rmw_workers)) { |
2557 | err = -ENOMEM; | 2553 | err = -ENOMEM; |
2558 | goto fail_sb_buffer; | 2554 | goto fail_sb_buffer; |
2559 | } | 2555 | } |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 24ac21840a9a..5afa564201a2 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -87,7 +87,7 @@ struct btrfs_raid_bio { | |||
87 | /* | 87 | /* |
88 | * for scheduling work in the helper threads | 88 | * for scheduling work in the helper threads |
89 | */ | 89 | */ |
90 | struct btrfs_work work; | 90 | struct btrfs_work_struct work; |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * bio list and bio_list_lock are used | 93 | * bio list and bio_list_lock are used |
@@ -166,8 +166,8 @@ struct btrfs_raid_bio { | |||
166 | 166 | ||
167 | static int __raid56_parity_recover(struct btrfs_raid_bio *rbio); | 167 | static int __raid56_parity_recover(struct btrfs_raid_bio *rbio); |
168 | static noinline void finish_rmw(struct btrfs_raid_bio *rbio); | 168 | static noinline void finish_rmw(struct btrfs_raid_bio *rbio); |
169 | static void rmw_work(struct btrfs_work *work); | 169 | static void rmw_work(struct btrfs_work_struct *work); |
170 | static void read_rebuild_work(struct btrfs_work *work); | 170 | static void read_rebuild_work(struct btrfs_work_struct *work); |
171 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio); | 171 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio); |
172 | static void async_read_rebuild(struct btrfs_raid_bio *rbio); | 172 | static void async_read_rebuild(struct btrfs_raid_bio *rbio); |
173 | static int fail_bio_stripe(struct btrfs_raid_bio *rbio, struct bio *bio); | 173 | static int fail_bio_stripe(struct btrfs_raid_bio *rbio, struct bio *bio); |
@@ -1416,20 +1416,18 @@ cleanup: | |||
1416 | 1416 | ||
1417 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio) | 1417 | static void async_rmw_stripe(struct btrfs_raid_bio *rbio) |
1418 | { | 1418 | { |
1419 | rbio->work.flags = 0; | 1419 | btrfs_init_work(&rbio->work, rmw_work, NULL, NULL); |
1420 | rbio->work.func = rmw_work; | ||
1421 | 1420 | ||
1422 | btrfs_queue_worker(&rbio->fs_info->rmw_workers, | 1421 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
1423 | &rbio->work); | 1422 | &rbio->work); |
1424 | } | 1423 | } |
1425 | 1424 | ||
1426 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) | 1425 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) |
1427 | { | 1426 | { |
1428 | rbio->work.flags = 0; | 1427 | btrfs_init_work(&rbio->work, read_rebuild_work, NULL, NULL); |
1429 | rbio->work.func = read_rebuild_work; | ||
1430 | 1428 | ||
1431 | btrfs_queue_worker(&rbio->fs_info->rmw_workers, | 1429 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
1432 | &rbio->work); | 1430 | &rbio->work); |
1433 | } | 1431 | } |
1434 | 1432 | ||
1435 | /* | 1433 | /* |
@@ -1590,7 +1588,7 @@ struct btrfs_plug_cb { | |||
1590 | struct blk_plug_cb cb; | 1588 | struct blk_plug_cb cb; |
1591 | struct btrfs_fs_info *info; | 1589 | struct btrfs_fs_info *info; |
1592 | struct list_head rbio_list; | 1590 | struct list_head rbio_list; |
1593 | struct btrfs_work work; | 1591 | struct btrfs_work_struct work; |
1594 | }; | 1592 | }; |
1595 | 1593 | ||
1596 | /* | 1594 | /* |
@@ -1654,7 +1652,7 @@ static void run_plug(struct btrfs_plug_cb *plug) | |||
1654 | * if the unplug comes from schedule, we have to push the | 1652 | * if the unplug comes from schedule, we have to push the |
1655 | * work off to a helper thread | 1653 | * work off to a helper thread |
1656 | */ | 1654 | */ |
1657 | static void unplug_work(struct btrfs_work *work) | 1655 | static void unplug_work(struct btrfs_work_struct *work) |
1658 | { | 1656 | { |
1659 | struct btrfs_plug_cb *plug; | 1657 | struct btrfs_plug_cb *plug; |
1660 | plug = container_of(work, struct btrfs_plug_cb, work); | 1658 | plug = container_of(work, struct btrfs_plug_cb, work); |
@@ -1667,10 +1665,9 @@ static void btrfs_raid_unplug(struct blk_plug_cb *cb, bool from_schedule) | |||
1667 | plug = container_of(cb, struct btrfs_plug_cb, cb); | 1665 | plug = container_of(cb, struct btrfs_plug_cb, cb); |
1668 | 1666 | ||
1669 | if (from_schedule) { | 1667 | if (from_schedule) { |
1670 | plug->work.flags = 0; | 1668 | btrfs_init_work(&plug->work, unplug_work, NULL, NULL); |
1671 | plug->work.func = unplug_work; | 1669 | btrfs_queue_work(plug->info->rmw_workers, |
1672 | btrfs_queue_worker(&plug->info->rmw_workers, | 1670 | &plug->work); |
1673 | &plug->work); | ||
1674 | return; | 1671 | return; |
1675 | } | 1672 | } |
1676 | run_plug(plug); | 1673 | run_plug(plug); |
@@ -2082,7 +2079,7 @@ int raid56_parity_recover(struct btrfs_root *root, struct bio *bio, | |||
2082 | 2079 | ||
2083 | } | 2080 | } |
2084 | 2081 | ||
2085 | static void rmw_work(struct btrfs_work *work) | 2082 | static void rmw_work(struct btrfs_work_struct *work) |
2086 | { | 2083 | { |
2087 | struct btrfs_raid_bio *rbio; | 2084 | struct btrfs_raid_bio *rbio; |
2088 | 2085 | ||
@@ -2090,7 +2087,7 @@ static void rmw_work(struct btrfs_work *work) | |||
2090 | raid56_rmw_stripe(rbio); | 2087 | raid56_rmw_stripe(rbio); |
2091 | } | 2088 | } |
2092 | 2089 | ||
2093 | static void read_rebuild_work(struct btrfs_work *work) | 2090 | static void read_rebuild_work(struct btrfs_work_struct *work) |
2094 | { | 2091 | { |
2095 | struct btrfs_raid_bio *rbio; | 2092 | struct btrfs_raid_bio *rbio; |
2096 | 2093 | ||