public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues()
@ 2024-12-03  3:39 brookxu.cn
  2024-12-09  8:02 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: brookxu.cn @ 2024-12-03  3:39 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel; +Cc: hare

From: "Chunguang.xu" <chunguang.xu@shopee.com>

Now when destroying the IO queue we call nvme_tcp_stop_io_queues()
twice, nvme_tcp_destroy_io_queues() has an unnecessary call. Here we
try to remove nvme_tcp_destroy_io_queues() and merge it into
nvme_tcp_teardown_io_queues(), simplify the code and align with
nvme-rdma, make it easy to maintaince.

Signed-off-by: Chunguang.xu <chunguang.xu@shopee.com>
---
 drivers/nvme/host/tcp.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 28c76a3e1bd2..b127d41dbbfe 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -2024,14 +2024,6 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl)
 	return __nvme_tcp_alloc_io_queues(ctrl);
 }
 
-static void nvme_tcp_destroy_io_queues(struct nvme_ctrl *ctrl, bool remove)
-{
-	nvme_tcp_stop_io_queues(ctrl);
-	if (remove)
-		nvme_remove_io_tag_set(ctrl);
-	nvme_tcp_free_io_queues(ctrl);
-}
-
 static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
 {
 	int ret, nr_queues;
@@ -2176,9 +2168,11 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
 	nvme_sync_io_queues(ctrl);
 	nvme_tcp_stop_io_queues(ctrl);
 	nvme_cancel_tagset(ctrl);
-	if (remove)
+	if (remove) {
 		nvme_unquiesce_io_queues(ctrl);
-	nvme_tcp_destroy_io_queues(ctrl, remove);
+		nvme_remove_io_tag_set(ctrl);
+	}
+	nvme_tcp_free_io_queues(ctrl);
 }
 
 static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl,
@@ -2267,7 +2261,9 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
 		nvme_sync_io_queues(ctrl);
 		nvme_tcp_stop_io_queues(ctrl);
 		nvme_cancel_tagset(ctrl);
-		nvme_tcp_destroy_io_queues(ctrl, new);
+		if (new)
+			nvme_remove_io_tag_set(ctrl);
+		nvme_tcp_free_io_queues(ctrl);
 	}
 destroy_admin:
 	nvme_stop_keep_alive(ctrl);
-- 
2.25.1


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

* Re: [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues()
  2024-12-03  3:39 [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues() brookxu.cn
@ 2024-12-09  8:02 ` Christoph Hellwig
  2024-12-24 11:28 ` Sagi Grimberg
  2024-12-27 21:36 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-12-09  8:02 UTC (permalink / raw)
  To: brookxu.cn; +Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel, hare

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues()
  2024-12-03  3:39 [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues() brookxu.cn
  2024-12-09  8:02 ` Christoph Hellwig
@ 2024-12-24 11:28 ` Sagi Grimberg
  2024-12-27 21:36 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2024-12-24 11:28 UTC (permalink / raw)
  To: brookxu.cn, kbusch, axboe, hch, linux-nvme, linux-kernel; +Cc: hare

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues()
  2024-12-03  3:39 [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues() brookxu.cn
  2024-12-09  8:02 ` Christoph Hellwig
  2024-12-24 11:28 ` Sagi Grimberg
@ 2024-12-27 21:36 ` Keith Busch
  2 siblings, 0 replies; 4+ messages in thread
From: Keith Busch @ 2024-12-27 21:36 UTC (permalink / raw)
  To: brookxu.cn; +Cc: axboe, hch, sagi, linux-nvme, linux-kernel, hare

On Tue, Dec 03, 2024 at 11:39:55AM +0800, brookxu.cn wrote:
> From: "Chunguang.xu" <chunguang.xu@shopee.com>
> 
> Now when destroying the IO queue we call nvme_tcp_stop_io_queues()
> twice, nvme_tcp_destroy_io_queues() has an unnecessary call. Here we
> try to remove nvme_tcp_destroy_io_queues() and merge it into
> nvme_tcp_teardown_io_queues(), simplify the code and align with
> nvme-rdma, make it easy to maintaince.

Thanks, applied to nvme-6.13.

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

end of thread, other threads:[~2024-12-27 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-03  3:39 [PATCH] nvme-tcp: remove nvme_tcp_destroy_io_queues() brookxu.cn
2024-12-09  8:02 ` Christoph Hellwig
2024-12-24 11:28 ` Sagi Grimberg
2024-12-27 21:36 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox