Skip to content

Commit 2c30540

Browse files
committed
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: Keith Busch <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e32efbf commit 2c30540

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/block/nvme-core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ static int nvme_admin_init_request(void *data, struct request *req,
171171
return 0;
172172
}
173173

174+
static void nvme_exit_hctx(struct blk_mq_hw_ctx *hctx, unsigned int hctx_idx)
175+
{
176+
struct nvme_queue *nvmeq = hctx->driver_data;
177+
178+
nvmeq->hctx = NULL;
179+
}
180+
174181
static int nvme_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
175182
unsigned int hctx_idx)
176183
{
@@ -1335,6 +1342,7 @@ static struct blk_mq_ops nvme_mq_admin_ops = {
13351342
.queue_rq = nvme_admin_queue_rq,
13361343
.map_queue = blk_mq_map_queue,
13371344
.init_hctx = nvme_admin_init_hctx,
1345+
.exit_hctx = nvme_exit_hctx,
13381346
.init_request = nvme_admin_init_request,
13391347
.timeout = nvme_timeout,
13401348
};
@@ -1343,6 +1351,7 @@ static struct blk_mq_ops nvme_mq_ops = {
13431351
.queue_rq = nvme_queue_rq,
13441352
.map_queue = blk_mq_map_queue,
13451353
.init_hctx = nvme_init_hctx,
1354+
.exit_hctx = nvme_exit_hctx,
13461355
.init_request = nvme_init_request,
13471356
.timeout = nvme_timeout,
13481357
};

0 commit comments

Comments
 (0)