mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: "kbusch@kernel.org" <kbusch@kernel.org>,
	"axboe@fb.com" <axboe@fb.com>, "hch@lst.de" <hch@lst.de>,
	"sagi@grimberg.me" <sagi@grimberg.me>,
	"baolin.wang7@gmail.com" <baolin.wang7@gmail.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nvme: Remove redundant validation in nvme_start_ctrl()
Date: Tue, 14 Jul 2020 11:23:52 +0800	[thread overview]
Message-ID: <20200714032352.GA111285@VM20190228-100.tbsite.net> (raw)
In-Reply-To: <BYAPR04MB49655C05950BC7BDAD30629F86600@BYAPR04MB4965.namprd04.prod.outlook.com>

On Mon, Jul 13, 2020 at 11:58:18PM +0000, Chaitanya Kulkarni wrote:
> On 7/12/20 23:31, Baolin Wang wrote:
> > We've already validated the 'kato' in nvme_start_keep_alive(), thus no
> > need to validate it again in nvme_start_ctrl(). Remove it.
> > 
> > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> > ---
> >   drivers/nvme/host/core.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> > index 3d00ea4..a95e26e 100644
> > --- a/drivers/nvme/host/core.c
> > +++ b/drivers/nvme/host/core.c
> > @@ -4313,8 +4313,7 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
> >   
> >   void nvme_start_ctrl(struct nvme_ctrl *ctrl)
> >   {
> > -	if (ctrl->kato)
> > -		nvme_start_keep_alive(ctrl);
> > +	nvme_start_keep_alive(ctrl);
> >   
> >   	nvme_enable_aen(ctrl);
> >   
> > 
> 
> Since start keep alive is so small to make a function call how about we 
> in-line the call ? untested patch :-

I am Okay about your suggestion. Will send v2 with your suggested-by tag
if no other objection. Thanks.

> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 09abf2ca33f5..c7289c23658a 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4311,8 +4311,9 @@ EXPORT_SYMBOL_GPL(nvme_stop_ctrl);
> 
>   void nvme_start_ctrl(struct nvme_ctrl *ctrl)
>   {
> +       /* if ctrl keep alive time out is set start keep alive */
>          if (ctrl->kato)
> -               nvme_start_keep_alive(ctrl);
> +               queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * 
> HZ);
> 
>          nvme_enable_aen(ctrl);
> 
> root@iouring nvme (xarray) # git diff
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 09abf2ca33f5..08e1a6826b08 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1031,14 +1031,6 @@ static void nvme_keep_alive_work(struct 
> work_struct *work)
>          }
>   }
> 
> -static void nvme_start_keep_alive(struct nvme_ctrl *ctrl)
> -{
> -       if (unlikely(ctrl->kato == 0))
> -               return;
> -
> -       queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * HZ);
> -}
> -
>   void nvme_stop_keep_alive(struct nvme_ctrl *ctrl)
>   {
>          if (unlikely(ctrl->kato == 0))
> @@ -4311,8 +4303,9 @@ EXPORT_SYMBOL_GPL(nvme_stop_ctrl);
> 
>   void nvme_start_ctrl(struct nvme_ctrl *ctrl)
>   {
> +       /* if ctrl keep alive time out is set start keep alive */
>          if (ctrl->kato)
> -               nvme_start_keep_alive(ctrl);
> +               queue_delayed_work(nvme_wq, &ctrl->ka_work, ctrl->kato * 
> HZ);
> 
>          nvme_enable_aen(ctrl);
> 
> 

  reply	other threads:[~2020-07-14  3:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13  6:25 Baolin Wang
2020-07-13 23:58 ` Chaitanya Kulkarni
2020-07-14  3:23   ` Baolin Wang [this message]
2020-07-14  4:08     ` Chaitanya Kulkarni
2020-07-14 11:17 ` 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=20200714032352.GA111285@VM20190228-100.tbsite.net \
    --to=baolin.wang@linux.alibaba.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@fb.com \
    --cc=baolin.wang7@gmail.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®