Skip to content

Commit 5e6a976

Browse files
Gilbert Wumartinkpetersen
authored andcommitted
scsi: smartpqi: add module param for exposure order
Expose physical devices before logical devices. Reviewed-by: Scott Benesh <[email protected]> Reviewed-by: Kevin Barnett <[email protected]> Signed-off-by: Gilbert Wu <[email protected]> Signed-off-by: Don Brace <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 01f2ef6 commit 5e6a976

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/scsi/smartpqi/smartpqi_init.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ MODULE_PARM_DESC(lockup_action, "Action to take when controller locked up.\n"
145145
"\t\tSupported: none, reboot, panic\n"
146146
"\t\tDefault: none");
147147

148+
static int pqi_expose_ld_first;
149+
module_param_named(expose_ld_first,
150+
pqi_expose_ld_first, int, 0644);
151+
MODULE_PARM_DESC(expose_ld_first,
152+
"Expose logical drives before physical drives.");
153+
148154
static char *raid_levels[] = {
149155
"RAID-0",
150156
"RAID-4",
@@ -1988,6 +1994,8 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info)
19881994
unsigned int num_valid_devices;
19891995
bool is_physical_device;
19901996
u8 *scsi3addr;
1997+
unsigned int physical_index;
1998+
unsigned int logical_index;
19911999
static char *out_of_memory_msg =
19922000
"failed to allocate memory, device discovery stopped";
19932001

@@ -2050,19 +2058,23 @@ static int pqi_update_scsi_devices(struct pqi_ctrl_info *ctrl_info)
20502058

20512059
device = NULL;
20522060
num_valid_devices = 0;
2061+
physical_index = 0;
2062+
logical_index = 0;
20532063

20542064
for (i = 0; i < num_new_devices; i++) {
20552065

2056-
if (i < num_physicals) {
2066+
if ((!pqi_expose_ld_first && i < num_physicals) ||
2067+
(pqi_expose_ld_first && i >= num_logicals)) {
20572068
is_physical_device = true;
2058-
phys_lun_ext_entry = &physdev_list->lun_entries[i];
2069+
phys_lun_ext_entry =
2070+
&physdev_list->lun_entries[physical_index++];
20592071
log_lun_ext_entry = NULL;
20602072
scsi3addr = phys_lun_ext_entry->lunid;
20612073
} else {
20622074
is_physical_device = false;
20632075
phys_lun_ext_entry = NULL;
20642076
log_lun_ext_entry =
2065-
&logdev_list->lun_entries[i - num_physicals];
2077+
&logdev_list->lun_entries[logical_index++];
20662078
scsi3addr = log_lun_ext_entry->lunid;
20672079
}
20682080

0 commit comments

Comments
 (0)