Skip to content

Commit 81db6ae

Browse files
adam900710kdave
authored andcommitted
btrfs: scrub: remove btrfs_fs_info::scrub_wr_completion_workers
Since the scrub rework introduced by commit 2af2aaf ("btrfs: scrub: introduce structure for new BTRFS_STRIPE_LEN based interface") and later commits, scrub only needs one single workqueue, fs_info::scrub_worker. That scrub_wr_completion_workers is initially to handle the delay work after write bios finished. But the new scrub code goes submit-and-wait for write bios, thus all the work are done inside the scrub_worker. The last user of fs_info::scrub_wr_completion_workers is removed in commit 16f9399 ("btrfs: scrub: remove the old writeback infrastructure"), so we can safely remove the workqueue. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c2bbc0b commit 81db6ae

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

fs/btrfs/fs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,6 @@ struct btrfs_fs_info {
642642
*/
643643
refcount_t scrub_workers_refcnt;
644644
struct workqueue_struct *scrub_workers;
645-
struct workqueue_struct *scrub_wr_completion_workers;
646645
struct btrfs_subpage_info *subpage_info;
647646

648647
struct btrfs_discard_ctl discard_ctl;

fs/btrfs/scrub.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,17 +2698,12 @@ static void scrub_workers_put(struct btrfs_fs_info *fs_info)
26982698
if (refcount_dec_and_mutex_lock(&fs_info->scrub_workers_refcnt,
26992699
&fs_info->scrub_lock)) {
27002700
struct workqueue_struct *scrub_workers = fs_info->scrub_workers;
2701-
struct workqueue_struct *scrub_wr_comp =
2702-
fs_info->scrub_wr_completion_workers;
27032701

27042702
fs_info->scrub_workers = NULL;
2705-
fs_info->scrub_wr_completion_workers = NULL;
27062703
mutex_unlock(&fs_info->scrub_lock);
27072704

27082705
if (scrub_workers)
27092706
destroy_workqueue(scrub_workers);
2710-
if (scrub_wr_comp)
2711-
destroy_workqueue(scrub_wr_comp);
27122707
}
27132708
}
27142709

@@ -2719,7 +2714,6 @@ static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
27192714
int is_dev_replace)
27202715
{
27212716
struct workqueue_struct *scrub_workers = NULL;
2722-
struct workqueue_struct *scrub_wr_comp = NULL;
27232717
unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND;
27242718
int max_active = fs_info->thread_pool_size;
27252719
int ret = -ENOMEM;
@@ -2732,18 +2726,12 @@ static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
27322726
else
27332727
scrub_workers = alloc_workqueue("btrfs-scrub", flags, max_active);
27342728
if (!scrub_workers)
2735-
goto fail_scrub_workers;
2736-
2737-
scrub_wr_comp = alloc_workqueue("btrfs-scrubwrc", flags, max_active);
2738-
if (!scrub_wr_comp)
2739-
goto fail_scrub_wr_completion_workers;
2729+
return -ENOMEM;
27402730

27412731
mutex_lock(&fs_info->scrub_lock);
27422732
if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) {
2743-
ASSERT(fs_info->scrub_workers == NULL &&
2744-
fs_info->scrub_wr_completion_workers == NULL);
2733+
ASSERT(fs_info->scrub_workers == NULL);
27452734
fs_info->scrub_workers = scrub_workers;
2746-
fs_info->scrub_wr_completion_workers = scrub_wr_comp;
27472735
refcount_set(&fs_info->scrub_workers_refcnt, 1);
27482736
mutex_unlock(&fs_info->scrub_lock);
27492737
return 0;
@@ -2754,10 +2742,7 @@ static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info,
27542742

27552743
ret = 0;
27562744

2757-
destroy_workqueue(scrub_wr_comp);
2758-
fail_scrub_wr_completion_workers:
27592745
destroy_workqueue(scrub_workers);
2760-
fail_scrub_workers:
27612746
return ret;
27622747
}
27632748

0 commit comments

Comments
 (0)