* [PATCH RESEND] nvme-fc: Utilise min3() to simplify queue count calculation
@ 2025-02-13 22:16 Qasim Ijaz
2025-03-03 18:47 ` Keith Busch
0 siblings, 1 reply; 2+ messages in thread
From: Qasim Ijaz @ 2025-02-13 22:16 UTC (permalink / raw)
To: james.smart, kbusch, axboe, hch, sagi; +Cc: linux-nvme, linux-kernel
Refactor nvme_fc_create_io_queues() and nvme_fc_recreate_io_queues() to
use the min3() macro to find the minimum between 3 values instead of
multiple min()'s. This shortens the code and makes it easier to read.
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
drivers/nvme/host/fc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 094be164ffdc..4fd1669231fd 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2897,7 +2897,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
unsigned int nr_io_queues;
int ret;
- nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()),
+ nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(),
ctrl->lport->ops->max_hw_queues);
ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
if (ret) {
@@ -2951,7 +2951,7 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
unsigned int nr_io_queues;
int ret;
- nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()),
+ nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(),
ctrl->lport->ops->max_hw_queues);
ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
if (ret) {
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] nvme-fc: Utilise min3() to simplify queue count calculation
2025-02-13 22:16 [PATCH RESEND] nvme-fc: Utilise min3() to simplify queue count calculation Qasim Ijaz
@ 2025-03-03 18:47 ` Keith Busch
0 siblings, 0 replies; 2+ messages in thread
From: Keith Busch @ 2025-03-03 18:47 UTC (permalink / raw)
To: Qasim Ijaz; +Cc: james.smart, axboe, hch, sagi, linux-nvme, linux-kernel
On Thu, Feb 13, 2025 at 10:16:22PM +0000, Qasim Ijaz wrote:
> Refactor nvme_fc_create_io_queues() and nvme_fc_recreate_io_queues() to
> use the min3() macro to find the minimum between 3 values instead of
> multiple min()'s. This shortens the code and makes it easier to read.
Thanks, applied to nvem-6.15.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-03 18:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 22:16 [PATCH RESEND] nvme-fc: Utilise min3() to simplify queue count calculation Qasim Ijaz
2025-03-03 18:47 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox