nvme-pci: allocate nvme_command within driver pdu
[ Upstream commit af7fae857ea22e9c2aef812e1321d9c5c206edde ] Except for pci, all the nvme transport drivers allocate a command within the driver's pdu. Align pci with everyone else by allocating the nvme command within pci's pdu and replace the .queue_rq() stack variable with this. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
ba388d4e9a
commit
938f594266
@@ -224,6 +224,7 @@ struct nvme_queue {
|
|||||||
*/
|
*/
|
||||||
struct nvme_iod {
|
struct nvme_iod {
|
||||||
struct nvme_request req;
|
struct nvme_request req;
|
||||||
|
struct nvme_command cmd;
|
||||||
struct nvme_queue *nvmeq;
|
struct nvme_queue *nvmeq;
|
||||||
bool use_sgl;
|
bool use_sgl;
|
||||||
int aborted;
|
int aborted;
|
||||||
@@ -917,7 +918,7 @@ static blk_status_t nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|||||||
struct nvme_dev *dev = nvmeq->dev;
|
struct nvme_dev *dev = nvmeq->dev;
|
||||||
struct request *req = bd->rq;
|
struct request *req = bd->rq;
|
||||||
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
|
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
|
||||||
struct nvme_command cmnd;
|
struct nvme_command *cmnd = &iod->cmd;
|
||||||
blk_status_t ret;
|
blk_status_t ret;
|
||||||
|
|
||||||
iod->aborted = 0;
|
iod->aborted = 0;
|
||||||
@@ -931,24 +932,24 @@ static blk_status_t nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
|
|||||||
if (unlikely(!test_bit(NVMEQ_ENABLED, &nvmeq->flags)))
|
if (unlikely(!test_bit(NVMEQ_ENABLED, &nvmeq->flags)))
|
||||||
return BLK_STS_IOERR;
|
return BLK_STS_IOERR;
|
||||||
|
|
||||||
ret = nvme_setup_cmd(ns, req, &cmnd);
|
ret = nvme_setup_cmd(ns, req, cmnd);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (blk_rq_nr_phys_segments(req)) {
|
if (blk_rq_nr_phys_segments(req)) {
|
||||||
ret = nvme_map_data(dev, req, &cmnd);
|
ret = nvme_map_data(dev, req, cmnd);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_free_cmd;
|
goto out_free_cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blk_integrity_rq(req)) {
|
if (blk_integrity_rq(req)) {
|
||||||
ret = nvme_map_metadata(dev, req, &cmnd);
|
ret = nvme_map_metadata(dev, req, cmnd);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out_unmap_data;
|
goto out_unmap_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
blk_mq_start_request(req);
|
blk_mq_start_request(req);
|
||||||
nvme_submit_cmd(nvmeq, &cmnd, bd->last);
|
nvme_submit_cmd(nvmeq, cmnd, bd->last);
|
||||||
return BLK_STS_OK;
|
return BLK_STS_OK;
|
||||||
out_unmap_data:
|
out_unmap_data:
|
||||||
nvme_unmap_data(dev, req);
|
nvme_unmap_data(dev, req);
|
||||||
|
Reference in New Issue
Block a user