aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2014-02-27 21:46:07 -0500
committerJosef Bacik <jbacik@fb.com>2014-03-10 15:17:06 -0400
commitafe3d24267926eb78ba863016bdd65cfe718aef5 (patch)
tree75a73b173492845b3dd289cd5f9fbb2f52610bde /fs/btrfs/inode.c
parent5cdc7ad337fb08f630ac3538fb10e4a75de2572d (diff)
btrfs: Replace fs_info->delalloc_workers with btrfs_workqueue
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> Tested-by: David Sterba <dsterba@suse.cz> Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0182f081d499..a41a5a7aa3cb 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -324,7 +324,7 @@ struct async_cow {
324 u64 start; 324 u64 start;
325 u64 end; 325 u64 end;
326 struct list_head extents; 326 struct list_head extents;
327 struct btrfs_work work; 327 struct btrfs_work_struct work;
328}; 328};
329 329
330static noinline int add_async_extent(struct async_cow *cow, 330static noinline int add_async_extent(struct async_cow *cow,
@@ -1000,7 +1000,7 @@ out_unlock:
1000/* 1000/*
1001 * work queue call back to started compression on a file and pages 1001 * work queue call back to started compression on a file and pages
1002 */ 1002 */
1003static noinline void async_cow_start(struct btrfs_work *work) 1003static noinline void async_cow_start(struct btrfs_work_struct *work)
1004{ 1004{
1005 struct async_cow *async_cow; 1005 struct async_cow *async_cow;
1006 int num_added = 0; 1006 int num_added = 0;
@@ -1018,7 +1018,7 @@ static noinline void async_cow_start(struct btrfs_work *work)
1018/* 1018/*
1019 * work queue call back to submit previously compressed pages 1019 * work queue call back to submit previously compressed pages
1020 */ 1020 */
1021static noinline void async_cow_submit(struct btrfs_work *work) 1021static noinline void async_cow_submit(struct btrfs_work_struct *work)
1022{ 1022{
1023 struct async_cow *async_cow; 1023 struct async_cow *async_cow;
1024 struct btrfs_root *root; 1024 struct btrfs_root *root;
@@ -1039,7 +1039,7 @@ static noinline void async_cow_submit(struct btrfs_work *work)
1039 submit_compressed_extents(async_cow->inode, async_cow); 1039 submit_compressed_extents(async_cow->inode, async_cow);
1040} 1040}
1041 1041
1042static noinline void async_cow_free(struct btrfs_work *work) 1042static noinline void async_cow_free(struct btrfs_work_struct *work)
1043{ 1043{
1044 struct async_cow *async_cow; 1044 struct async_cow *async_cow;
1045 async_cow = container_of(work, struct async_cow, work); 1045 async_cow = container_of(work, struct async_cow, work);
@@ -1076,17 +1076,15 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
1076 async_cow->end = cur_end; 1076 async_cow->end = cur_end;
1077 INIT_LIST_HEAD(&async_cow->extents); 1077 INIT_LIST_HEAD(&async_cow->extents);
1078 1078
1079 async_cow->work.func = async_cow_start; 1079 btrfs_init_work(&async_cow->work, async_cow_start,
1080 async_cow->work.ordered_func = async_cow_submit; 1080 async_cow_submit, async_cow_free);
1081 async_cow->work.ordered_free = async_cow_free;
1082 async_cow->work.flags = 0;
1083 1081
1084 nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> 1082 nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >>
1085 PAGE_CACHE_SHIFT; 1083 PAGE_CACHE_SHIFT;
1086 atomic_add(nr_pages, &root->fs_info->async_delalloc_pages); 1084 atomic_add(nr_pages, &root->fs_info->async_delalloc_pages);
1087 1085
1088 btrfs_queue_worker(&root->fs_info->delalloc_workers, 1086 btrfs_queue_work(root->fs_info->delalloc_workers,
1089 &async_cow->work); 1087 &async_cow->work);
1090 1088
1091 if (atomic_read(&root->fs_info->async_delalloc_pages) > limit) { 1089 if (atomic_read(&root->fs_info->async_delalloc_pages) > limit) {
1092 wait_event(root->fs_info->async_submit_wait, 1090 wait_event(root->fs_info->async_submit_wait,