block: Inline blk_rq_set_prio()
authorBart Van Assche <bart.vanassche@sandisk.com>
Wed, 19 Apr 2017 21:01:27 +0000 (14:01 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 19 Apr 2017 23:38:34 +0000 (17:38 -0600)
Since only a single caller remains, inline blk_rq_set_prio(). Initialize
req->ioprio even if no I/O priority has been set in the bio nor in the
I/O context.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Adam Manzanares <adam.manzanares@wdc.com>
Tested-by: Adam Manzanares <adam.manzanares@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-core.c
include/linux/blkdev.h

index 72544b462657d71d912dde21d15a389f8d7c5fce..25aea293ee9887c309e7fe62fb6c82602a7c4f2b 100644 (file)
@@ -1630,14 +1630,19 @@ out:
 
 void blk_init_request_from_bio(struct request *req, struct bio *bio)
 {
+       struct io_context *ioc = rq_ioc(bio);
+
        if (bio->bi_opf & REQ_RAHEAD)
                req->cmd_flags |= REQ_FAILFAST_MASK;
 
        req->errors = 0;
        req->__sector = bio->bi_iter.bi_sector;
-       blk_rq_set_prio(req, rq_ioc(bio));
        if (ioprio_valid(bio_prio(bio)))
                req->ioprio = bio_prio(bio);
+       else if (ioc)
+               req->ioprio = ioc->ioprio;
+       else
+               req->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
        blk_rq_bio_prep(req->q, req, bio);
 }
 EXPORT_SYMBOL_GPL(blk_init_request_from_bio);
index 3470375952a101db6c194ba47f50afccb62f79a7..51c9e391798e68422649f95fc21b4bbf4645a35d 100644 (file)
@@ -1087,20 +1087,6 @@ static inline unsigned int blk_rq_count_bios(struct request *rq)
        return nr_bios;
 }
 
-/*
- * blk_rq_set_prio - associate a request with prio from ioc
- * @rq: request of interest
- * @ioc: target iocontext
- *
- * Assocate request prio with ioc prio so request based drivers
- * can leverage priority information.
- */
-static inline void blk_rq_set_prio(struct request *rq, struct io_context *ioc)
-{
-       if (ioc)
-               rq->ioprio = ioc->ioprio;
-}
-
 /*
  * Request issue related functions.
  */