diff options
-rw-r--r-- | fs/btrfs/async-thread.c | 44 | ||||
-rw-r--r-- | fs/btrfs/async-thread.h | 28 | ||||
-rw-r--r-- | fs/btrfs/delayed-inode.c | 4 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 53 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 7 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 35 | ||||
-rw-r--r-- | fs/btrfs/ordered-data.c | 1 | ||||
-rw-r--r-- | fs/btrfs/qgroup.c | 1 | ||||
-rw-r--r-- | fs/btrfs/raid56.c | 9 | ||||
-rw-r--r-- | fs/btrfs/reada.c | 3 | ||||
-rw-r--r-- | fs/btrfs/scrub.c | 14 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 3 |
12 files changed, 141 insertions, 61 deletions
diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 5a201d81049c..fbd76ded9a34 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/freezer.h> | 24 | #include <linux/freezer.h> |
25 | #include <linux/workqueue.h> | ||
26 | #include "async-thread.h" | 25 | #include "async-thread.h" |
27 | #include "ctree.h" | 26 | #include "ctree.h" |
28 | 27 | ||
@@ -55,8 +54,39 @@ struct btrfs_workqueue { | |||
55 | struct __btrfs_workqueue *high; | 54 | struct __btrfs_workqueue *high; |
56 | }; | 55 | }; |
57 | 56 | ||
58 | static inline struct __btrfs_workqueue | 57 | static void normal_work_helper(struct btrfs_work *work); |
59 | *__btrfs_alloc_workqueue(const char *name, int flags, int max_active, | 58 | |
59 | #define BTRFS_WORK_HELPER(name) \ | ||
60 | void btrfs_##name(struct work_struct *arg) \ | ||
61 | { \ | ||
62 | struct btrfs_work *work = container_of(arg, struct btrfs_work, \ | ||
63 | normal_work); \ | ||
64 | normal_work_helper(work); \ | ||
65 | } | ||
66 | |||
67 | BTRFS_WORK_HELPER(worker_helper); | ||
68 | BTRFS_WORK_HELPER(delalloc_helper); | ||
69 | BTRFS_WORK_HELPER(flush_delalloc_helper); | ||
70 | BTRFS_WORK_HELPER(cache_helper); | ||
71 | BTRFS_WORK_HELPER(submit_helper); | ||
72 | BTRFS_WORK_HELPER(fixup_helper); | ||
73 | BTRFS_WORK_HELPER(endio_helper); | ||
74 | BTRFS_WORK_HELPER(endio_meta_helper); | ||
75 | BTRFS_WORK_HELPER(endio_meta_write_helper); | ||
76 | BTRFS_WORK_HELPER(endio_raid56_helper); | ||
77 | BTRFS_WORK_HELPER(rmw_helper); | ||
78 | BTRFS_WORK_HELPER(endio_write_helper); | ||
79 | BTRFS_WORK_HELPER(freespace_write_helper); | ||
80 | BTRFS_WORK_HELPER(delayed_meta_helper); | ||
81 | BTRFS_WORK_HELPER(readahead_helper); | ||
82 | BTRFS_WORK_HELPER(qgroup_rescan_helper); | ||
83 | BTRFS_WORK_HELPER(extent_refs_helper); | ||
84 | BTRFS_WORK_HELPER(scrub_helper); | ||
85 | BTRFS_WORK_HELPER(scrubwrc_helper); | ||
86 | BTRFS_WORK_HELPER(scrubnc_helper); | ||
87 | |||
88 | static struct __btrfs_workqueue * | ||
89 | __btrfs_alloc_workqueue(const char *name, int flags, int max_active, | ||
60 | int thresh) | 90 | int thresh) |
61 | { | 91 | { |
62 | struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS); | 92 | struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_NOFS); |
@@ -232,13 +262,11 @@ static void run_ordered_work(struct __btrfs_workqueue *wq) | |||
232 | spin_unlock_irqrestore(lock, flags); | 262 | spin_unlock_irqrestore(lock, flags); |
233 | } | 263 | } |
234 | 264 | ||
235 | static void normal_work_helper(struct work_struct *arg) | 265 | static void normal_work_helper(struct btrfs_work *work) |
236 | { | 266 | { |
237 | struct btrfs_work *work; | ||
238 | struct __btrfs_workqueue *wq; | 267 | struct __btrfs_workqueue *wq; |
239 | int need_order = 0; | 268 | int need_order = 0; |
240 | 269 | ||
241 | work = container_of(arg, struct btrfs_work, normal_work); | ||
242 | /* | 270 | /* |
243 | * We should not touch things inside work in the following cases: | 271 | * We should not touch things inside work in the following cases: |
244 | * 1) after work->func() if it has no ordered_free | 272 | * 1) after work->func() if it has no ordered_free |
@@ -262,7 +290,7 @@ static void normal_work_helper(struct work_struct *arg) | |||
262 | trace_btrfs_all_work_done(work); | 290 | trace_btrfs_all_work_done(work); |
263 | } | 291 | } |
264 | 292 | ||
265 | void btrfs_init_work(struct btrfs_work *work, | 293 | void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t uniq_func, |
266 | btrfs_func_t func, | 294 | btrfs_func_t func, |
267 | btrfs_func_t ordered_func, | 295 | btrfs_func_t ordered_func, |
268 | btrfs_func_t ordered_free) | 296 | btrfs_func_t ordered_free) |
@@ -270,7 +298,7 @@ void btrfs_init_work(struct btrfs_work *work, | |||
270 | work->func = func; | 298 | work->func = func; |
271 | work->ordered_func = ordered_func; | 299 | work->ordered_func = ordered_func; |
272 | work->ordered_free = ordered_free; | 300 | work->ordered_free = ordered_free; |
273 | INIT_WORK(&work->normal_work, normal_work_helper); | 301 | INIT_WORK(&work->normal_work, uniq_func); |
274 | INIT_LIST_HEAD(&work->ordered_list); | 302 | INIT_LIST_HEAD(&work->ordered_list); |
275 | work->flags = 0; | 303 | work->flags = 0; |
276 | } | 304 | } |
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h index 9c6b66d15fb0..e9e31c94758f 100644 --- a/fs/btrfs/async-thread.h +++ b/fs/btrfs/async-thread.h | |||
@@ -19,12 +19,14 @@ | |||
19 | 19 | ||
20 | #ifndef __BTRFS_ASYNC_THREAD_ | 20 | #ifndef __BTRFS_ASYNC_THREAD_ |
21 | #define __BTRFS_ASYNC_THREAD_ | 21 | #define __BTRFS_ASYNC_THREAD_ |
22 | #include <linux/workqueue.h> | ||
22 | 23 | ||
23 | struct btrfs_workqueue; | 24 | struct btrfs_workqueue; |
24 | /* Internal use only */ | 25 | /* Internal use only */ |
25 | struct __btrfs_workqueue; | 26 | struct __btrfs_workqueue; |
26 | struct btrfs_work; | 27 | struct btrfs_work; |
27 | typedef void (*btrfs_func_t)(struct btrfs_work *arg); | 28 | typedef void (*btrfs_func_t)(struct btrfs_work *arg); |
29 | typedef void (*btrfs_work_func_t)(struct work_struct *arg); | ||
28 | 30 | ||
29 | struct btrfs_work { | 31 | struct btrfs_work { |
30 | btrfs_func_t func; | 32 | btrfs_func_t func; |
@@ -38,11 +40,35 @@ struct btrfs_work { | |||
38 | unsigned long flags; | 40 | unsigned long flags; |
39 | }; | 41 | }; |
40 | 42 | ||
43 | #define BTRFS_WORK_HELPER_PROTO(name) \ | ||
44 | void btrfs_##name(struct work_struct *arg) | ||
45 | |||
46 | BTRFS_WORK_HELPER_PROTO(worker_helper); | ||
47 | BTRFS_WORK_HELPER_PROTO(delalloc_helper); | ||
48 | BTRFS_WORK_HELPER_PROTO(flush_delalloc_helper); | ||
49 | BTRFS_WORK_HELPER_PROTO(cache_helper); | ||
50 | BTRFS_WORK_HELPER_PROTO(submit_helper); | ||
51 | BTRFS_WORK_HELPER_PROTO(fixup_helper); | ||
52 | BTRFS_WORK_HELPER_PROTO(endio_helper); | ||
53 | BTRFS_WORK_HELPER_PROTO(endio_meta_helper); | ||
54 | BTRFS_WORK_HELPER_PROTO(endio_meta_write_helper); | ||
55 | BTRFS_WORK_HELPER_PROTO(endio_raid56_helper); | ||
56 | BTRFS_WORK_HELPER_PROTO(rmw_helper); | ||
57 | BTRFS_WORK_HELPER_PROTO(endio_write_helper); | ||
58 | BTRFS_WORK_HELPER_PROTO(freespace_write_helper); | ||
59 | BTRFS_WORK_HELPER_PROTO(delayed_meta_helper); | ||
60 | BTRFS_WORK_HELPER_PROTO(readahead_helper); | ||
61 | BTRFS_WORK_HELPER_PROTO(qgroup_rescan_helper); | ||
62 | BTRFS_WORK_HELPER_PROTO(extent_refs_helper); | ||
63 | BTRFS_WORK_HELPER_PROTO(scrub_helper); | ||
64 | BTRFS_WORK_HELPER_PROTO(scrubwrc_helper); | ||
65 | BTRFS_WORK_HELPER_PROTO(scrubnc_helper); | ||
66 | |||
41 | struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name, | 67 | struct btrfs_workqueue *btrfs_alloc_workqueue(const char *name, |
42 | int flags, | 68 | int flags, |
43 | int max_active, | 69 | int max_active, |
44 | int thresh); | 70 | int thresh); |
45 | void btrfs_init_work(struct btrfs_work *work, | 71 | void btrfs_init_work(struct btrfs_work *work, btrfs_work_func_t helper, |
46 | btrfs_func_t func, | 72 | btrfs_func_t func, |
47 | btrfs_func_t ordered_func, | 73 | btrfs_func_t ordered_func, |
48 | btrfs_func_t ordered_free); | 74 | btrfs_func_t ordered_free); |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index da775bfdebc9..a2e90f855d7d 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
@@ -1395,8 +1395,8 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, | |||
1395 | return -ENOMEM; | 1395 | return -ENOMEM; |
1396 | 1396 | ||
1397 | async_work->delayed_root = delayed_root; | 1397 | async_work->delayed_root = delayed_root; |
1398 | btrfs_init_work(&async_work->work, btrfs_async_run_delayed_root, | 1398 | btrfs_init_work(&async_work->work, btrfs_delayed_meta_helper, |
1399 | NULL, NULL); | 1399 | btrfs_async_run_delayed_root, NULL, NULL); |
1400 | async_work->nr = nr; | 1400 | async_work->nr = nr; |
1401 | 1401 | ||
1402 | btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work); | 1402 | btrfs_queue_work(root->fs_info->delayed_workers, &async_work->work); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index c99a414813c1..a1d36e62179c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "btrfs_inode.h" | 39 | #include "btrfs_inode.h" |
40 | #include "volumes.h" | 40 | #include "volumes.h" |
41 | #include "print-tree.h" | 41 | #include "print-tree.h" |
42 | #include "async-thread.h" | ||
43 | #include "locking.h" | 42 | #include "locking.h" |
44 | #include "tree-log.h" | 43 | #include "tree-log.h" |
45 | #include "free-space-cache.h" | 44 | #include "free-space-cache.h" |
@@ -693,35 +692,41 @@ static void end_workqueue_bio(struct bio *bio, int err) | |||
693 | { | 692 | { |
694 | struct end_io_wq *end_io_wq = bio->bi_private; | 693 | struct end_io_wq *end_io_wq = bio->bi_private; |
695 | struct btrfs_fs_info *fs_info; | 694 | struct btrfs_fs_info *fs_info; |
695 | struct btrfs_workqueue *wq; | ||
696 | btrfs_work_func_t func; | ||
696 | 697 | ||
697 | fs_info = end_io_wq->info; | 698 | fs_info = end_io_wq->info; |
698 | end_io_wq->error = err; | 699 | end_io_wq->error = err; |
699 | btrfs_init_work(&end_io_wq->work, end_workqueue_fn, NULL, NULL); | ||
700 | 700 | ||
701 | if (bio->bi_rw & REQ_WRITE) { | 701 | if (bio->bi_rw & REQ_WRITE) { |
702 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) | 702 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) { |
703 | btrfs_queue_work(fs_info->endio_meta_write_workers, | 703 | wq = fs_info->endio_meta_write_workers; |
704 | &end_io_wq->work); | 704 | func = btrfs_endio_meta_write_helper; |
705 | else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) | 705 | } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_FREE_SPACE) { |
706 | btrfs_queue_work(fs_info->endio_freespace_worker, | 706 | wq = fs_info->endio_freespace_worker; |
707 | &end_io_wq->work); | 707 | func = btrfs_freespace_write_helper; |
708 | else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) | 708 | } else if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { |
709 | btrfs_queue_work(fs_info->endio_raid56_workers, | 709 | wq = fs_info->endio_raid56_workers; |
710 | &end_io_wq->work); | 710 | func = btrfs_endio_raid56_helper; |
711 | else | 711 | } else { |
712 | btrfs_queue_work(fs_info->endio_write_workers, | 712 | wq = fs_info->endio_write_workers; |
713 | &end_io_wq->work); | 713 | func = btrfs_endio_write_helper; |
714 | } | ||
714 | } else { | 715 | } else { |
715 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) | 716 | if (end_io_wq->metadata == BTRFS_WQ_ENDIO_RAID56) { |
716 | btrfs_queue_work(fs_info->endio_raid56_workers, | 717 | wq = fs_info->endio_raid56_workers; |
717 | &end_io_wq->work); | 718 | func = btrfs_endio_raid56_helper; |
718 | else if (end_io_wq->metadata) | 719 | } else if (end_io_wq->metadata) { |
719 | btrfs_queue_work(fs_info->endio_meta_workers, | 720 | wq = fs_info->endio_meta_workers; |
720 | &end_io_wq->work); | 721 | func = btrfs_endio_meta_helper; |
721 | else | 722 | } else { |
722 | btrfs_queue_work(fs_info->endio_workers, | 723 | wq = fs_info->endio_workers; |
723 | &end_io_wq->work); | 724 | func = btrfs_endio_helper; |
725 | } | ||
724 | } | 726 | } |
727 | |||
728 | btrfs_init_work(&end_io_wq->work, func, end_workqueue_fn, NULL, NULL); | ||
729 | btrfs_queue_work(wq, &end_io_wq->work); | ||
725 | } | 730 | } |
726 | 731 | ||
727 | /* | 732 | /* |
@@ -828,7 +833,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode, | |||
828 | async->submit_bio_start = submit_bio_start; | 833 | async->submit_bio_start = submit_bio_start; |
829 | async->submit_bio_done = submit_bio_done; | 834 | async->submit_bio_done = submit_bio_done; |
830 | 835 | ||
831 | btrfs_init_work(&async->work, run_one_async_start, | 836 | btrfs_init_work(&async->work, btrfs_worker_helper, run_one_async_start, |
832 | run_one_async_done, run_one_async_free); | 837 | run_one_async_done, run_one_async_free); |
833 | 838 | ||
834 | async->bio_flags = bio_flags; | 839 | async->bio_flags = bio_flags; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5524434da059..3efe1c3877bf 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -552,7 +552,8 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, | |||
552 | caching_ctl->block_group = cache; | 552 | caching_ctl->block_group = cache; |
553 | caching_ctl->progress = cache->key.objectid; | 553 | caching_ctl->progress = cache->key.objectid; |
554 | atomic_set(&caching_ctl->count, 1); | 554 | atomic_set(&caching_ctl->count, 1); |
555 | btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL); | 555 | btrfs_init_work(&caching_ctl->work, btrfs_cache_helper, |
556 | caching_thread, NULL, NULL); | ||
556 | 557 | ||
557 | spin_lock(&cache->lock); | 558 | spin_lock(&cache->lock); |
558 | /* | 559 | /* |
@@ -2749,8 +2750,8 @@ int btrfs_async_run_delayed_refs(struct btrfs_root *root, | |||
2749 | async->sync = 0; | 2750 | async->sync = 0; |
2750 | init_completion(&async->wait); | 2751 | init_completion(&async->wait); |
2751 | 2752 | ||
2752 | btrfs_init_work(&async->work, delayed_ref_async_start, | 2753 | btrfs_init_work(&async->work, btrfs_extent_refs_helper, |
2753 | NULL, NULL); | 2754 | delayed_ref_async_start, NULL, NULL); |
2754 | 2755 | ||
2755 | btrfs_queue_work(root->fs_info->extent_workers, &async->work); | 2756 | btrfs_queue_work(root->fs_info->extent_workers, &async->work); |
2756 | 2757 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index ae98df67950f..3d020d6d9ace 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1096,8 +1096,10 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page, | |||
1096 | async_cow->end = cur_end; | 1096 | async_cow->end = cur_end; |
1097 | INIT_LIST_HEAD(&async_cow->extents); | 1097 | INIT_LIST_HEAD(&async_cow->extents); |
1098 | 1098 | ||
1099 | btrfs_init_work(&async_cow->work, async_cow_start, | 1099 | btrfs_init_work(&async_cow->work, |
1100 | async_cow_submit, async_cow_free); | 1100 | btrfs_delalloc_helper, |
1101 | async_cow_start, async_cow_submit, | ||
1102 | async_cow_free); | ||
1101 | 1103 | ||
1102 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> | 1104 | nr_pages = (cur_end - start + PAGE_CACHE_SIZE) >> |
1103 | PAGE_CACHE_SHIFT; | 1105 | PAGE_CACHE_SHIFT; |
@@ -1881,7 +1883,8 @@ static int btrfs_writepage_start_hook(struct page *page, u64 start, u64 end) | |||
1881 | 1883 | ||
1882 | SetPageChecked(page); | 1884 | SetPageChecked(page); |
1883 | page_cache_get(page); | 1885 | page_cache_get(page); |
1884 | btrfs_init_work(&fixup->work, btrfs_writepage_fixup_worker, NULL, NULL); | 1886 | btrfs_init_work(&fixup->work, btrfs_fixup_helper, |
1887 | btrfs_writepage_fixup_worker, NULL, NULL); | ||
1885 | fixup->page = page; | 1888 | fixup->page = page; |
1886 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); | 1889 | btrfs_queue_work(root->fs_info->fixup_workers, &fixup->work); |
1887 | return -EBUSY; | 1890 | return -EBUSY; |
@@ -2822,7 +2825,8 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
2822 | struct inode *inode = page->mapping->host; | 2825 | struct inode *inode = page->mapping->host; |
2823 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2826 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2824 | struct btrfs_ordered_extent *ordered_extent = NULL; | 2827 | struct btrfs_ordered_extent *ordered_extent = NULL; |
2825 | struct btrfs_workqueue *workers; | 2828 | struct btrfs_workqueue *wq; |
2829 | btrfs_work_func_t func; | ||
2826 | 2830 | ||
2827 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); | 2831 | trace_btrfs_writepage_end_io_hook(page, start, end, uptodate); |
2828 | 2832 | ||
@@ -2831,13 +2835,17 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, | |||
2831 | end - start + 1, uptodate)) | 2835 | end - start + 1, uptodate)) |
2832 | return 0; | 2836 | return 0; |
2833 | 2837 | ||
2834 | btrfs_init_work(&ordered_extent->work, finish_ordered_fn, NULL, NULL); | 2838 | if (btrfs_is_free_space_inode(inode)) { |
2839 | wq = root->fs_info->endio_freespace_worker; | ||
2840 | func = btrfs_freespace_write_helper; | ||
2841 | } else { | ||
2842 | wq = root->fs_info->endio_write_workers; | ||
2843 | func = btrfs_endio_write_helper; | ||
2844 | } | ||
2835 | 2845 | ||
2836 | if (btrfs_is_free_space_inode(inode)) | 2846 | btrfs_init_work(&ordered_extent->work, func, finish_ordered_fn, NULL, |
2837 | workers = root->fs_info->endio_freespace_worker; | 2847 | NULL); |
2838 | else | 2848 | btrfs_queue_work(wq, &ordered_extent->work); |
2839 | workers = root->fs_info->endio_write_workers; | ||
2840 | btrfs_queue_work(workers, &ordered_extent->work); | ||
2841 | 2849 | ||
2842 | return 0; | 2850 | return 0; |
2843 | } | 2851 | } |
@@ -7208,7 +7216,8 @@ again: | |||
7208 | if (!ret) | 7216 | if (!ret) |
7209 | goto out_test; | 7217 | goto out_test; |
7210 | 7218 | ||
7211 | btrfs_init_work(&ordered->work, finish_ordered_fn, NULL, NULL); | 7219 | btrfs_init_work(&ordered->work, btrfs_endio_write_helper, |
7220 | finish_ordered_fn, NULL, NULL); | ||
7212 | btrfs_queue_work(root->fs_info->endio_write_workers, | 7221 | btrfs_queue_work(root->fs_info->endio_write_workers, |
7213 | &ordered->work); | 7222 | &ordered->work); |
7214 | out_test: | 7223 | out_test: |
@@ -8535,7 +8544,9 @@ struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode, | |||
8535 | work->inode = inode; | 8544 | work->inode = inode; |
8536 | work->wait = wait; | 8545 | work->wait = wait; |
8537 | work->delay_iput = delay_iput; | 8546 | work->delay_iput = delay_iput; |
8538 | btrfs_init_work(&work->work, btrfs_run_delalloc_work, NULL, NULL); | 8547 | WARN_ON_ONCE(!inode); |
8548 | btrfs_init_work(&work->work, btrfs_flush_delalloc_helper, | ||
8549 | btrfs_run_delalloc_work, NULL, NULL); | ||
8539 | 8550 | ||
8540 | return work; | 8551 | return work; |
8541 | } | 8552 | } |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 963895c1f801..ac734ec4cc20 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -615,6 +615,7 @@ int btrfs_wait_ordered_extents(struct btrfs_root *root, int nr) | |||
615 | spin_unlock(&root->ordered_extent_lock); | 615 | spin_unlock(&root->ordered_extent_lock); |
616 | 616 | ||
617 | btrfs_init_work(&ordered->flush_work, | 617 | btrfs_init_work(&ordered->flush_work, |
618 | btrfs_flush_delalloc_helper, | ||
618 | btrfs_run_ordered_extent_work, NULL, NULL); | 619 | btrfs_run_ordered_extent_work, NULL, NULL); |
619 | list_add_tail(&ordered->work_list, &works); | 620 | list_add_tail(&ordered->work_list, &works); |
620 | btrfs_queue_work(root->fs_info->flush_workers, | 621 | btrfs_queue_work(root->fs_info->flush_workers, |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 8abe45524de9..ded5c601d916 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -2720,6 +2720,7 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 progress_objectid, | |||
2720 | memset(&fs_info->qgroup_rescan_work, 0, | 2720 | memset(&fs_info->qgroup_rescan_work, 0, |
2721 | sizeof(fs_info->qgroup_rescan_work)); | 2721 | sizeof(fs_info->qgroup_rescan_work)); |
2722 | btrfs_init_work(&fs_info->qgroup_rescan_work, | 2722 | btrfs_init_work(&fs_info->qgroup_rescan_work, |
2723 | btrfs_qgroup_rescan_helper, | ||
2723 | btrfs_qgroup_rescan_worker, NULL, NULL); | 2724 | btrfs_qgroup_rescan_worker, NULL, NULL); |
2724 | 2725 | ||
2725 | if (ret) { | 2726 | if (ret) { |
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 4a88f073fdd7..0a6b6e4bcbb9 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -1416,7 +1416,8 @@ 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 | btrfs_init_work(&rbio->work, rmw_work, NULL, NULL); | 1419 | btrfs_init_work(&rbio->work, btrfs_rmw_helper, |
1420 | rmw_work, NULL, NULL); | ||
1420 | 1421 | ||
1421 | btrfs_queue_work(rbio->fs_info->rmw_workers, | 1422 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
1422 | &rbio->work); | 1423 | &rbio->work); |
@@ -1424,7 +1425,8 @@ static void async_rmw_stripe(struct btrfs_raid_bio *rbio) | |||
1424 | 1425 | ||
1425 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) | 1426 | static void async_read_rebuild(struct btrfs_raid_bio *rbio) |
1426 | { | 1427 | { |
1427 | btrfs_init_work(&rbio->work, read_rebuild_work, NULL, NULL); | 1428 | btrfs_init_work(&rbio->work, btrfs_rmw_helper, |
1429 | read_rebuild_work, NULL, NULL); | ||
1428 | 1430 | ||
1429 | btrfs_queue_work(rbio->fs_info->rmw_workers, | 1431 | btrfs_queue_work(rbio->fs_info->rmw_workers, |
1430 | &rbio->work); | 1432 | &rbio->work); |
@@ -1665,7 +1667,8 @@ static void btrfs_raid_unplug(struct blk_plug_cb *cb, bool from_schedule) | |||
1665 | plug = container_of(cb, struct btrfs_plug_cb, cb); | 1667 | plug = container_of(cb, struct btrfs_plug_cb, cb); |
1666 | 1668 | ||
1667 | if (from_schedule) { | 1669 | if (from_schedule) { |
1668 | btrfs_init_work(&plug->work, unplug_work, NULL, NULL); | 1670 | btrfs_init_work(&plug->work, btrfs_rmw_helper, |
1671 | unplug_work, NULL, NULL); | ||
1669 | btrfs_queue_work(plug->info->rmw_workers, | 1672 | btrfs_queue_work(plug->info->rmw_workers, |
1670 | &plug->work); | 1673 | &plug->work); |
1671 | return; | 1674 | return; |
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index 09230cf3a244..20408c6b665a 100644 --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c | |||
@@ -798,7 +798,8 @@ static void reada_start_machine(struct btrfs_fs_info *fs_info) | |||
798 | /* FIXME we cannot handle this properly right now */ | 798 | /* FIXME we cannot handle this properly right now */ |
799 | BUG(); | 799 | BUG(); |
800 | } | 800 | } |
801 | btrfs_init_work(&rmw->work, reada_start_machine_worker, NULL, NULL); | 801 | btrfs_init_work(&rmw->work, btrfs_readahead_helper, |
802 | reada_start_machine_worker, NULL, NULL); | ||
802 | rmw->fs_info = fs_info; | 803 | rmw->fs_info = fs_info; |
803 | 804 | ||
804 | btrfs_queue_work(fs_info->readahead_workers, &rmw->work); | 805 | btrfs_queue_work(fs_info->readahead_workers, &rmw->work); |
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 23d3f6e6a482..f4a41f37be22 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -428,8 +428,8 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) | |||
428 | sbio->index = i; | 428 | sbio->index = i; |
429 | sbio->sctx = sctx; | 429 | sbio->sctx = sctx; |
430 | sbio->page_count = 0; | 430 | sbio->page_count = 0; |
431 | btrfs_init_work(&sbio->work, scrub_bio_end_io_worker, | 431 | btrfs_init_work(&sbio->work, btrfs_scrub_helper, |
432 | NULL, NULL); | 432 | scrub_bio_end_io_worker, NULL, NULL); |
433 | 433 | ||
434 | if (i != SCRUB_BIOS_PER_SCTX - 1) | 434 | if (i != SCRUB_BIOS_PER_SCTX - 1) |
435 | sctx->bios[i]->next_free = i + 1; | 435 | sctx->bios[i]->next_free = i + 1; |
@@ -999,8 +999,8 @@ nodatasum_case: | |||
999 | fixup_nodatasum->root = fs_info->extent_root; | 999 | fixup_nodatasum->root = fs_info->extent_root; |
1000 | fixup_nodatasum->mirror_num = failed_mirror_index + 1; | 1000 | fixup_nodatasum->mirror_num = failed_mirror_index + 1; |
1001 | scrub_pending_trans_workers_inc(sctx); | 1001 | scrub_pending_trans_workers_inc(sctx); |
1002 | btrfs_init_work(&fixup_nodatasum->work, scrub_fixup_nodatasum, | 1002 | btrfs_init_work(&fixup_nodatasum->work, btrfs_scrub_helper, |
1003 | NULL, NULL); | 1003 | scrub_fixup_nodatasum, NULL, NULL); |
1004 | btrfs_queue_work(fs_info->scrub_workers, | 1004 | btrfs_queue_work(fs_info->scrub_workers, |
1005 | &fixup_nodatasum->work); | 1005 | &fixup_nodatasum->work); |
1006 | goto out; | 1006 | goto out; |
@@ -1616,7 +1616,8 @@ static void scrub_wr_bio_end_io(struct bio *bio, int err) | |||
1616 | sbio->err = err; | 1616 | sbio->err = err; |
1617 | sbio->bio = bio; | 1617 | sbio->bio = bio; |
1618 | 1618 | ||
1619 | btrfs_init_work(&sbio->work, scrub_wr_bio_end_io_worker, NULL, NULL); | 1619 | btrfs_init_work(&sbio->work, btrfs_scrubwrc_helper, |
1620 | scrub_wr_bio_end_io_worker, NULL, NULL); | ||
1620 | btrfs_queue_work(fs_info->scrub_wr_completion_workers, &sbio->work); | 1621 | btrfs_queue_work(fs_info->scrub_wr_completion_workers, &sbio->work); |
1621 | } | 1622 | } |
1622 | 1623 | ||
@@ -3214,7 +3215,8 @@ static int copy_nocow_pages(struct scrub_ctx *sctx, u64 logical, u64 len, | |||
3214 | nocow_ctx->len = len; | 3215 | nocow_ctx->len = len; |
3215 | nocow_ctx->mirror_num = mirror_num; | 3216 | nocow_ctx->mirror_num = mirror_num; |
3216 | nocow_ctx->physical_for_dev_replace = physical_for_dev_replace; | 3217 | nocow_ctx->physical_for_dev_replace = physical_for_dev_replace; |
3217 | btrfs_init_work(&nocow_ctx->work, copy_nocow_pages_worker, NULL, NULL); | 3218 | btrfs_init_work(&nocow_ctx->work, btrfs_scrubnc_helper, |
3219 | copy_nocow_pages_worker, NULL, NULL); | ||
3218 | INIT_LIST_HEAD(&nocow_ctx->inodes); | 3220 | INIT_LIST_HEAD(&nocow_ctx->inodes); |
3219 | btrfs_queue_work(fs_info->scrub_nocow_workers, | 3221 | btrfs_queue_work(fs_info->scrub_nocow_workers, |
3220 | &nocow_ctx->work); | 3222 | &nocow_ctx->work); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 9d4ce53d7569..340a92d08e84 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -5854,7 +5854,8 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, | |||
5854 | else | 5854 | else |
5855 | generate_random_uuid(dev->uuid); | 5855 | generate_random_uuid(dev->uuid); |
5856 | 5856 | ||
5857 | btrfs_init_work(&dev->work, pending_bios_fn, NULL, NULL); | 5857 | btrfs_init_work(&dev->work, btrfs_submit_helper, |
5858 | pending_bios_fn, NULL, NULL); | ||
5858 | 5859 | ||
5859 | return dev; | 5860 | return dev; |
5860 | } | 5861 | } |