aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorQasim Ijaz <qasdev00@gmail.com>2025-02-13 22:16:22 +0000
committerKeith Busch <kbusch@kernel.org>2025-03-20 16:53:55 -0700
commit978540050a85a2b7fc77b60a1cfaec110682e9c3 (patch)
tree7e0e5e865774b16e751edcd306be58cbf03cf8a3
parentnvme-multipath: Add visibility for queue-depth io-policy (diff)
downloadwireguard-linux-978540050a85a2b7fc77b60a1cfaec110682e9c3.tar.xz
wireguard-linux-978540050a85a2b7fc77b60a1cfaec110682e9c3.zip
nvme-fc: Utilise min3() to simplify queue count calculation
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> Reviewed-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/nvme/host/fc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 7de29dae8e74..38fa2d049dcf 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -2907,7 +2907,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) {
@@ -2961,7 +2961,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) {