summaryrefslogtreecommitdiffstats
path: root/block/blk-mq-sched.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-11-13 19:18:32 +0100
committerJens Axboe <axboe@kernel.dk>2021-11-29 14:38:44 +0100
commit5a9d041ba2f6da468c891ca0fe263758e2c12091 (patch)
treeb3d5bcc519faf89478dfd375f9f1590f1e759216 /block/blk-mq-sched.c
parentblock: only allocate poll_stats if there's a user of them (diff)
downloadlinux-5a9d041ba2f6da468c891ca0fe263758e2c12091.tar.xz
linux-5a9d041ba2f6da468c891ca0fe263758e2c12091.zip
block: move io_context creation into where it's needed
The only user of the io_context for IO is BFQ, yet we put the checking and logic of it into the normal IO path. Put the creation into blk_mq_sched_assign_ioc(), and have BFQ use that helper. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq-sched.c')
-rw-r--r--block/blk-mq-sched.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index ba21449439cc..b942b38000e5 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -24,6 +24,10 @@ void blk_mq_sched_assign_ioc(struct request *rq)
struct io_context *ioc;
struct io_cq *icq;
+ /* create task io_context, if we don't have one already */
+ if (unlikely(!current->io_context))
+ create_task_io_context(current, GFP_ATOMIC, q->node);
+
/*
* May not have an IO context if it's a passthrough request
*/
@@ -43,6 +47,7 @@ void blk_mq_sched_assign_ioc(struct request *rq)
get_io_context(icq->ioc);
rq->elv.icq = icq;
}
+EXPORT_SYMBOL_GPL(blk_mq_sched_assign_ioc);
/*
* Mark a hardware queue as needing a restart. For shared queues, maintain