From: Mike Snitzer <snitzer@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, Chao Leng <lengchao@huawei.com>
Subject: Re: [PATCH 2/4] nvme: refactor command completion
Date: Mon, 17 Aug 2020 15:28:59 -0400 [thread overview]
Message-ID: <20200817192859.GA31161@redhat.com> (raw)
In-Reply-To: <20200817081544.837699-3-hch@lst.de>
On Mon, Aug 17 2020 at 4:15am -0400,
Christoph Hellwig <hch@lst.de> wrote:
> Lift all the code to decide the dispostition of a completed command
> from nvme_complete_rq and nvme_failover_req into a new helper, which
> returns an emum of the potential actions. nvme_complete_rq then
> just switches on those and calls the proper helper for the action.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/nvme/host/core.c | 76 ++++++++++++++++++++++-------------
> drivers/nvme/host/multipath.c | 47 ++++++----------------
> drivers/nvme/host/nvme.h | 31 ++++++++++++--
> 3 files changed, 90 insertions(+), 64 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 88cff309d8e4f0..8d474adad721fb 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -241,17 +241,6 @@ static blk_status_t nvme_error_status(u16 status)
> }
> }
>
> -static inline bool nvme_req_needs_retry(struct request *req)
> -{
> - if (blk_noretry_request(req))
> - return false;
> - if (nvme_req(req)->status & NVME_SC_DNR)
> - return false;
> - if (nvme_req(req)->retries >= nvme_max_retries)
> - return false;
> - return true;
> -}
> -
> static void nvme_retry_req(struct request *req)
> {
> struct nvme_ns *ns = req->q->queuedata;
> @@ -268,34 +257,67 @@ static void nvme_retry_req(struct request *req)
> blk_mq_delay_kick_requeue_list(req->q, delay);
> }
>
> -void nvme_complete_rq(struct request *req)
> +enum nvme_disposition {
> + COMPLETE,
> + RETRY,
> + FAILOVER,
> +};
> +
> +static inline enum nvme_disposition nvme_decide_disposition(struct request *req)
> {
> - blk_status_t status = nvme_error_status(nvme_req(req)->status);
> + u16 status = nvme_req(req)->status & 0x7ff;
>
> - trace_nvme_complete_rq(req);
> + if (likely(status == 0))
> + return COMPLETE;
>
> - nvme_cleanup_cmd(req);
> + if (blk_noretry_request(req) || (status & NVME_SC_DNR) ||
> + nvme_req(req)->retries >= nvme_max_retries)
> + return COMPLETE;
Looking just a bit closer, the above DNR test seems wrong because of the
0x7ff mask applied. That mask drops access to NVME_SC_DNR right?
Mike
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2020-08-17 19:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 8:15 nvme completion handling refactor and fix v2 Christoph Hellwig
2020-08-17 8:15 ` [PATCH 1/4] nvme: rename and document nvme_end_request Christoph Hellwig
2020-08-17 14:53 ` Mike Snitzer
2020-08-17 8:15 ` [PATCH 2/4] nvme: refactor command completion Christoph Hellwig
2020-08-17 15:08 ` Mike Snitzer
2020-08-17 19:28 ` Mike Snitzer [this message]
2020-08-18 6:26 ` Christoph Hellwig
2020-08-17 8:15 ` [PATCH 3/4] nvme: just check the status code type in nvme_is_path_error Christoph Hellwig
2020-08-17 15:11 ` Mike Snitzer
2020-08-17 19:31 ` Sagi Grimberg
2020-08-18 6:31 ` Christoph Hellwig
2020-08-17 8:15 ` [PATCH 4/4] nvme: redirect commands on dying queue Christoph Hellwig
2020-08-17 15:23 ` Mike Snitzer
2020-08-18 6:32 ` Christoph Hellwig
2020-08-17 18:10 ` nvme completion handling refactor and fix v2 Sagi Grimberg
2020-08-18 6:33 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2020-08-18 7:11 nvme completion handling refactor and fix v3 Christoph Hellwig
2020-08-18 7:11 ` [PATCH 2/4] nvme: refactor command completion Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200817192859.GA31161@redhat.com \
--to=snitzer@redhat.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=lengchao@huawei.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).