Skip to content

Commit 9785400

Browse files
qasim-ijazkeithbusch
authored andcommitted
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 <[email protected]> Reviewed-by: James Smart <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 7cbafa3 commit 9785400

File tree

1 file changed

+2
-2
lines changed
  • drivers/nvme/host

1 file changed

+2
-2
lines changed

drivers/nvme/host/fc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,7 +2907,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
29072907
unsigned int nr_io_queues;
29082908
int ret;
29092909

2910-
nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()),
2910+
nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(),
29112911
ctrl->lport->ops->max_hw_queues);
29122912
ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
29132913
if (ret) {
@@ -2961,7 +2961,7 @@ nvme_fc_recreate_io_queues(struct nvme_fc_ctrl *ctrl)
29612961
unsigned int nr_io_queues;
29622962
int ret;
29632963

2964-
nr_io_queues = min(min(opts->nr_io_queues, num_online_cpus()),
2964+
nr_io_queues = min3(opts->nr_io_queues, num_online_cpus(),
29652965
ctrl->lport->ops->max_hw_queues);
29662966
ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues);
29672967
if (ret) {

0 commit comments

Comments
 (0)