summaryrefslogtreecommitdiff
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-16 19:15:25 +0300
committerJens Axboe <axboe@kernel.dk>2017-06-18 19:08:55 +0300
commit44e8c2bff80bb384a608406009948f90a78bf8a3 (patch)
tree416c4aea5fb5c635bdc94170b8fb14ab284f21a4 /block/blk-mq.c
parent9f2107382636cf9a71951eb71ec04f2fb3641b37 (diff)
downloadlinux-44e8c2bff80bb384a608406009948f90a78bf8a3.tar.xz
blk-mq: refactor blk_mq_sched_assign_ioc
blk_mq_sched_assign_ioc now only handles the assigned of the ioc if the schedule needs it (bfq only at the moment). The caller to the per-request initializer is moved out so that it can be merged with a similar call for the kyber I/O scheduler. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index e056725679a8..2f380ab7a603 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -315,8 +315,18 @@ allocated:
if (!op_is_flush(op)) {
rq->elv.icq = NULL;
- if (e && e->type->icq_cache)
- blk_mq_sched_assign_ioc(q, rq, bio);
+ if (e && e->type->ops.mq.get_rq_priv) {
+ if (e->type->icq_cache && rq_ioc(bio))
+ blk_mq_sched_assign_ioc(rq, bio);
+
+ if (e->type->ops.mq.get_rq_priv(q, rq, bio)) {
+ if (rq->elv.icq)
+ put_io_context(rq->elv.icq->ioc);
+ rq->elv.icq = NULL;
+ } else {
+ rq->rq_flags |= RQF_ELVPRIV;
+ }
+ }
}
data->hctx->queued++;
return rq;