From: Logan Gunthorpe <logang@deltatee.com>
To: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
linux-nvme@lists.infradead.org
Cc: hch@lst.de, sagi@grimberg.me
Subject: Re: [PATCH 05/14] nvmet: get rid of the extra variable
Date: Mon, 10 Aug 2020 15:58:27 -0600 [thread overview]
Message-ID: <f7dfd268-9b02-4711-85d4-eebd8614f8d8@deltatee.com> (raw)
In-Reply-To: <20200810185456.7713-6-chaitanya.kulkarni@wdc.com>
On 2020-08-10 12:54 p.m., Chaitanya Kulkarni wrote:
> In function nvmet_passthru_execute_cmd() the return value of the
> function nvmet_passthru_map_sg() is not used to determine stauts i.e.
> we can safely ignore the actual cause of error that is returned and just
> check for binary status pass or fail.
>
> The prior check to this function call can be combined safely with the &&
> so that we can get rid of the extra variable and second if condition.
>
> Remove the extra variable and adjust the code accordingly to have only
> one if condition.
>
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
> drivers/nvme/target/passthru.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
> index 58377420874f..9a175b8b9d57 100644
> --- a/drivers/nvme/target/passthru.c
> +++ b/drivers/nvme/target/passthru.c
> @@ -221,7 +221,6 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
> struct request *rq = NULL;
> u32 effects;
> u16 status;
> - int ret;
>
> if (likely(req->sq->qid != 0)) {
> u32 nsid = le32_to_cpu(req->cmd->common.nsid);
> @@ -242,12 +241,9 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req)
> goto out_put_ns;
> }
>
> - if (likely(req->sg_cnt)) {
> - ret = nvmet_passthru_map_sg(req, rq);
> - if (unlikely(ret)) {
> - status = NVME_SC_INTERNAL;
> - goto out_put_req;
> - }
> + if (likely(req->sg_cnt) && unlikely(nvmet_passthru_map_sg(req, rq))) {
> + status = NVME_SC_INTERNAL;
> + goto out_put_req;
> }
IMO, that's really ugly and not at all an improvement.
Logan
_______________________________________________
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-10 21:58 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-10 18:54 [PATCH 00/14] nvmet: passthru few fixes and improvements Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 01/14] nvmet: for pt I/O cmds annotate req->sg_cnt likely Chaitanya Kulkarni
2020-08-10 21:54 ` Logan Gunthorpe
2020-08-10 22:54 ` Chaitanya Kulkarni
2020-08-10 22:55 ` Logan Gunthorpe
2020-08-10 23:16 ` Chaitanya Kulkarni
2020-08-14 10:33 ` hch
2020-08-10 18:54 ` [PATCH 02/14] nvmet: for pt I/O commands use likely for ns check Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 03/14] nvmet: use consistent type with id->nlbaf Chaitanya Kulkarni
2020-08-10 21:55 ` Logan Gunthorpe
2020-08-10 22:56 ` Chaitanya Kulkarni
2020-08-10 22:57 ` Logan Gunthorpe
2020-08-10 23:20 ` Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 04/14] nvmet: use consistent type for op_flag Chaitanya Kulkarni
2020-08-10 21:56 ` Logan Gunthorpe
2020-08-10 22:56 ` Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 05/14] nvmet: get rid of the extra variable Chaitanya Kulkarni
2020-08-10 21:58 ` Logan Gunthorpe [this message]
2020-08-10 23:00 ` Chaitanya Kulkarni
2020-08-10 23:13 ` Keith Busch
2020-08-10 23:25 ` Chaitanya Kulkarni
2020-08-10 23:32 ` Logan Gunthorpe
2020-08-10 18:54 ` [PATCH 06/14] nvmet: use unlikely for uncommon commands Chaitanya Kulkarni
2020-08-10 20:46 ` Keith Busch
2020-08-10 22:01 ` Logan Gunthorpe
2020-08-10 18:54 ` [PATCH 07/14] nvmet: reuse pt-req-done for rq completion Chaitanya Kulkarni
2020-08-10 22:10 ` Logan Gunthorpe
2020-08-10 23:02 ` Chaitanya Kulkarni
2020-08-14 10:37 ` hch
2020-08-10 18:54 ` [PATCH 08/14] nvmet: use nvme write cmd group setting op_flag Chaitanya Kulkarni
2020-08-10 21:11 ` Keith Busch
2020-08-10 23:04 ` Chaitanya Kulkarni
2020-08-10 23:10 ` Keith Busch
2020-08-10 23:23 ` Chaitanya Kulkarni
2020-08-10 23:26 ` Keith Busch
2020-08-10 23:33 ` Chaitanya Kulkarni
2020-08-10 22:14 ` Logan Gunthorpe
2020-08-10 23:08 ` Chaitanya Kulkarni
2020-08-10 23:23 ` Logan Gunthorpe
2020-08-10 23:32 ` Chaitanya Kulkarni
2020-08-10 23:34 ` Logan Gunthorpe
2020-08-10 18:54 ` [PATCH 09/14] nvmet: based on passthru req control use REQ_FUA Chaitanya Kulkarni
2020-08-14 10:37 ` Christoph Hellwig
2020-08-10 18:54 ` [PATCH 10/14] nvmet: prep patch for pt ctrl put wrapper Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 11/14] nvmet: fix nvme module ref count Oops Chaitanya Kulkarni
2020-08-10 22:39 ` Logan Gunthorpe
2020-08-10 23:11 ` Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 12/14] block: move blk_rq_bio_prep() to linux/blk-mq.h Chaitanya Kulkarni
2020-08-10 18:54 ` [PATCH 13/14] nvmet: use minimized version of blk_rq_append_bio Chaitanya Kulkarni
2020-08-10 22:41 ` Logan Gunthorpe
2020-08-10 18:54 ` [PATCH 14/14] nvmet: use inline bio for passthru fast path Chaitanya Kulkarni
2020-08-10 22:47 ` Logan Gunthorpe
2020-08-10 23:14 ` Chaitanya Kulkarni
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=f7dfd268-9b02-4711-85d4-eebd8614f8d8@deltatee.com \
--to=logang@deltatee.com \
--cc=chaitanya.kulkarni@wdc.com \
--cc=hch@lst.de \
--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