The io priority of reading the original data of the verity-file
and reading hash blocks during verification should be consistent.
If the io priority is not set, when a high-task-priority process
reads the verity-file, the kworker's io priority may be too low,
resulting in delayed reading of hash blocks, which eventually
causes the high-task-priority process to response slowly.

Signed-off-by: Yi Sun <yi....@unisoc.com>
---
 fs/f2fs/data.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index b9b0debc6b3d..705a2bdf0848 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -172,6 +172,8 @@ static void f2fs_verify_bio(struct work_struct *work)
        struct bio *bio = ctx->bio;
        bool may_have_compressed_pages = (ctx->enabled_steps & STEP_DECOMPRESS);
 
+       may_adjust_work_task_ioprio(work);
+
        /*
         * fsverity_verify_bio() may call readahead() again, and while verity
         * will be disabled for this, decryption and/or decompression may still
@@ -204,6 +206,8 @@ static void f2fs_verify_bio(struct work_struct *work)
        }
 
        f2fs_finish_read_bio(bio, true);
+
+       restore_work_task_ioprio(work);
 }
 
 /*
@@ -221,6 +225,7 @@ static void f2fs_verify_and_finish_bio(struct bio *bio, 
bool in_task)
 
        if (ctx && (ctx->enabled_steps & STEP_VERITY)) {
                INIT_WORK(&ctx->work, f2fs_verify_bio);
+               set_work_ioprio(&ctx->work, bio->bi_ioprio);
                fsverity_enqueue_verify_work(&ctx->work);
        } else {
                f2fs_finish_read_bio(bio, in_task);
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to