Commit 2c30540b authored by Jens Axboe's avatar Jens Axboe

NVMe: add ->exit_hctx() hook

If we do teardown and setup of the queue and block related parts
of the driver, then we should clear nvmeq->hctx once we kill the
hardware queue.
Acked-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent e32efbfc
...@@ -171,6 +171,13 @@ static int nvme_admin_init_request(void *data, struct request *req, ...@@ -171,6 +171,13 @@ static int nvme_admin_init_request(void *data, struct request *req,
return 0; return 0;
} }
static void nvme_exit_hctx(struct blk_mq_hw_ctx *hctx, unsigned int hctx_idx)
{
struct nvme_queue *nvmeq = hctx->driver_data;
nvmeq->hctx = NULL;
}
static int nvme_init_hctx(struct blk_mq_hw_ctx *hctx, void *data, static int nvme_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
unsigned int hctx_idx) unsigned int hctx_idx)
{ {
...@@ -1335,6 +1342,7 @@ static struct blk_mq_ops nvme_mq_admin_ops = { ...@@ -1335,6 +1342,7 @@ static struct blk_mq_ops nvme_mq_admin_ops = {
.queue_rq = nvme_admin_queue_rq, .queue_rq = nvme_admin_queue_rq,
.map_queue = blk_mq_map_queue, .map_queue = blk_mq_map_queue,
.init_hctx = nvme_admin_init_hctx, .init_hctx = nvme_admin_init_hctx,
.exit_hctx = nvme_exit_hctx,
.init_request = nvme_admin_init_request, .init_request = nvme_admin_init_request,
.timeout = nvme_timeout, .timeout = nvme_timeout,
}; };
...@@ -1343,6 +1351,7 @@ static struct blk_mq_ops nvme_mq_ops = { ...@@ -1343,6 +1351,7 @@ static struct blk_mq_ops nvme_mq_ops = {
.queue_rq = nvme_queue_rq, .queue_rq = nvme_queue_rq,
.map_queue = blk_mq_map_queue, .map_queue = blk_mq_map_queue,
.init_hctx = nvme_init_hctx, .init_hctx = nvme_init_hctx,
.exit_hctx = nvme_exit_hctx,
.init_request = nvme_init_request, .init_request = nvme_init_request,
.timeout = nvme_timeout, .timeout = nvme_timeout,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment