block: initialize the write priority in blk_rq_bio_prep [Linux 5.3]

This Linux kernel change "block: initialize the write priority in blk_rq_bio_prep" is included in the Linux 5.3 release. This change is authored by Christoph Hellwig <hch [at] lst.de> on Thu Jun 6 12:28:59 2019 +0200. The commit for this change in Linux stable tree is 0c8cf8c (patch).

block: initialize the write priority in blk_rq_bio_prep

The priority field also makes sense for passthrough requests, so
initialize it in blk_rq_bio_prep.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 94c6520..b6f22f2 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -693,7 +693,6 @@ void blk_init_request_from_bio(struct request *req, struct bio *bio)
        req->cmd_flags |= REQ_FAILFAST_MASK;

    req->__sector = bio->bi_iter.bi_sector;
-   req->ioprio = bio_prio(bio);
    req->write_hint = bio->bi_write_hint;
    blk_rq_bio_prep(req->q, req, bio);
 }
@@ -1449,6 +1448,7 @@ void blk_rq_bio_prep(struct request_queue *q, struct request *rq,

    rq->__data_len = bio->bi_iter.bi_size;
    rq->bio = rq->biotail = bio;
+   rq->ioprio = bio_prio(bio);

    if (bio->bi_disk)
        rq->rq_disk = bio->bi_disk;

Leave a Reply

Your email address will not be published. Required fields are marked *