dect
/
linux-2.6
Archived
13
0
Fork 0

[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: Scott Teel <scott.teel@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
Scott Teel 2012-01-19 14:01:25 -06:00 committed by James Bottomley
parent aca4a5200d
commit 4f4eb9f1d8
1 changed files with 22 additions and 21 deletions

View File

@ -214,7 +214,8 @@ static int check_for_unit_attention(struct ctlr_info *h,
dev_warn(&h->pdev->dev, HPSA "%d: report LUN data "
"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;
case POWER_OR_RESET:
@ -1602,7 +1603,7 @@ bail_out:
return 1;
}
static unsigned char *msa2xxx_model[] = {
static unsigned char *ext_target_model[] = {
"MSA2012",
"MSA2024",
"MSA2312",
@ -1611,19 +1612,19 @@ static unsigned char *msa2xxx_model[] = {
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;
for (i = 0; msa2xxx_model[i]; i++)
if (strncmp(device->model, msa2xxx_model[i],
strlen(msa2xxx_model[i])) == 0)
for (i = 0; ext_target_model[i]; i++)
if (strncmp(device->model, ext_target_model[i],
strlen(ext_target_model[i])) == 0)
return 1;
return 0;
}
/* 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.
* Logical drive target and lun are assigned at this time, but
* physical device lun and target assignment are deferred (assigned
@ -1644,8 +1645,8 @@ static void figure_bus_target_lun(struct ctlr_info *h,
return;
}
/* It's a logical device */
if (is_msa2xxx(h, device)) {
/* msa2xxx way, put logicals on bus 1
if (is_ext_target(h, device)) {
/* external target way, put logicals on bus 1
* and match target/lun numbers box
* reports, other smart array, bus 0, target 0, match lunid
*/
@ -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.
* 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
* it for some reason. *tmpdevice is the target we're adding,
* 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,
* lun 0 assigned.
* 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 *this_device, u8 *lunaddrbytes,
unsigned long lunzerobits[], int *nmsa2xxx_enclosures)
unsigned long lunzerobits[], int *n_ext_target_devs)
{
unsigned char scsi3addr[8];
@ -1680,8 +1681,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (!is_logical_dev_addr_mode(lunaddrbytes))
return 0; /* It's the logical targets that may lack lun 0. */
if (!is_msa2xxx(h, tmpdevice))
return 0; /* It's only the MSA2xxx that have this problem. */
if (!is_ext_target(h, tmpdevice))
return 0; /* Only external target devices have this problem. */
if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */
return 0;
@ -1694,7 +1695,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (is_scsi_rev_5(h))
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 "
"target devices exceeded. Check your hardware "
"configuration.");
@ -1703,7 +1704,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h,
if (hpsa_update_device_info(h, scsi3addr, this_device, NULL))
return 0;
(*nmsa2xxx_enclosures)++;
(*n_ext_target_devs)++;
hpsa_set_bus_target_lun(this_device,
tmpdevice->bus, tmpdevice->target, 0);
set_bit(tmpdevice->target, lunzerobits);
@ -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;
int ncurrent = 0;
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;
DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);
@ -1849,7 +1850,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
raid_ctlr_position = nphysicals + nlogicals;
/* adjust our table of devices */
nmsa2xxx_enclosures = 0;
n_ext_target_devs = 0;
for (i = 0; i < nphysicals + nlogicals + 1; i++) {
u8 *lunaddrbytes, is_OBDR = 0;
@ -1869,15 +1870,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
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
* is nonetheless an enclosure device there. We have to
* present that otherwise linux won't find anything if
* 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,
&nmsa2xxx_enclosures)) {
&n_ext_target_devs)) {
ncurrent++;
this_device = currentsd[ncurrent];
}