Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

blk-mq: update driver tags request table when start request

Now we update driver tags request table in blk_mq_get_driver_tag(),
so the driver that support queue_rqs() have to update that inflight
table by itself.

Move it to blk_mq_start_request(), which is a better place where
we setup the deadline for request timeout check. And it's just
where the request becomes inflight.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230913151616.3164338-5-chengming.zhou@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Chengming Zhou and committed by
Jens Axboe
217b613a 434097ee

+1 -6
+1
block/blk-mq.c
··· 1259 1259 1260 1260 blk_add_timer(rq); 1261 1261 WRITE_ONCE(rq->state, MQ_RQ_IN_FLIGHT); 1262 + rq->mq_hctx->tags->rqs[rq->tag] = rq; 1262 1263 1263 1264 #ifdef CONFIG_BLK_DEV_INTEGRITY 1264 1265 if (blk_integrity_rq(rq) && req_op(rq) == REQ_OP_WRITE)
-3
block/blk-mq.h
··· 351 351 352 352 static inline bool blk_mq_get_driver_tag(struct request *rq) 353 353 { 354 - struct blk_mq_hw_ctx *hctx = rq->mq_hctx; 355 - 356 354 if (rq->tag == BLK_MQ_NO_TAG && !__blk_mq_alloc_driver_tag(rq)) 357 355 return false; 358 356 359 - hctx->tags->rqs[rq->tag] = rq; 360 357 return true; 361 358 } 362 359
-2
drivers/block/virtio_blk.c
··· 470 470 struct virtio_blk *vblk = req->mq_hctx->queue->queuedata; 471 471 struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); 472 472 473 - req->mq_hctx->tags->rqs[req->tag] = req; 474 - 475 473 return virtblk_prep_rq(req->mq_hctx, vblk, req, vbr) == BLK_STS_OK; 476 474 } 477 475
-1
drivers/nvme/host/pci.c
··· 924 924 if (unlikely(!nvme_check_ready(&nvmeq->dev->ctrl, req, true))) 925 925 return false; 926 926 927 - req->mq_hctx->tags->rqs[req->tag] = req; 928 927 return nvme_prep_rq(nvmeq->dev, req) == BLK_STS_OK; 929 928 } 930 929