mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
btrfs: scrub: don't go ordered workqueue for dev-replace
The workqueue fs_info->scrub_worker would go ordered workqueue if it's a device replace operation. However the scrub is relying on multiple workers to do data csum verification, and we always submit several read requests in a row. Thus there is no need to use ordered workqueue just for dev-replace. We have extra synchronization (the main thread will always submit-and-wait for dev-replace writes) to handle it for zoned devices. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ae76d8e3e1
commit
39dc7bd94d
@ -2777,8 +2777,7 @@ static void scrub_workers_put(struct btrfs_fs_info *fs_info)
|
||||
/*
|
||||
* get a reference count on fs_info->scrub_workers. start worker if necessary
|
||||
*/
|
||||
static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
|
||||
int is_dev_replace)
|
||||
static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
struct workqueue_struct *scrub_workers = NULL;
|
||||
unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND;
|
||||
@ -2788,10 +2787,7 @@ static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
|
||||
if (refcount_inc_not_zero(&fs_info->scrub_workers_refcnt))
|
||||
return 0;
|
||||
|
||||
if (is_dev_replace)
|
||||
scrub_workers = alloc_ordered_workqueue("btrfs-scrub", flags);
|
||||
else
|
||||
scrub_workers = alloc_workqueue("btrfs-scrub", flags, max_active);
|
||||
scrub_workers = alloc_workqueue("btrfs-scrub", flags, max_active);
|
||||
if (!scrub_workers)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -2843,7 +2839,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
|
||||
if (IS_ERR(sctx))
|
||||
return PTR_ERR(sctx);
|
||||
|
||||
ret = scrub_workers_get(fs_info, is_dev_replace);
|
||||
ret = scrub_workers_get(fs_info);
|
||||
if (ret)
|
||||
goto out_free_ctx;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user