Skip to content

Commit e66f0bb

Browse files
Qu WenruoJosef Bacik
authored andcommitted
btrfs: Replace fs_info->cache_workers workqueue with btrfs_workqueue.
Replace the fs_info->cache_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 d05a33a commit e66f0bb

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎fs/btrfs/ctree.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ struct btrfs_caching_control {
12211221
struct list_head list;
12221222
struct mutex mutex;
12231223
wait_queue_head_t wait;
1224-
struct btrfs_work work;
1224+
struct btrfs_work_struct work;
12251225
struct btrfs_block_group_cache *block_group;
12261226
u64 progress;
12271227
atomic_t count;
@@ -1516,7 +1516,7 @@ struct btrfs_fs_info {
15161516
struct btrfs_workqueue_struct *endio_write_workers;
15171517
struct btrfs_workqueue_struct *endio_freespace_worker;
15181518
struct btrfs_workqueue_struct *submit_workers;
1519-
struct btrfs_workers caching_workers;
1519+
struct btrfs_workqueue_struct *caching_workers;
15201520
struct btrfs_workers readahead_workers;
15211521

15221522
/*

‎fs/btrfs/disk-io.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)
20072007
btrfs_destroy_workqueue(fs_info->endio_freespace_worker);
20082008
btrfs_destroy_workqueue(fs_info->submit_workers);
20092009
btrfs_stop_workers(&fs_info->delayed_workers);
2010-
btrfs_stop_workers(&fs_info->caching_workers);
2010+
btrfs_destroy_workqueue(fs_info->caching_workers);
20112011
btrfs_stop_workers(&fs_info->readahead_workers);
20122012
btrfs_destroy_workqueue(fs_info->flush_workers);
20132013
btrfs_stop_workers(&fs_info->qgroup_rescan_workers);
@@ -2485,8 +2485,8 @@ int open_ctree(struct super_block *sb,
24852485
fs_info->flush_workers =
24862486
btrfs_alloc_workqueue("flush_delalloc", flags, max_active, 0);
24872487

2488-
btrfs_init_workers(&fs_info->caching_workers, "cache",
2489-
fs_info->thread_pool_size, NULL);
2488+
fs_info->caching_workers =
2489+
btrfs_alloc_workqueue("cache", flags, max_active, 0);
24902490

24912491
/*
24922492
* a higher idle thresh on the submit workers makes it much more
@@ -2537,7 +2537,6 @@ int open_ctree(struct super_block *sb,
25372537
ret = btrfs_start_workers(&fs_info->generic_worker);
25382538
ret |= btrfs_start_workers(&fs_info->fixup_workers);
25392539
ret |= btrfs_start_workers(&fs_info->delayed_workers);
2540-
ret |= btrfs_start_workers(&fs_info->caching_workers);
25412540
ret |= btrfs_start_workers(&fs_info->readahead_workers);
25422541
ret |= btrfs_start_workers(&fs_info->qgroup_rescan_workers);
25432542
if (ret) {
@@ -2549,7 +2548,8 @@ int open_ctree(struct super_block *sb,
25492548
fs_info->endio_workers && fs_info->endio_meta_workers &&
25502549
fs_info->endio_meta_write_workers &&
25512550
fs_info->endio_write_workers && fs_info->endio_raid56_workers &&
2552-
fs_info->endio_freespace_worker && fs_info->rmw_workers)) {
2551+
fs_info->endio_freespace_worker && fs_info->rmw_workers &&
2552+
fs_info->caching_workers)) {
25532553
err = -ENOMEM;
25542554
goto fail_sb_buffer;
25552555
}

‎fs/btrfs/extent-tree.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static u64 add_new_free_space(struct btrfs_block_group_cache *block_group,
378378
return total_added;
379379
}
380380

381-
static noinline void caching_thread(struct btrfs_work *work)
381+
static noinline void caching_thread(struct btrfs_work_struct *work)
382382
{
383383
struct btrfs_block_group_cache *block_group;
384384
struct btrfs_fs_info *fs_info;
@@ -549,7 +549,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache,
549549
caching_ctl->block_group = cache;
550550
caching_ctl->progress = cache->key.objectid;
551551
atomic_set(&caching_ctl->count, 1);
552-
caching_ctl->work.func = caching_thread;
552+
btrfs_init_work(&caching_ctl->work, caching_thread, NULL, NULL);
553553

554554
spin_lock(&cache->lock);
555555
/*
@@ -640,7 +640,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache,
640640

641641
btrfs_get_block_group(cache);
642642

643-
btrfs_queue_worker(&fs_info->caching_workers, &caching_ctl->work);
643+
btrfs_queue_work(fs_info->caching_workers, &caching_ctl->work);
644644

645645
return ret;
646646
}

‎fs/btrfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
13271327
btrfs_workqueue_set_max(fs_info->workers, new_pool_size);
13281328
btrfs_workqueue_set_max(fs_info->delalloc_workers, new_pool_size);
13291329
btrfs_workqueue_set_max(fs_info->submit_workers, new_pool_size);
1330-
btrfs_set_max_workers(&fs_info->caching_workers, new_pool_size);
1330+
btrfs_workqueue_set_max(fs_info->caching_workers, new_pool_size);
13311331
btrfs_set_max_workers(&fs_info->fixup_workers, new_pool_size);
13321332
btrfs_workqueue_set_max(fs_info->endio_workers, new_pool_size);
13331333
btrfs_workqueue_set_max(fs_info->endio_meta_workers, new_pool_size);

0 commit comments

Comments
 (0)