You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
4.2 KiB
138 lines
4.2 KiB
6 years ago
|
From 71fac05d32d8665b19fad2041ab81056d7a96325 Mon Sep 17 00:00:00 2001
|
||
|
From: Brian King <brking@linux.vnet.ibm.com>
|
||
|
Date: Tue, 8 May 2018 15:04:33 -0500
|
||
|
Subject: [PATCH] iprutils: Further show-details speedup
|
||
|
|
||
|
While attempting to further optimize show-details performance,
|
||
|
it was observed that get_drive_phy_loc was iterating over all
|
||
|
ioa's, even though a specific ioa is passed into the function.
|
||
|
On large configurations, this resulted in show-details taking
|
||
|
longer than 5 seconds. If we remove this redundant code, show-details
|
||
|
will now complete in less than 1 second in a similar configuration.
|
||
|
|
||
|
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
|
||
|
---
|
||
|
iprconfig.c | 94 ++++++++++++++++++++++++++++++-------------------------------
|
||
|
1 file changed, 46 insertions(+), 48 deletions(-)
|
||
|
|
||
|
diff --git a/iprconfig.c b/iprconfig.c
|
||
|
index 9f4f61f..6a5fd21 100644
|
||
|
--- a/iprconfig.c
|
||
|
+++ b/iprconfig.c
|
||
|
@@ -17780,66 +17780,64 @@ static int get_drive_phy_loc(struct ipr_ioa *ioa)
|
||
|
char phy_loc[PHYSICAL_LOCATION_LENGTH + 1];
|
||
|
int times, index;
|
||
|
|
||
|
- for_each_ioa(ioa) {
|
||
|
- is_spi = ioa_is_spi(ioa);
|
||
|
+ is_spi = ioa_is_spi(ioa);
|
||
|
|
||
|
- for_each_hotplug_dev(ioa, dev) {
|
||
|
- if (ioa->sis64)
|
||
|
- get_res_path(dev);
|
||
|
- else
|
||
|
- get_res_addrs(dev);
|
||
|
- }
|
||
|
+ for_each_hotplug_dev(ioa, dev) {
|
||
|
+ if (ioa->sis64)
|
||
|
+ get_res_path(dev);
|
||
|
+ else
|
||
|
+ get_res_addrs(dev);
|
||
|
+ }
|
||
|
|
||
|
- for_each_ses(ioa, ses) {
|
||
|
- times = 5;
|
||
|
- if (strlen(ses->physical_location) == 0)
|
||
|
- get_ses_phy_loc(ses);
|
||
|
- while (times--) {
|
||
|
- if (!ipr_receive_diagnostics(ses, 2, &ses_data, sizeof(ses_data)))
|
||
|
- break;
|
||
|
- }
|
||
|
- if (times < 0 ) continue;
|
||
|
+ for_each_ses(ioa, ses) {
|
||
|
+ times = 5;
|
||
|
+ if (strlen(ses->physical_location) == 0)
|
||
|
+ get_ses_phy_loc(ses);
|
||
|
+ while (times--) {
|
||
|
+ if (!ipr_receive_diagnostics(ses, 2, &ses_data, sizeof(ses_data)))
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ if (times < 0 ) continue;
|
||
|
|
||
|
- if (ipr_receive_diagnostics(ses, 1, &ses_cfg, sizeof(ses_cfg)))
|
||
|
- continue;
|
||
|
+ if (ipr_receive_diagnostics(ses, 1, &ses_cfg, sizeof(ses_cfg)))
|
||
|
+ continue;
|
||
|
|
||
|
- if (ipr_receive_diagnostics(ses, 7, &drive_data, sizeof(drive_data)))
|
||
|
- continue;
|
||
|
+ if (ipr_receive_diagnostics(ses, 7, &drive_data, sizeof(drive_data)))
|
||
|
+ continue;
|
||
|
|
||
|
- overall = ipr_get_overall_elem(&ses_data, &ses_cfg);
|
||
|
- ses_bus = ses->scsi_dev_data->channel;
|
||
|
- scsi_id_found = 0;
|
||
|
+ overall = ipr_get_overall_elem(&ses_data, &ses_cfg);
|
||
|
+ ses_bus = ses->scsi_dev_data->channel;
|
||
|
+ scsi_id_found = 0;
|
||
|
|
||
|
- if (!is_spi && (overall->device_environment == 0))
|
||
|
- is_vses = 1;
|
||
|
- else
|
||
|
- is_vses = 0;
|
||
|
+ if (!is_spi && (overall->device_environment == 0))
|
||
|
+ is_vses = 1;
|
||
|
+ else
|
||
|
+ is_vses = 0;
|
||
|
|
||
|
- scsi_dbg(ses, "%s\n", is_vses ? "Found VSES" : "Found real SES");
|
||
|
+ scsi_dbg(ses, "%s\n", is_vses ? "Found VSES" : "Found real SES");
|
||
|
|
||
|
- for_each_elem_status(elem_status, &ses_data, &ses_cfg) {
|
||
|
- index = index_in_page2(&ses_data, elem_status->slot_id);
|
||
|
- if (index != -1)
|
||
|
- get_drive_phy_loc_with_ses_phy_loc(ses, &drive_data, index, phy_loc, 0);
|
||
|
-
|
||
|
- if (elem_status->status == IPR_DRIVE_ELEM_STATUS_UNSUPP)
|
||
|
- continue;
|
||
|
- if (elem_status->status == IPR_DRIVE_ELEM_STATUS_NO_ACCESS)
|
||
|
- continue;
|
||
|
- if (is_spi && (scsi_id_found & (1 << elem_status->slot_id)))
|
||
|
- continue;
|
||
|
- scsi_id_found |= (1 << elem_status->slot_id);
|
||
|
+ for_each_elem_status(elem_status, &ses_data, &ses_cfg) {
|
||
|
+ index = index_in_page2(&ses_data, elem_status->slot_id);
|
||
|
+ if (index != -1)
|
||
|
+ get_drive_phy_loc_with_ses_phy_loc(ses, &drive_data, index, phy_loc, 0);
|
||
|
|
||
|
- if (ioa->sis64)
|
||
|
- dev = get_dev_for_slot_64bit(ses, elem_status->slot_id, phy_loc);
|
||
|
- else
|
||
|
- dev = get_dev_for_slot(ses, elem_status->slot_id, is_vses, phy_loc);
|
||
|
- if (!dev)
|
||
|
- continue;
|
||
|
+ if (elem_status->status == IPR_DRIVE_ELEM_STATUS_UNSUPP)
|
||
|
+ continue;
|
||
|
+ if (elem_status->status == IPR_DRIVE_ELEM_STATUS_NO_ACCESS)
|
||
|
+ continue;
|
||
|
+ if (is_spi && (scsi_id_found & (1 << elem_status->slot_id)))
|
||
|
+ continue;
|
||
|
+ scsi_id_found |= (1 << elem_status->slot_id);
|
||
|
|
||
|
- }
|
||
|
+ if (ioa->sis64)
|
||
|
+ dev = get_dev_for_slot_64bit(ses, elem_status->slot_id, phy_loc);
|
||
|
+ else
|
||
|
+ dev = get_dev_for_slot(ses, elem_status->slot_id, is_vses, phy_loc);
|
||
|
+ if (!dev)
|
||
|
+ continue;
|
||
|
|
||
|
}
|
||
|
+
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
--
|
||
|
2.14.4
|
||
|
|