linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: Remove redundant validation in nvme_start_ctrl()
@ 2020-07-13  6:25 Baolin Wang
  2020-07-13 23:58 ` Chaitanya Kulkarni
  2020-07-14 11:17 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Baolin Wang @ 2020-07-13  6:25 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: baolin.wang7, linux-nvme, baolin.wang, linux-kernel

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);
 
-- 
1.8.3.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Remove redundant validation in nvme_start_ctrl()
  2020-07-13  6:25 [PATCH] nvme: Remove redundant validation in nvme_start_ctrl() Baolin Wang
@ 2020-07-13 23:58 ` Chaitanya Kulkarni
  2020-07-14  3:23   ` Baolin Wang
  2020-07-14 11:17 ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2020-07-13 23:58 UTC (permalink / raw)
  To: Baolin Wang, kbusch, axboe, hch, sagi
  Cc: baolin.wang7, linux-kernel, linux-nvme

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 :-

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);



_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Remove redundant validation in nvme_start_ctrl()
  2020-07-13 23:58 ` Chaitanya Kulkarni
@ 2020-07-14  3:23   ` Baolin Wang
  2020-07-14  4:08     ` Chaitanya Kulkarni
  0 siblings, 1 reply; 5+ messages in thread
From: Baolin Wang @ 2020-07-14  3:23 UTC (permalink / raw)
  To: Chaitanya Kulkarni
  Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, kbusch, hch

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);
> 
> 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Remove redundant validation in nvme_start_ctrl()
  2020-07-14  3:23   ` Baolin Wang
@ 2020-07-14  4:08     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 5+ messages in thread
From: Chaitanya Kulkarni @ 2020-07-14  4:08 UTC (permalink / raw)
  To: kbusch, hch
  Cc: sagi, linux-kernel, linux-nvme, axboe, Baolin Wang, baolin.wang7

On 7/13/20 20:24, Baolin Wang wrote:
>> 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.
> 

Keith, Christoph are you guys okay with this ? OR we want to keep the 
small helpers ?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme: Remove redundant validation in nvme_start_ctrl()
  2020-07-13  6:25 [PATCH] nvme: Remove redundant validation in nvme_start_ctrl() Baolin Wang
  2020-07-13 23:58 ` Chaitanya Kulkarni
@ 2020-07-14 11:17 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-07-14 11:17 UTC (permalink / raw)
  To: Baolin Wang
  Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, kbusch, hch

On Mon, Jul 13, 2020 at 02:25:21PM +0800, 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.

Thanks,

applied to nvme-5.9.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-14 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13  6:25 [PATCH] nvme: Remove redundant validation in nvme_start_ctrl() Baolin Wang
2020-07-13 23:58 ` Chaitanya Kulkarni
2020-07-14  3:23   ` Baolin Wang
2020-07-14  4:08     ` Chaitanya Kulkarni
2020-07-14 11:17 ` Christoph Hellwig

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).