Commit 4f4eb9f1 authored by Scott Teel's avatar Scott Teel Committed by James Bottomley

[SCSI] hpsa: improve naming on external target device functions

Reduce confusion and inaccuracy caused by dated naming of vars and functions
referring to external target devices.

CURRENT NAMING:                PROPOSED NAMING:

"MSA2xxx devices"              "external target devices"
msa2xxx_model                  ext_target_model
is_msa2xxx                     is_ext_target
add_msa2xxx_enclosure          add_ext_target_dev
nmsa2xxx_enclosures            n_ext_target_devs
Signed-off-by: default avatarScott Teel <scott.teel@hp.com>
Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent aca4a520
...@@ -214,7 +214,8 @@ static int check_for_unit_attention(struct ctlr_info *h, ...@@ -214,7 +214,8 @@ static int check_for_unit_attention(struct ctlr_info *h,
dev_warn(&h->pdev->dev, HPSA "%d: report LUN data " dev_warn(&h->pdev->dev, HPSA "%d: report LUN data "
"changed, action required\n", h->ctlr); "changed, action required\n", h->ctlr);
/* /*
* Note: this REPORT_LUNS_CHANGED condition only occurs on the MSA2012. * Note: this REPORT_LUNS_CHANGED condition only occurs on the external
* target (array) devices.
*/ */
break; break;
case POWER_OR_RESET: case POWER_OR_RESET:
...@@ -1602,7 +1603,7 @@ static int hpsa_update_device_info(struct ctlr_info *h, ...@@ -1602,7 +1603,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,
return 1; return 1;
} }
static unsigned char *msa2xxx_model[] = { static unsigned char *ext_target_model[] = {
"MSA2012", "MSA2012",
"MSA2024", "MSA2024",
"MSA2312", "MSA2312",
...@@ -1611,19 +1612,19 @@ static unsigned char *msa2xxx_model[] = { ...@@ -1611,19 +1612,19 @@ static unsigned char *msa2xxx_model[] = {
NULL, NULL,
}; };
static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device) static int is_ext_target(struct ctlr_info *h, struct hpsa_scsi_dev_t *device)
{ {
int i; int i;
for (i = 0; msa2xxx_model[i]; i++) for (i = 0; ext_target_model[i]; i++)
if (strncmp(device->model, msa2xxx_model[i], if (strncmp(device->model, ext_target_model[i],
strlen(msa2xxx_model[i])) == 0) strlen(ext_target_model[i])) == 0)
return 1; return 1;
return 0; return 0;
} }
/* Helper function to assign bus, target, lun mapping of devices. /* Helper function to assign bus, target, lun mapping of devices.
* Puts non-msa2xxx logical volumes on bus 0, msa2xxx logical * Puts non-external target logical volumes on bus 0, external target logical
* volumes on bus 1, physical devices on bus 2. and the hba on bus 3. * volumes on bus 1, physical devices on bus 2. and the hba on bus 3.
* Logical drive target and lun are assigned at this time, but * Logical drive target and lun are assigned at this time, but
* physical device lun and target assignment are deferred (assigned * physical device lun and target assignment are deferred (assigned
...@@ -1644,8 +1645,8 @@ static void figure_bus_target_lun(struct ctlr_info *h, ...@@ -1644,8 +1645,8 @@ static void figure_bus_target_lun(struct ctlr_info *h,
return; return;
} }
/* It's a logical device */ /* It's a logical device */
if (is_msa2xxx(h, device)) { if (is_ext_target(h, device)) {
/* msa2xxx way, put logicals on bus 1 /* external target way, put logicals on bus 1
* and match target/lun numbers box * and match target/lun numbers box
* reports, other smart array, bus 0, target 0, match lunid * reports, other smart array, bus 0, target 0, match lunid
*/ */
...@@ -1658,7 +1659,7 @@ static void figure_bus_target_lun(struct ctlr_info *h, ...@@ -1658,7 +1659,7 @@ static void figure_bus_target_lun(struct ctlr_info *h,
/* /*
* If there is no lun 0 on a target, linux won't find any devices. * If there is no lun 0 on a target, linux won't find any devices.
* For the MSA2xxx boxes, we have to manually detect the enclosure * For the external targets (arrays), we have to manually detect the enclosure
* which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report * which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report
* it for some reason. *tmpdevice is the target we're adding, * it for some reason. *tmpdevice is the target we're adding,
* this_device is a pointer into the current element of currentsd[] * this_device is a pointer into the current element of currentsd[]
...@@ -1667,10 +1668,10 @@ static void figure_bus_target_lun(struct ctlr_info *h, ...@@ -1667,10 +1668,10 @@ static void figure_bus_target_lun(struct ctlr_info *h,
* lun 0 assigned. * lun 0 assigned.
* Returns 1 if an enclosure was added, 0 if not. * Returns 1 if an enclosure was added, 0 if not.
*/ */
static int add_msa2xxx_enclosure_device(struct ctlr_info *h, static int add_ext_target_dev(struct ctlr_info *h,
struct hpsa_scsi_dev_t *tmpdevice, struct hpsa_scsi_dev_t *tmpdevice,
struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes,
unsigned long lunzerobits[], int *nmsa2xxx_enclosures) unsigned long lunzerobits[], int *n_ext_target_devs)
{ {
unsigned char scsi3addr[8]; unsigned char scsi3addr[8];
...@@ -1680,8 +1681,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, ...@@ -1680,8 +1681,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (!is_logical_dev_addr_mode(lunaddrbytes)) if (!is_logical_dev_addr_mode(lunaddrbytes))
return 0; /* It's the logical targets that may lack lun 0. */ return 0; /* It's the logical targets that may lack lun 0. */
if (!is_msa2xxx(h, tmpdevice)) if (!is_ext_target(h, tmpdevice))
return 0; /* It's only the MSA2xxx that have this problem. */ return 0; /* Only external target devices have this problem. */
if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */ if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */
return 0; return 0;
...@@ -1694,7 +1695,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, ...@@ -1694,7 +1695,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (is_scsi_rev_5(h)) if (is_scsi_rev_5(h))
return 0; /* p1210m doesn't need to do this. */ return 0; /* p1210m doesn't need to do this. */
if (*nmsa2xxx_enclosures >= MAX_EXT_TARGETS) { if (*n_ext_target_devs >= MAX_EXT_TARGETS) {
dev_warn(&h->pdev->dev, "Maximum number of external " dev_warn(&h->pdev->dev, "Maximum number of external "
"target devices exceeded. Check your hardware " "target devices exceeded. Check your hardware "
"configuration."); "configuration.");
...@@ -1703,7 +1704,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, ...@@ -1703,7 +1704,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) if (hpsa_update_device_info(h, scsi3addr, this_device, NULL))
return 0; return 0;
(*nmsa2xxx_enclosures)++; (*n_ext_target_devs)++;
hpsa_set_bus_target_lun(this_device, hpsa_set_bus_target_lun(this_device,
tmpdevice->bus, tmpdevice->target, 0); tmpdevice->bus, tmpdevice->target, 0);
set_bit(tmpdevice->target, lunzerobits); set_bit(tmpdevice->target, lunzerobits);
...@@ -1800,7 +1801,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) ...@@ -1800,7 +1801,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice; struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice;
int ncurrent = 0; int ncurrent = 0;
int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8;
int i, nmsa2xxx_enclosures, ndevs_to_allocate; int i, n_ext_target_devs, ndevs_to_allocate;
int raid_ctlr_position; int raid_ctlr_position;
DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS); DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);
...@@ -1849,7 +1850,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) ...@@ -1849,7 +1850,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
raid_ctlr_position = nphysicals + nlogicals; raid_ctlr_position = nphysicals + nlogicals;
/* adjust our table of devices */ /* adjust our table of devices */
nmsa2xxx_enclosures = 0; n_ext_target_devs = 0;
for (i = 0; i < nphysicals + nlogicals + 1; i++) { for (i = 0; i < nphysicals + nlogicals + 1; i++) {
u8 *lunaddrbytes, is_OBDR = 0; u8 *lunaddrbytes, is_OBDR = 0;
...@@ -1869,15 +1870,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) ...@@ -1869,15 +1870,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
this_device = currentsd[ncurrent]; this_device = currentsd[ncurrent];
/* /*
* For the msa2xxx boxes, we have to insert a LUN 0 which * For external target devices, we have to insert a LUN 0 which
* doesn't show up in CCISS_REPORT_PHYSICAL data, but there * doesn't show up in CCISS_REPORT_PHYSICAL data, but there
* is nonetheless an enclosure device there. We have to * is nonetheless an enclosure device there. We have to
* present that otherwise linux won't find anything if * present that otherwise linux won't find anything if
* there is no lun 0. * there is no lun 0.
*/ */
if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device, if (add_ext_target_dev(h, tmpdevice, this_device,
lunaddrbytes, lunzerobits, lunaddrbytes, lunzerobits,
&nmsa2xxx_enclosures)) { &n_ext_target_devs)) {
ncurrent++; ncurrent++;
this_device = currentsd[ncurrent]; this_device = currentsd[ncurrent];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment