linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: move ka_work initialization to nvmet_alloc_ctrl
@ 2021-04-22 12:33 amit.engel
  2021-04-22 12:55 ` Hou Pu
  2021-05-19  6:59 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: amit.engel @ 2021-04-22 12:33 UTC (permalink / raw)
  To: linux-nvme, houpu.main; +Cc: amit.engel

From: Amit Engel <amit.engel@dell.com>

Initialize keep-alive work only once, as part of alloc_ctrl
and not each time that nvmet_start_keep_alive_timer is being called

Signed-off-by: Amit Engel <amit.engel@dell.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index adbede9ab7f3..36f9c1caa3f8 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -412,7 +412,6 @@ void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
 	pr_debug("ctrl %d start keep-alive timer for %d secs\n",
 		ctrl->cntlid, ctrl->kato);
 
-	INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer);
 	schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
 }
 
@@ -1341,6 +1340,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
 	INIT_LIST_HEAD(&ctrl->async_events);
 	INIT_RADIX_TREE(&ctrl->p2p_ns_map, GFP_KERNEL);
 	INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler);
+	INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer);
 
 	memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE);
 	memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE);
-- 
2.18.2


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

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

* Re: [PATCH] nvmet: move ka_work initialization to nvmet_alloc_ctrl
  2021-04-22 12:33 [PATCH] nvmet: move ka_work initialization to nvmet_alloc_ctrl amit.engel
@ 2021-04-22 12:55 ` Hou Pu
  2021-05-19  6:59 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Hou Pu @ 2021-04-22 12:55 UTC (permalink / raw)
  To: Engel, Amit; +Cc: linux-nvme

On Thu, Apr 22, 2021 at 8:33 PM <amit.engel@dell.com> wrote:
>
> From: Amit Engel <amit.engel@dell.com>
>
> Initialize keep-alive work only once, as part of alloc_ctrl
> and not each time that nvmet_start_keep_alive_timer is being called
>
> Signed-off-by: Amit Engel <amit.engel@dell.com>

Looks good to me.
Reviewed-by: Hou Pu <houpu.main@gmail.com>

Thanks,
Hou

> ---
>  drivers/nvme/target/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index adbede9ab7f3..36f9c1caa3f8 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -412,7 +412,6 @@ void nvmet_start_keep_alive_timer(struct nvmet_ctrl *ctrl)
>         pr_debug("ctrl %d start keep-alive timer for %d secs\n",
>                 ctrl->cntlid, ctrl->kato);
>
> -       INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer);
>         schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
>  }
>
> @@ -1341,6 +1340,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
>         INIT_LIST_HEAD(&ctrl->async_events);
>         INIT_RADIX_TREE(&ctrl->p2p_ns_map, GFP_KERNEL);
>         INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler);
> +       INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer);
>
>         memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE);
>         memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE);
> --
> 2.18.2
>

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

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

* Re: [PATCH] nvmet: move ka_work initialization to nvmet_alloc_ctrl
  2021-04-22 12:33 [PATCH] nvmet: move ka_work initialization to nvmet_alloc_ctrl amit.engel
  2021-04-22 12:55 ` Hou Pu
@ 2021-05-19  6:59 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-05-19  6:59 UTC (permalink / raw)
  To: amit.engel; +Cc: linux-nvme, houpu.main

Thanks,

applied to nvme-5.14.

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

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

end of thread, other threads:[~2021-05-19  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 12:33 [PATCH] nvmet: move ka_work initialization to nvmet_alloc_ctrl amit.engel
2021-04-22 12:55 ` Hou Pu
2021-05-19  6:59 ` 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).