mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
btrfs: get rid of unique workqueue helper functions
Commit 9e0af23764
("Btrfs: fix task hang under heavy compressed
write") worked around the issue that a recycled work item could get a
false dependency on the original work item due to how the workqueue code
guarantees non-reentrancy. It did so by giving different work functions
to different types of work.
However, the fixes in the previous few patches are more complete, as
they prevent a work item from being recycled at all (except for a tiny
window that the kernel workqueue code handles for us). This obsoletes
the previous fix, so we don't need the unique helpers for correctness.
The only other reason to keep them would be so they show up in stack
traces, but they always seem to be optimized to a tail call, so they
don't show up anyways. So, let's just get rid of the extra indirection.
While we're here, rename normal_work_helper() to the more informative
btrfs_work_helper().
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
57d4f0b863
commit
a0cac0ec96
12 changed files with 50 additions and 145 deletions
|
@ -1268,10 +1268,8 @@ static int cow_file_range_async(struct inode *inode, struct page *locked_page,
|
|||
async_chunk[i].write_flags = write_flags;
|
||||
INIT_LIST_HEAD(&async_chunk[i].extents);
|
||||
|
||||
btrfs_init_work(&async_chunk[i].work,
|
||||
btrfs_delalloc_helper,
|
||||
async_cow_start, async_cow_submit,
|
||||
async_cow_free);
|
||||
btrfs_init_work(&async_chunk[i].work, async_cow_start,
|
||||
async_cow_submit, async_cow_free);
|
||||
|
||||
nr_pages = DIV_ROUND_UP(cur_end - start, PAGE_SIZE);
|
||||
atomic_add(nr_pages, &fs_info->async_delalloc_pages);
|
||||
|
@ -2260,8 +2258,7 @@ int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end)
|
|||
|
||||
SetPageChecked(page);
|
||||
get_page(page);
|
||||
btrfs_init_work(&fixup->work, btrfs_fixup_helper,
|
||||
btrfs_writepage_fixup_worker, NULL, NULL);
|
||||
btrfs_init_work(&fixup->work, btrfs_writepage_fixup_worker, NULL, NULL);
|
||||
fixup->page = page;
|
||||
btrfs_queue_work(fs_info->fixup_workers, &fixup->work);
|
||||
return -EBUSY;
|
||||
|
@ -3254,7 +3251,6 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start,
|
|||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
struct btrfs_ordered_extent *ordered_extent = NULL;
|
||||
struct btrfs_workqueue *wq;
|
||||
btrfs_work_func_t func;
|
||||
|
||||
trace_btrfs_writepage_end_io_hook(page, start, end, uptodate);
|
||||
|
||||
|
@ -3263,16 +3259,12 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start,
|
|||
end - start + 1, uptodate))
|
||||
return;
|
||||
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode)))
|
||||
wq = fs_info->endio_freespace_worker;
|
||||
func = btrfs_freespace_write_helper;
|
||||
} else {
|
||||
else
|
||||
wq = fs_info->endio_write_workers;
|
||||
func = btrfs_endio_write_helper;
|
||||
}
|
||||
|
||||
btrfs_init_work(&ordered_extent->work, func, finish_ordered_fn, NULL,
|
||||
NULL);
|
||||
btrfs_init_work(&ordered_extent->work, finish_ordered_fn, NULL, NULL);
|
||||
btrfs_queue_work(wq, &ordered_extent->work);
|
||||
}
|
||||
|
||||
|
@ -8211,18 +8203,14 @@ static void __endio_write_update_ordered(struct inode *inode,
|
|||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
struct btrfs_ordered_extent *ordered = NULL;
|
||||
struct btrfs_workqueue *wq;
|
||||
btrfs_work_func_t func;
|
||||
u64 ordered_offset = offset;
|
||||
u64 ordered_bytes = bytes;
|
||||
u64 last_offset;
|
||||
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
|
||||
if (btrfs_is_free_space_inode(BTRFS_I(inode)))
|
||||
wq = fs_info->endio_freespace_worker;
|
||||
func = btrfs_freespace_write_helper;
|
||||
} else {
|
||||
else
|
||||
wq = fs_info->endio_write_workers;
|
||||
func = btrfs_endio_write_helper;
|
||||
}
|
||||
|
||||
while (ordered_offset < offset + bytes) {
|
||||
last_offset = ordered_offset;
|
||||
|
@ -8230,9 +8218,8 @@ static void __endio_write_update_ordered(struct inode *inode,
|
|||
&ordered_offset,
|
||||
ordered_bytes,
|
||||
uptodate)) {
|
||||
btrfs_init_work(&ordered->work, func,
|
||||
finish_ordered_fn,
|
||||
NULL, NULL);
|
||||
btrfs_init_work(&ordered->work, finish_ordered_fn, NULL,
|
||||
NULL);
|
||||
btrfs_queue_work(wq, &ordered->work);
|
||||
}
|
||||
/*
|
||||
|
@ -10116,8 +10103,7 @@ static struct btrfs_delalloc_work *btrfs_alloc_delalloc_work(struct inode *inode
|
|||
init_completion(&work->completion);
|
||||
INIT_LIST_HEAD(&work->list);
|
||||
work->inode = inode;
|
||||
btrfs_init_work(&work->work, btrfs_flush_delalloc_helper,
|
||||
btrfs_run_delalloc_work, NULL, NULL);
|
||||
btrfs_init_work(&work->work, btrfs_run_delalloc_work, NULL, NULL);
|
||||
|
||||
return work;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue