f2fs: Rename f2fs_post_read_wq into f2fs_wq

Rename f2fs_post_read_wq into f2fs_wq. Create it unconditionally.
Prepare for using this workqueue for completing write bios.

Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Bart Van Assche
2026-06-10 12:34:18 -07:00
committed by Jaegeuk Kim
parent 41b7928813
commit 7ba36a9ea8
4 changed files with 16 additions and 22 deletions

View File

@@ -1809,7 +1809,7 @@ static void f2fs_put_dic(struct decompress_io_ctx *dic, bool in_task)
f2fs_free_dic(dic, false);
} else {
INIT_WORK(&dic->free_work, f2fs_late_free_dic);
queue_work(dic->sbi->post_read_wq, &dic->free_work);
queue_work(dic->sbi->wq, &dic->free_work);
}
}
}

View File

@@ -342,7 +342,7 @@ static void f2fs_read_end_io(struct bio *bio)
f2fs_handle_step_decompress(ctx, intask);
} else if (enabled_steps) {
INIT_WORK(&ctx->work, f2fs_post_read_work);
queue_work(ctx->sbi->post_read_wq, &ctx->work);
queue_work(ctx->sbi->wq, &ctx->work);
return;
}
}
@@ -4527,23 +4527,17 @@ void f2fs_destroy_post_read_processing(void)
kmem_cache_destroy(bio_post_read_ctx_cache);
}
int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi)
int f2fs_init_wq(struct f2fs_sb_info *sbi)
{
if (!f2fs_sb_has_encrypt(sbi) &&
!f2fs_sb_has_verity(sbi) &&
!f2fs_sb_has_compression(sbi))
return 0;
sbi->post_read_wq = alloc_workqueue("f2fs_post_read_wq",
WQ_UNBOUND | WQ_HIGHPRI,
num_online_cpus());
return sbi->post_read_wq ? 0 : -ENOMEM;
sbi->wq = alloc_workqueue("f2fs_wq", WQ_UNBOUND | WQ_HIGHPRI,
num_online_cpus());
return sbi->wq ? 0 : -ENOMEM;
}
void f2fs_destroy_post_read_wq(struct f2fs_sb_info *sbi)
void f2fs_destroy_wq(struct f2fs_sb_info *sbi)
{
if (sbi->post_read_wq)
destroy_workqueue(sbi->post_read_wq);
if (sbi->wq)
destroy_workqueue(sbi->wq);
}
int __init f2fs_init_bio_entry_cache(void)

View File

@@ -1979,7 +1979,7 @@ struct f2fs_sb_info {
/* Precomputed FS UUID checksum for seeding other checksums */
__u32 s_chksum_seed;
struct workqueue_struct *post_read_wq; /* post read workqueue */
struct workqueue_struct *wq; /* bio completion workqueue */
/*
* If we are in irq context, let's update error information into
@@ -4214,8 +4214,8 @@ bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len);
void f2fs_clear_page_cache_dirty_tag(struct folio *folio);
int f2fs_init_post_read_processing(void);
void f2fs_destroy_post_read_processing(void);
int f2fs_init_post_read_wq(struct f2fs_sb_info *sbi);
void f2fs_destroy_post_read_wq(struct f2fs_sb_info *sbi);
int f2fs_init_wq(struct f2fs_sb_info *sbi);
void f2fs_destroy_wq(struct f2fs_sb_info *sbi);
extern const struct iomap_ops f2fs_iomap_ops;
/*

View File

@@ -2075,7 +2075,7 @@ static void f2fs_put_super(struct super_block *sb)
/* flush s_error_work before sbi destroy */
flush_work(&sbi->s_error_work);
f2fs_destroy_post_read_wq(sbi);
f2fs_destroy_wq(sbi);
kvfree(sbi->ckpt);
@@ -5189,9 +5189,9 @@ static int f2fs_fill_super(struct super_block *sb, struct fs_context *fc)
goto free_devices;
}
err = f2fs_init_post_read_wq(sbi);
err = f2fs_init_wq(sbi);
if (err) {
f2fs_err(sbi, "Failed to initialize post read workqueue");
f2fs_err(sbi, "Failed to create workqueue");
goto free_devices;
}
@@ -5478,7 +5478,7 @@ static int f2fs_fill_super(struct super_block *sb, struct fs_context *fc)
f2fs_stop_ckpt_thread(sbi);
/* flush s_error_work before sbi destroy */
flush_work(&sbi->s_error_work);
f2fs_destroy_post_read_wq(sbi);
f2fs_destroy_wq(sbi);
free_devices:
destroy_device_list(sbi);
kvfree(sbi->ckpt);