Skip to content

Commit 736cfa1

Browse files
Qu WenruoJosef Bacik
authored andcommitted
btrfs: Replace fs_info->readahead_workers workqueue with btrfs_workqueue.
Replace the fs_info->readahead_workers with the newly created 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>
1 parent e66f0bb commit 736cfa1

4 files changed

Lines changed: 11 additions & 14 deletions

File tree

‎fs/btrfs/ctree.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ struct btrfs_fs_info {
15171517
struct btrfs_workqueue_struct *endio_freespace_worker;
15181518
struct btrfs_workqueue_struct *submit_workers;
15191519
struct btrfs_workqueue_struct *caching_workers;
1520-
struct btrfs_workers readahead_workers;
1520+
struct btrfs_workqueue_struct *readahead_workers;
15211521

15221522
/*
15231523
* fixup workers take dirty pages that didn't properly go through

‎fs/btrfs/disk-io.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)
20082008
btrfs_destroy_workqueue(fs_info->submit_workers);
20092009
btrfs_stop_workers(&fs_info->delayed_workers);
20102010
btrfs_destroy_workqueue(fs_info->caching_workers);
2011-
btrfs_stop_workers(&fs_info->readahead_workers);
2011+
btrfs_destroy_workqueue(fs_info->readahead_workers);
20122012
btrfs_destroy_workqueue(fs_info->flush_workers);
20132013
btrfs_stop_workers(&fs_info->qgroup_rescan_workers);
20142014
}
@@ -2522,22 +2522,18 @@ int open_ctree(struct super_block *sb,
25222522
btrfs_init_workers(&fs_info->delayed_workers, "delayed-meta",
25232523
fs_info->thread_pool_size,
25242524
&fs_info->generic_worker);
2525-
btrfs_init_workers(&fs_info->readahead_workers, "readahead",
2526-
fs_info->thread_pool_size,
2527-
&fs_info->generic_worker);
2525+
fs_info->readahead_workers =
2526+
btrfs_alloc_workqueue("readahead", flags, max_active, 2);
25282527
btrfs_init_workers(&fs_info->qgroup_rescan_workers, "qgroup-rescan", 1,
25292528
&fs_info->generic_worker);
25302529

2531-
fs_info->readahead_workers.idle_thresh = 2;
2532-
25332530
/*
25342531
* btrfs_start_workers can really only fail because of ENOMEM so just
25352532
* return -ENOMEM if any of these fail.
25362533
*/
25372534
ret = btrfs_start_workers(&fs_info->generic_worker);
25382535
ret |= btrfs_start_workers(&fs_info->fixup_workers);
25392536
ret |= btrfs_start_workers(&fs_info->delayed_workers);
2540-
ret |= btrfs_start_workers(&fs_info->readahead_workers);
25412537
ret |= btrfs_start_workers(&fs_info->qgroup_rescan_workers);
25422538
if (ret) {
25432539
err = -ENOMEM;
@@ -2549,7 +2545,7 @@ int open_ctree(struct super_block *sb,
25492545
fs_info->endio_meta_write_workers &&
25502546
fs_info->endio_write_workers && fs_info->endio_raid56_workers &&
25512547
fs_info->endio_freespace_worker && fs_info->rmw_workers &&
2552-
fs_info->caching_workers)) {
2548+
fs_info->caching_workers && fs_info->readahead_workers)) {
25532549
err = -ENOMEM;
25542550
goto fail_sb_buffer;
25552551
}

‎fs/btrfs/reada.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ struct reada_zone {
9191
};
9292

9393
struct reada_machine_work {
94-
struct btrfs_work work;
94+
struct btrfs_work_struct
95+
work;
9596
struct btrfs_fs_info *fs_info;
9697
};
9798

@@ -733,7 +734,7 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,
733734

734735
}
735736

736-
static void reada_start_machine_worker(struct btrfs_work *work)
737+
static void reada_start_machine_worker(struct btrfs_work_struct *work)
737738
{
738739
struct reada_machine_work *rmw;
739740
struct btrfs_fs_info *fs_info;
@@ -793,10 +794,10 @@ static void reada_start_machine(struct btrfs_fs_info *fs_info)
793794
/* FIXME we cannot handle this properly right now */
794795
BUG();
795796
}
796-
rmw->work.func = reada_start_machine_worker;
797+
btrfs_init_work(&rmw->work, reada_start_machine_worker, NULL, NULL);
797798
rmw->fs_info = fs_info;
798799

799-
btrfs_queue_worker(&fs_info->readahead_workers, &rmw->work);
800+
btrfs_queue_work(fs_info->readahead_workers, &rmw->work);
800801
}
801802

802803
#ifdef DEBUG

‎fs/btrfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
13361336
btrfs_workqueue_set_max(fs_info->endio_write_workers, new_pool_size);
13371337
btrfs_workqueue_set_max(fs_info->endio_freespace_worker, new_pool_size);
13381338
btrfs_set_max_workers(&fs_info->delayed_workers, new_pool_size);
1339-
btrfs_set_max_workers(&fs_info->readahead_workers, new_pool_size);
1339+
btrfs_workqueue_set_max(fs_info->readahead_workers, new_pool_size);
13401340
btrfs_set_max_workers(&fs_info->scrub_wr_completion_workers,
13411341
new_pool_size);
13421342
}

0 commit comments

Comments
 (0)