* [PATCH] nvme-fc: Simplify minimum determination in two functions
@ 2025-02-28 12:45 Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-02-28 12:45 UTC (permalink / raw)
To: linux-nvme, Christoph Hellwig, James Smart, Jens Axboe,
Keith Busch, Sagi Grimberg
Cc: LKML, kernel-janitors, Qasim Ijaz
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 28 Feb 2025 13:38:38 +0100
Replace nested min() calls by single min3() call in two
function implementations.
This issue was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/nvme/host/fc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index b9929a5a7f4e..6eed3ecdbaf6 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2858,8 +2858,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()),
- ctrl->lport->ops->max_hw_queues);
+ 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) {
dev_info(ctrl->ctrl.device,
@@ -2912,8 +2911,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()),
- ctrl->lport->ops->max_hw_queues);
+ 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) {
dev_info(ctrl->ctrl.device,
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-fc: Simplify minimum determination in two functions
@ 2025-02-28 15:40 Qasim Ijaz
2025-02-28 16:00 ` Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Qasim Ijaz @ 2025-02-28 15:40 UTC (permalink / raw)
To: Markus Elfring
Cc: linux-nvme, Christoph Hellwig, James Smart, Jens Axboe,
Keith Busch, Sagi Grimberg, LKML, kernel-janitors
On Fri, Feb 28, 2025 at 01:45:21PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 28 Feb 2025 13:38:38 +0100
>
> Replace nested min() calls by single min3() call in two
> function implementations.
>
> This issue was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/nvme/host/fc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index b9929a5a7f4e..6eed3ecdbaf6 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -2858,8 +2858,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()),
> - ctrl->lport->ops->max_hw_queues);
> + 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) {
> dev_info(ctrl->ctrl.device,
> @@ -2912,8 +2911,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()),
> - ctrl->lport->ops->max_hw_queues);
> + 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) {
> dev_info(ctrl->ctrl.device,
> --
> 2.48.1
>
Hi Markus,
I have already submitted a patch for this twice in the past:
4th Feb: <https://lore.kernel.org/all/20250204201256.117194-1-qasdev00@gmail.com/>
13th Feb: <https://lore.kernel.org/all/20250213221622.81457-1-qasdev00@gmail.com/>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: nvme-fc: Simplify minimum determination in two functions
2025-02-28 15:40 [PATCH] nvme-fc: Simplify minimum determination in two functions Qasim Ijaz
@ 2025-02-28 16:00 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-02-28 16:00 UTC (permalink / raw)
To: Qasim Ijaz, linux-nvme
Cc: Christoph Hellwig, James Smart, Jens Axboe, Keith Busch,
Sagi Grimberg, LKML, kernel-janitors
> I have already submitted a patch for this twice in the past:
Thanks for the reminder.
I am curious then which change variant will be integrated finally.
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-03 17:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 15:40 [PATCH] nvme-fc: Simplify minimum determination in two functions Qasim Ijaz
2025-02-28 16:00 ` Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2025-02-28 12:45 [PATCH] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox