blk-mq: remove blk_mq_sched_{get,put}_rq_priv
authorChristoph Hellwig <hch@lst.de>
Fri, 16 Jun 2017 16:15:20 +0000 (18:15 +0200)
committerJens Axboe <axboe@kernel.dk>
Sun, 18 Jun 2017 16:08:55 +0000 (10:08 -0600)
Having these as separate helpers in a header really does not help
readability, or my chances to refactor this code sanely.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-sched.c
block/blk-mq-sched.h
block/blk-mq.c

index 62db188595dc1ed090ded62f0ba6b0529add592b..22601e5c6f1982a67d6c70890fac3303682a8f7f 100644 (file)
@@ -36,6 +36,7 @@ static void __blk_mq_sched_assign_ioc(struct request_queue *q,
                                      struct bio *bio,
                                      struct io_context *ioc)
 {
+       struct elevator_queue *e = q->elevator;
        struct io_cq *icq;
 
        spin_lock_irq(q->queue_lock);
@@ -49,13 +50,14 @@ static void __blk_mq_sched_assign_ioc(struct request_queue *q,
        }
 
        rq->elv.icq = icq;
-       if (!blk_mq_sched_get_rq_priv(q, rq, bio)) {
-               rq->rq_flags |= RQF_ELVPRIV;
-               get_io_context(icq->ioc);
+       if (e && e->type->ops.mq.get_rq_priv &&
+           e->type->ops.mq.get_rq_priv(q, rq, bio)) {
+               rq->elv.icq = NULL;
                return;
        }
 
-       rq->elv.icq = NULL;
+       rq->rq_flags |= RQF_ELVPRIV;
+       get_io_context(icq->ioc);
 }
 
 void blk_mq_sched_assign_ioc(struct request_queue *q, struct request *rq,
index 5d12529538d0c472824cdfafb72f515c4492b45c..f34e6a522105381a694a854eddc5ae8865d5844f 100644 (file)
@@ -44,27 +44,6 @@ blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio)
        return __blk_mq_sched_bio_merge(q, bio);
 }
 
-static inline int blk_mq_sched_get_rq_priv(struct request_queue *q,
-                                          struct request *rq,
-                                          struct bio *bio)
-{
-       struct elevator_queue *e = q->elevator;
-
-       if (e && e->type->ops.mq.get_rq_priv)
-               return e->type->ops.mq.get_rq_priv(q, rq, bio);
-
-       return 0;
-}
-
-static inline void blk_mq_sched_put_rq_priv(struct request_queue *q,
-                                           struct request *rq)
-{
-       struct elevator_queue *e = q->elevator;
-
-       if (e && e->type->ops.mq.put_rq_priv)
-               e->type->ops.mq.put_rq_priv(q, rq);
-}
-
 static inline bool
 blk_mq_sched_allow_merge(struct request_queue *q, struct request *rq,
                         struct bio *bio)
index 694cbd69850750fc6c44bd63b1a52a3252922645..1a45c287db646c3fa9b40058e744da7881dcb38b 100644 (file)
@@ -438,7 +438,8 @@ void blk_mq_free_request(struct request *rq)
        struct elevator_queue *e = q->elevator;
 
        if (rq->rq_flags & RQF_ELVPRIV) {
-               blk_mq_sched_put_rq_priv(rq->q, rq);
+               if (e && e->type->ops.mq.put_rq_priv)
+                       e->type->ops.mq.put_rq_priv(q, rq);
                if (rq->elv.icq) {
                        put_io_context(rq->elv.icq->ioc);
                        rq->elv.icq = NULL;