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

nvme: rename and document nvme_end_request

nvme_end_request is a bit misnamed, as it wraps around the
blk_mq_complete_* API. It's semantics also are non-trivial, so give it
a more descriptive name and add a comment explaining the semantics.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
2eb81a33 c41ad98b

+14 -8
+1 -1
Documentation/fault-injection/nvme-fault-injection.rst
··· 3 3 Linux's fault injection framework provides a systematic way to support 4 4 error injection via debugfs in the /sys/kernel/debug directory. When 5 5 enabled, the default NVME_SC_INVALID_OPCODE with no retry will be 6 - injected into the nvme_end_request. Users can change the default status 6 + injected into the nvme_try_complete_req. Users can change the default status 7 7 code and no retry flag via the debugfs. The list of Generic Command 8 8 Status can be found in include/linux/nvme.h 9 9
+1 -1
drivers/nvme/host/fc.c
··· 2035 2035 } 2036 2036 2037 2037 __nvme_fc_fcpop_chk_teardowns(ctrl, op, opstate); 2038 - if (!nvme_end_request(rq, status, result)) 2038 + if (!nvme_try_complete_req(rq, status, result)) 2039 2039 nvme_fc_complete_rq(rq); 2040 2040 2041 2041 check_error:
+7 -1
drivers/nvme/host/nvme.h
··· 523 523 return (len >> 2) - 1; 524 524 } 525 525 526 - static inline bool nvme_end_request(struct request *req, __le16 status, 526 + /* 527 + * Fill in the status and result information from the CQE, and then figure out 528 + * if blk-mq will need to use IPI magic to complete the request, and if yes do 529 + * so. If not let the caller complete the request without an indirect function 530 + * call. 531 + */ 532 + static inline bool nvme_try_complete_req(struct request *req, __le16 status, 527 533 union nvme_result result) 528 534 { 529 535 struct nvme_request *rq = nvme_req(req);
+1 -1
drivers/nvme/host/pci.c
··· 961 961 962 962 req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id); 963 963 trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail); 964 - if (!nvme_end_request(req, cqe->status, cqe->result)) 964 + if (!nvme_try_complete_req(req, cqe->status, cqe->result)) 965 965 nvme_pci_complete_rq(req); 966 966 } 967 967
+1 -1
drivers/nvme/host/rdma.c
··· 1189 1189 1190 1190 if (!refcount_dec_and_test(&req->ref)) 1191 1191 return; 1192 - if (!nvme_end_request(rq, req->status, req->result)) 1192 + if (!nvme_try_complete_req(rq, req->status, req->result)) 1193 1193 nvme_rdma_complete_rq(rq); 1194 1194 } 1195 1195
+2 -2
drivers/nvme/host/tcp.c
··· 481 481 return -EINVAL; 482 482 } 483 483 484 - if (!nvme_end_request(rq, cqe->status, cqe->result)) 484 + if (!nvme_try_complete_req(rq, cqe->status, cqe->result)) 485 485 nvme_complete_rq(rq); 486 486 queue->nr_cqe++; 487 487 ··· 672 672 { 673 673 union nvme_result res = {}; 674 674 675 - if (!nvme_end_request(rq, cpu_to_le16(status << 1), res)) 675 + if (!nvme_try_complete_req(rq, cpu_to_le16(status << 1), res)) 676 676 nvme_complete_rq(rq); 677 677 } 678 678
+1 -1
drivers/nvme/target/loop.c
··· 115 115 return; 116 116 } 117 117 118 - if (!nvme_end_request(rq, cqe->status, cqe->result)) 118 + if (!nvme_try_complete_req(rq, cqe->status, cqe->result)) 119 119 nvme_loop_complete_rq(rq); 120 120 } 121 121 }