Add support for specifying the number of retries per NVMe request. Cc: Christoph Hellwig <hch@xxxxxx> Cc: Keith Busch <kbusch@xxxxxxxxxx> Cc: Sagi Grimberg <sagi@xxxxxxxxxxx> Cc: Chaitanya Kulkarni <kch@xxxxxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- drivers/nvme/host/core.c | 3 ++- drivers/nvme/host/nvme.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 24165daee3c8..fe0d09fc70ba 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -339,7 +339,7 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req) if (blk_noretry_request(req) || (nvme_req(req)->status & NVME_SC_DNR) || - nvme_req(req)->retries >= nvme_max_retries) + nvme_req(req)->retries >= nvme_req(req)->max_retries) return COMPLETE; if (req->cmd_flags & REQ_NVME_MPATH) { @@ -632,6 +632,7 @@ static inline void nvme_clear_nvme_request(struct request *req) { nvme_req(req)->status = 0; nvme_req(req)->retries = 0; + nvme_req(req)->max_retries = nvme_max_retries; nvme_req(req)->flags = 0; req->rq_flags |= RQF_DONTPREP; } diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 9b72b6ecf33c..15bb36923d09 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -160,6 +160,7 @@ struct nvme_request { union nvme_result result; u8 genctr; u8 retries; + u8 max_retries; u8 flags; u16 status; struct nvme_ctrl *ctrl;