blk-mq-sched: unify request finished methods
authorChristoph Hellwig <hch@lst.de>
Fri, 16 Jun 2017 16:15:21 +0000 (18:15 +0200)
committerJens Axboe <axboe@kernel.dk>
Sun, 18 Jun 2017 16:08:55 +0000 (10:08 -0600)
No need to have two different callouts of bfq vs kyber.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bfq-iosched.c
block/blk-mq.c
block/kyber-iosched.c
include/linux/elevator.h

index ed93da2462abbc94ab75c10a0d9c7ce251f3f0fb..4f69e39c2f89885cb84d2711eff5e9496f90eb38 100644 (file)
@@ -4290,7 +4290,7 @@ static void bfq_put_rq_priv_body(struct bfq_queue *bfqq)
        bfq_put_queue(bfqq);
 }
 
-static void bfq_put_rq_private(struct request_queue *q, struct request *rq)
+static void bfq_finish_request(struct request *rq)
 {
        struct bfq_queue *bfqq = RQ_BFQQ(rq);
        struct bfq_data *bfqd = bfqq->bfqd;
@@ -4324,7 +4324,7 @@ static void bfq_put_rq_private(struct request_queue *q, struct request *rq)
                 */
 
                if (!RB_EMPTY_NODE(&rq->rb_node))
-                       bfq_remove_request(q, rq);
+                       bfq_remove_request(rq->q, rq);
                bfq_put_rq_priv_body(bfqq);
        }
 
@@ -4951,7 +4951,7 @@ static struct elv_fs_entry bfq_attrs[] = {
 static struct elevator_type iosched_bfq_mq = {
        .ops.mq = {
                .get_rq_priv            = bfq_get_rq_private,
-               .put_rq_priv            = bfq_put_rq_private,
+               .finish_request         = bfq_finish_request,
                .exit_icq               = bfq_exit_icq,
                .insert_requests        = bfq_insert_requests,
                .dispatch_request       = bfq_dispatch_request,
index 1a45c287db646c3fa9b40058e744da7881dcb38b..9df7e0394a48176e756c4004f2c4907bbfe053bd 100644 (file)
@@ -437,19 +437,16 @@ void blk_mq_free_request(struct request *rq)
        struct request_queue *q = rq->q;
        struct elevator_queue *e = q->elevator;
 
-       if (rq->rq_flags & RQF_ELVPRIV) {
-               if (e && e->type->ops.mq.put_rq_priv)
-                       e->type->ops.mq.put_rq_priv(q, rq);
+       if (rq->rq_flags & (RQF_ELVPRIV | RQF_QUEUED)) {
+               if (e && e->type->ops.mq.finish_request)
+                       e->type->ops.mq.finish_request(rq);
                if (rq->elv.icq) {
                        put_io_context(rq->elv.icq->ioc);
                        rq->elv.icq = NULL;
                }
        }
 
-       if ((rq->rq_flags & RQF_QUEUED) && e && e->type->ops.mq.put_request)
-               e->type->ops.mq.put_request(rq);
-       else
-               blk_mq_finish_request(rq);
+       blk_mq_finish_request(rq);
 }
 EXPORT_SYMBOL_GPL(blk_mq_free_request);
 
index b9faabc75fdb031b4f9d7917b1f91aa8e4ba2c06..2557b399f0a8ee2bf87e408f6c191d677a8f4e75 100644 (file)
@@ -446,13 +446,11 @@ static struct request *kyber_get_request(struct request_queue *q,
        return rq;
 }
 
-static void kyber_put_request(struct request *rq)
+static void kyber_finish_request(struct request *rq)
 {
-       struct request_queue *q = rq->q;
-       struct kyber_queue_data *kqd = q->elevator->elevator_data;
+       struct kyber_queue_data *kqd = rq->q->elevator->elevator_data;
 
        rq_clear_domain_token(kqd, rq);
-       blk_mq_finish_request(rq);
 }
 
 static void kyber_completed_request(struct request *rq)
@@ -816,7 +814,7 @@ static struct elevator_type kyber_sched = {
                .init_hctx = kyber_init_hctx,
                .exit_hctx = kyber_exit_hctx,
                .get_request = kyber_get_request,
-               .put_request = kyber_put_request,
+               .finish_request = kyber_finish_request,
                .completed_request = kyber_completed_request,
                .dispatch_request = kyber_dispatch_request,
                .has_work = kyber_has_work,
index 0e306c5a86d6ee90debc824aa5d18e8f6d078f4d..4acea351d43fa88dea18254836d64ddb40e105ee 100644 (file)
@@ -105,7 +105,7 @@ struct elevator_mq_ops {
        void (*request_merged)(struct request_queue *, struct request *, enum elv_merge);
        void (*requests_merged)(struct request_queue *, struct request *, struct request *);
        struct request *(*get_request)(struct request_queue *, unsigned int, struct blk_mq_alloc_data *);
-       void (*put_request)(struct request *);
+       void (*finish_request)(struct request *);
        void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool);
        struct request *(*dispatch_request)(struct blk_mq_hw_ctx *);
        bool (*has_work)(struct blk_mq_hw_ctx *);
@@ -115,7 +115,6 @@ struct elevator_mq_ops {
        struct request *(*former_request)(struct request_queue *, struct request *);
        struct request *(*next_request)(struct request_queue *, struct request *);
        int (*get_rq_priv)(struct request_queue *, struct request *, struct bio *);
-       void (*put_rq_priv)(struct request_queue *, struct request *);
        void (*init_icq)(struct io_cq *);
        void (*exit_icq)(struct io_cq *);
 };