diff options
author | Bart Van Assche <bvanassche@acm.org> | 2013-08-14 11:33:35 -0400 |
---|---|---|
committer | Robert Love <robert.w.love@intel.com> | 2013-09-04 16:02:09 -0400 |
commit | a84ea8c7e839a73dab4bfc755f7f52e947690dab (patch) | |
tree | de837cc86761c23c6f21dd42a8164c8503040741 /drivers/scsi/libfc/fc_exch.c | |
parent | b20d9bfda77306c2f66a90eb94ef9db58fb1e682 (diff) |
libfc: Micro-optimize fc_setup_exch_mgr()
Convert a loop into an ilog2() call. Although this code is not performance
sensitive this conversion makes this code easier to read.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Diffstat (limited to 'drivers/scsi/libfc/fc_exch.c')
-rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index cb2b900c011d..d0be52ab62c8 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/export.h> | 29 | #include <linux/export.h> |
30 | #include <linux/log2.h> | ||
30 | 31 | ||
31 | #include <scsi/fc/fc_fc2.h> | 32 | #include <scsi/fc/fc_fc2.h> |
32 | 33 | ||
@@ -2530,13 +2531,8 @@ int fc_setup_exch_mgr(void) | |||
2530 | * cpu on which exchange originated by simple bitwise | 2531 | * cpu on which exchange originated by simple bitwise |
2531 | * AND operation between fc_cpu_mask and exchange id. | 2532 | * AND operation between fc_cpu_mask and exchange id. |
2532 | */ | 2533 | */ |
2533 | fc_cpu_mask = 1; | 2534 | fc_cpu_order = ilog2(roundup_pow_of_two(nr_cpu_ids)); |
2534 | fc_cpu_order = 0; | 2535 | fc_cpu_mask = (1 << fc_cpu_order) - 1; |
2535 | while (fc_cpu_mask < nr_cpu_ids) { | ||
2536 | fc_cpu_mask <<= 1; | ||
2537 | fc_cpu_order++; | ||
2538 | } | ||
2539 | fc_cpu_mask--; | ||
2540 | 2536 | ||
2541 | fc_exch_workqueue = create_singlethread_workqueue("fc_exch_workqueue"); | 2537 | fc_exch_workqueue = create_singlethread_workqueue("fc_exch_workqueue"); |
2542 | if (!fc_exch_workqueue) | 2538 | if (!fc_exch_workqueue) |