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

Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
---
 fs/f2fs/compress.c |  2 +-
 fs/f2fs/data.c     | 22 ++++++++--------------
 fs/f2fs/f2fs.h     |  6 +++---
 fs/f2fs/super.c    |  8 ++++----
 4 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 881e76158b96..b3c016c4094b 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -1807,7 +1807,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);
                }
        }
 }
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 1659a57a6d5b..080d69fa8cd1 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -341,7 +341,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;
                }
        }
@@ -4477,23 +4477,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)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 91f506e7c9cf..30353c439d3c 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1969,7 +1969,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
@@ -4193,8 +4193,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;
 
 /*
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index ccf806b676f5..5a100f740b3f 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2074,7 +2074,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);
 
@@ -5130,9 +5130,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;
        }
 
@@ -5419,7 +5419,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);


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to