From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: linux-btrfs@vger.kernel.org
Cc: quwenruo@cn.fujitsu.com
Subject: [PATCH 6/9] btrfs: Use btrfs_workqueue_struct to replace the fs_info->delalloc_workers
Date: Wed, 11 Sep 2013 16:52:35 +0800 [thread overview]
Message-ID: <1378889558-21514-7-git-send-email-quwenruo@cn.fujitsu.com> (raw)
In-Reply-To: <1378889558-21514-1-git-send-email-quwenruo@cn.fujitsu.com>
Much like the fs_info->workers, replace the fs_info->delalloc_workers
use the same btrfs_workqueue.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
fs/btrfs/ctree.h | 2 +-
fs/btrfs/disk-io.c | 14 +++++---------
fs/btrfs/inode.c | 19 +++++++++----------
fs/btrfs/super.c | 2 +-
4 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2662ef2..81aba0e 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1477,10 +1477,10 @@ struct btrfs_fs_info {
* two
*/
struct btrfs_workers generic_worker;
- struct btrfs_workers delalloc_workers;
struct btrfs_workers submit_workers;
struct btrfs_workqueue_struct *workers;
+ struct btrfs_workqueue_struct *delalloc_workers;
struct workqueue_struct *flush_workers;
struct workqueue_struct *endio_workers;
struct workqueue_struct *endio_meta_workers;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index fb9b760..434e5b3 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1985,7 +1985,7 @@ static noinline int next_root_backup(struct btrfs_fs_info *info,
static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)
{
btrfs_stop_workers(&fs_info->generic_worker);
- btrfs_stop_workers(&fs_info->delalloc_workers);
+ btrfs_destroy_workqueue(fs_info->delalloc_workers);
btrfs_destroy_workqueue(fs_info->workers);
btrfs_stop_workers(&fs_info->submit_workers);
destroy_workqueue(fs_info->fixup_workers);
@@ -2464,9 +2464,9 @@ int open_ctree(struct super_block *sb,
fs_info->workers = btrfs_alloc_workqueue("worker", "worker-ordered",
"worker-high", max_active);
- btrfs_init_workers(&fs_info->delalloc_workers, "delalloc",
- fs_info->thread_pool_size,
- &fs_info->generic_worker);
+ fs_info->delalloc_workers = btrfs_alloc_workqueue("delalloc",
+ "delalloc-ordered",
+ NULL, max_active);
fs_info->flush_workers = alloc_workqueue("flush_delalloc", flags,
max_active);
@@ -2476,9 +2476,6 @@ int open_ctree(struct super_block *sb,
&fs_info->generic_worker);
fs_info->caching_workers = alloc_workqueue("cache", flags, 2);
- fs_info->delalloc_workers.idle_thresh = 2;
- fs_info->delalloc_workers.ordered = 1;
-
fs_info->fixup_workers = alloc_workqueue("fixup", flags, 1);
fs_info->endio_workers = alloc_workqueue("endio", flags, max_active);
fs_info->endio_meta_workers = alloc_workqueue("endio-meta", flags,
@@ -2503,13 +2500,12 @@ int open_ctree(struct super_block *sb,
* return -ENOMEM if any of these fail.
*/
ret = btrfs_start_workers(&fs_info->generic_worker);
- ret |= btrfs_start_workers(&fs_info->delalloc_workers);
ret |= btrfs_start_workers(&fs_info->submit_workers);
if (ret || !(fs_info->flush_workers && fs_info->endio_workers &&
fs_info->endio_meta_workers && fs_info->workers &&
fs_info->endio_raid56_workers &&
- fs_info->rmw_workers &&
+ fs_info->rmw_workers && fs_info->delalloc_workers &&
fs_info->endio_meta_write_workers &&
fs_info->endio_write_workers &&
fs_info->caching_workers && fs_info->readahead_workers &&
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 53901a5..0ae21a6 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -59,6 +59,7 @@
#include "inode-map.h"
#include "backref.h"
#include "hash.h"
+#include "bwq.h"
struct btrfs_iget_args {
u64 ino;
@@ -295,7 +296,7 @@ struct async_cow {
u64 start;
u64 end;
struct list_head extents;
- struct btrfs_work work;
+ struct btrfs_work_struct work;
};
static noinline int add_async_extent(struct async_cow *cow,
@@ -1057,7 +1058,7 @@ static noinline int cow_file_range(struct inode *inode,
/*
* work queue call back to started compression on a file and pages
*/
-static noinline void async_cow_start(struct btrfs_work *work)
+static noinline void async_cow_start(struct btrfs_work_struct *work)
{
struct async_cow *async_cow;
int num_added = 0;
@@ -1075,7 +1076,7 @@ static noinline void async_cow_start(struct btrfs_work *work)
/*
* work queue call back to submit previously compressed pages
*/
-static noinline void async_cow_submit(struct btrfs_work *work)
+static noinline void async_cow_submit(struct btrfs_work_struct *work)
{
struct async_cow *async_cow;
struct btrfs_root *root;
@@ -1096,7 +1097,7 @@ static noinline void async_cow_submit(struct btrfs_work *work)
submit_compressed_extents(async_cow->inode, async_cow);
}
-static noinline void async_cow_free(struct btrfs_work *work)
+static noinline void async_cow_free(struct btrfs_work_struct *work)
{
struct async_cow *async_cow;
async_cow = container_of(work, struct async_cow, work);
@@ -1133,17 +1134,15 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
async_cow->end = cur_end;
INIT_LIST_HEAD(&async_cow->extents);
- async_cow->work.func = async_cow_start;
- async_cow->work.ordered_func = async_cow_submit;
- async_cow->work.ordered_free = async_cow_free;
- async_cow->work.flags = 0;
+ btrfs_init_work(&async_cow->work, async_cow_start,
+ async_cow_submit, async_cow_free);
nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >>
PAGE_CACHE_SHIFT;
atomic_add(nr_pages, &root->fs_info->async_delalloc_pages);
- btrfs_queue_worker(&root->fs_info->delalloc_workers,
- &async_cow->work);
+ btrfs_queue_work(root->fs_info->delalloc_workers,
+ &async_cow->work);
if (atomic_read(&root->fs_info->async_delalloc_pages) > limit) {
wait_event(root->fs_info->async_submit_wait,
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 8fe41f9..771b98a 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1176,7 +1176,7 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
btrfs_set_max_workers(&fs_info->generic_worker, new_pool_size);
btrfs_workqueue_set_max(fs_info->workers, new_pool_size);
- btrfs_set_max_workers(&fs_info->delalloc_workers, new_pool_size);
+ btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size);
btrfs_set_max_workers(&fs_info->submit_workers, new_pool_size);
workqueue_set_max_active(fs_info->caching_workers, new_pool_size);
workqueue_set_max_active(fs_info->fixup_workers, new_pool_size);
--
1.8.4
next prev parent reply other threads:[~2013-09-11 8:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-11 8:52 [PATCH 0/9] btrfs: Replace the btrfs_workers with kernel workqueue Qu Wenruo
2013-09-11 8:52 ` [PATCH 1/9] btrfs: Cleanup the unused struct async_sched Qu Wenruo
2013-09-11 8:52 ` [PATCH 2/9] btrfs: use kernel workqueue to replace the btrfs_workers functions Qu Wenruo
2013-09-11 13:02 ` Stefan Behrens
2013-09-12 0:56 ` Qu Wenruo
2013-09-11 8:52 ` [PATCH 3/9] btrfs: Added btrfs_workqueue_struct implemented ordered execution based on kernel workqueue Qu Wenruo
2013-09-11 8:52 ` [PATCH 4/9] btrfs: Add high priority workqueue support for btrfs_workqueue_struct Qu Wenruo
2013-09-11 8:52 ` [PATCH 5/9] btrfs: Use btrfs_workqueue_struct to replace the fs_info->workers Qu Wenruo
2013-09-11 8:52 ` Qu Wenruo [this message]
2013-09-11 8:52 ` [PATCH 7/9] btrfs: Replace the fs_info->submit_workers with kernel workqueue Qu Wenruo
2013-09-11 8:52 ` [PATCH 8/9] btrfs: Cleanup the old btrfs workqueue Qu Wenruo
2013-09-11 17:39 ` Zach Brown
2013-09-11 8:52 ` [PATCH 9/9] btrfs: Replace thread_pool_size with workqueue default value Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1378889558-21514-7-git-send-email-quwenruo@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).