From: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
To: Sagi Grimberg <sagi@grimberg.me>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: Keith Busch <keith.busch@intel.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/2] nvmet-tcp: remove superflous check on request sgl
Date: Sun, 22 Sep 2019 05:37:30 +0000 [thread overview]
Message-ID: <BYAPR04MB574995E9BEA354AC196523CF868A0@BYAPR04MB5749.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20190920181818.14424-2-sagi@grimberg.me
Please have a look at the comment at patch #1.
If you look at the nvmet_req_free_sgl() we don't have
such check since I think code assumes that sgl_free() is null safe.
If that is correct we don't need additional checks in the
code anyway
Please correct me if I'm wrong.
On 09/20/2019 11:18 AM, Sagi Grimberg wrote:
> Now that sgl_free is null safe, drop the superflous check.
>
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
> drivers/nvme/target/tcp.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index bf4f03474e89..d535080b781f 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -348,8 +348,7 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd)
>
> return 0;
> err:
> - if (cmd->req.sg_cnt)
> - sgl_free(cmd->req.sg);
> + sgl_free(cmd->req.sg);
> return NVME_SC_INTERNAL;
> }
>
> @@ -554,8 +553,7 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd)
>
> if (queue->nvme_sq.sqhd_disabled) {
> kfree(cmd->iov);
> - if (cmd->req.sg_cnt)
> - sgl_free(cmd->req.sg);
> + sgl_free(cmd->req.sg);
> }
>
> return 1;
> @@ -586,8 +584,7 @@ static int nvmet_try_send_response(struct nvmet_tcp_cmd *cmd,
> return -EAGAIN;
>
> kfree(cmd->iov);
> - if (cmd->req.sg_cnt)
> - sgl_free(cmd->req.sg);
> + sgl_free(cmd->req.sg);
> cmd->queue->snd_cmd = NULL;
> nvmet_tcp_put_cmd(cmd);
> return 1;
> @@ -1310,8 +1307,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd)
> nvmet_req_uninit(&cmd->req);
> nvmet_tcp_unmap_pdu_iovec(cmd);
> kfree(cmd->iov);
> - if (cmd->req.sg_cnt)
> - sgl_free(cmd->req.sg);
> + sgl_free(cmd->req.sg);
> }
>
> static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)
>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-09-22 5:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 18:18 [PATCH 1/2] scatterlist: make sgl_free null pointer safe Sagi Grimberg
2019-09-20 18:18 ` [PATCH 2/2] nvmet-tcp: remove superflous check on request sgl Sagi Grimberg
2019-09-22 5:37 ` Chaitanya Kulkarni [this message]
2019-09-27 21:22 ` Christoph Hellwig
2019-09-22 5:33 ` [PATCH 1/2] scatterlist: make sgl_free null pointer safe Chaitanya Kulkarni
2019-09-23 17:05 ` Sagi Grimberg
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=BYAPR04MB574995E9BEA354AC196523CF868A0@BYAPR04MB5749.namprd04.prod.outlook.com \
--to=chaitanya.kulkarni@wdc.com \
--cc=hch@lst.de \
--cc=keith.busch@intel.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).