diff options
author | Scott Teel <scott.teel@hp.com> | 2012-01-19 15:01:25 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-19 09:08:56 -0500 |
commit | 4f4eb9f1d8f8eb91d0dd486deafd4800b425f289 (patch) | |
tree | c01a768c058e0810f18a63f49ac0a81b77361f19 /drivers/scsi/hpsa.c | |
parent | aca4a5200dc2b0835f5477d6609a05b0401a91f3 (diff) |
[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>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r-- | drivers/scsi/hpsa.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index c8db43e9a38a..74326b3b5341 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -214,7 +214,8 @@ static int check_for_unit_attention(struct ctlr_info *h, | |||
214 | dev_warn(&h->pdev->dev, HPSA "%d: report LUN data " | 214 | dev_warn(&h->pdev->dev, HPSA "%d: report LUN data " |
215 | "changed, action required\n", h->ctlr); | 215 | "changed, action required\n", h->ctlr); |
216 | /* | 216 | /* |
217 | * Note: this REPORT_LUNS_CHANGED condition only occurs on the MSA2012. | 217 | * Note: this REPORT_LUNS_CHANGED condition only occurs on the external |
218 | * target (array) devices. | ||
218 | */ | 219 | */ |
219 | break; | 220 | break; |
220 | case POWER_OR_RESET: | 221 | case POWER_OR_RESET: |
@@ -1602,7 +1603,7 @@ bail_out: | |||
1602 | return 1; | 1603 | return 1; |
1603 | } | 1604 | } |
1604 | 1605 | ||
1605 | static unsigned char *msa2xxx_model[] = { | 1606 | static unsigned char *ext_target_model[] = { |
1606 | "MSA2012", | 1607 | "MSA2012", |
1607 | "MSA2024", | 1608 | "MSA2024", |
1608 | "MSA2312", | 1609 | "MSA2312", |
@@ -1611,19 +1612,19 @@ static unsigned char *msa2xxx_model[] = { | |||
1611 | NULL, | 1612 | NULL, |
1612 | }; | 1613 | }; |
1613 | 1614 | ||
1614 | static int is_msa2xxx(struct ctlr_info *h, struct hpsa_scsi_dev_t *device) | 1615 | static int is_ext_target(struct ctlr_info *h, struct hpsa_scsi_dev_t *device) |
1615 | { | 1616 | { |
1616 | int i; | 1617 | int i; |
1617 | 1618 | ||
1618 | for (i = 0; msa2xxx_model[i]; i++) | 1619 | for (i = 0; ext_target_model[i]; i++) |
1619 | if (strncmp(device->model, msa2xxx_model[i], | 1620 | if (strncmp(device->model, ext_target_model[i], |
1620 | strlen(msa2xxx_model[i])) == 0) | 1621 | strlen(ext_target_model[i])) == 0) |
1621 | return 1; | 1622 | return 1; |
1622 | return 0; | 1623 | return 0; |
1623 | } | 1624 | } |
1624 | 1625 | ||
1625 | /* Helper function to assign bus, target, lun mapping of devices. | 1626 | /* Helper function to assign bus, target, lun mapping of devices. |
1626 | * Puts non-msa2xxx logical volumes on bus 0, msa2xxx logical | 1627 | * Puts non-external target logical volumes on bus 0, external target logical |
1627 | * volumes on bus 1, physical devices on bus 2. and the hba on bus 3. | 1628 | * volumes on bus 1, physical devices on bus 2. and the hba on bus 3. |
1628 | * Logical drive target and lun are assigned at this time, but | 1629 | * Logical drive target and lun are assigned at this time, but |
1629 | * physical device lun and target assignment are deferred (assigned | 1630 | * physical device lun and target assignment are deferred (assigned |
@@ -1644,8 +1645,8 @@ static void figure_bus_target_lun(struct ctlr_info *h, | |||
1644 | return; | 1645 | return; |
1645 | } | 1646 | } |
1646 | /* It's a logical device */ | 1647 | /* It's a logical device */ |
1647 | if (is_msa2xxx(h, device)) { | 1648 | if (is_ext_target(h, device)) { |
1648 | /* msa2xxx way, put logicals on bus 1 | 1649 | /* external target way, put logicals on bus 1 |
1649 | * and match target/lun numbers box | 1650 | * and match target/lun numbers box |
1650 | * reports, other smart array, bus 0, target 0, match lunid | 1651 | * reports, other smart array, bus 0, target 0, match lunid |
1651 | */ | 1652 | */ |
@@ -1658,7 +1659,7 @@ static void figure_bus_target_lun(struct ctlr_info *h, | |||
1658 | 1659 | ||
1659 | /* | 1660 | /* |
1660 | * If there is no lun 0 on a target, linux won't find any devices. | 1661 | * If there is no lun 0 on a target, linux won't find any devices. |
1661 | * For the MSA2xxx boxes, we have to manually detect the enclosure | 1662 | * For the external targets (arrays), we have to manually detect the enclosure |
1662 | * which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report | 1663 | * which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report |
1663 | * it for some reason. *tmpdevice is the target we're adding, | 1664 | * it for some reason. *tmpdevice is the target we're adding, |
1664 | * this_device is a pointer into the current element of currentsd[] | 1665 | * 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 | * lun 0 assigned. | 1668 | * lun 0 assigned. |
1668 | * Returns 1 if an enclosure was added, 0 if not. | 1669 | * Returns 1 if an enclosure was added, 0 if not. |
1669 | */ | 1670 | */ |
1670 | static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | 1671 | static int add_ext_target_dev(struct ctlr_info *h, |
1671 | struct hpsa_scsi_dev_t *tmpdevice, | 1672 | struct hpsa_scsi_dev_t *tmpdevice, |
1672 | struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, | 1673 | struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes, |
1673 | unsigned long lunzerobits[], int *nmsa2xxx_enclosures) | 1674 | unsigned long lunzerobits[], int *n_ext_target_devs) |
1674 | { | 1675 | { |
1675 | unsigned char scsi3addr[8]; | 1676 | unsigned char scsi3addr[8]; |
1676 | 1677 | ||
@@ -1680,8 +1681,8 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | |||
1680 | if (!is_logical_dev_addr_mode(lunaddrbytes)) | 1681 | if (!is_logical_dev_addr_mode(lunaddrbytes)) |
1681 | return 0; /* It's the logical targets that may lack lun 0. */ | 1682 | return 0; /* It's the logical targets that may lack lun 0. */ |
1682 | 1683 | ||
1683 | if (!is_msa2xxx(h, tmpdevice)) | 1684 | if (!is_ext_target(h, tmpdevice)) |
1684 | return 0; /* It's only the MSA2xxx that have this problem. */ | 1685 | return 0; /* Only external target devices have this problem. */ |
1685 | 1686 | ||
1686 | if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */ | 1687 | if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */ |
1687 | return 0; | 1688 | return 0; |
@@ -1694,7 +1695,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | |||
1694 | if (is_scsi_rev_5(h)) | 1695 | if (is_scsi_rev_5(h)) |
1695 | return 0; /* p1210m doesn't need to do this. */ | 1696 | return 0; /* p1210m doesn't need to do this. */ |
1696 | 1697 | ||
1697 | if (*nmsa2xxx_enclosures >= MAX_EXT_TARGETS) { | 1698 | if (*n_ext_target_devs >= MAX_EXT_TARGETS) { |
1698 | dev_warn(&h->pdev->dev, "Maximum number of external " | 1699 | dev_warn(&h->pdev->dev, "Maximum number of external " |
1699 | "target devices exceeded. Check your hardware " | 1700 | "target devices exceeded. Check your hardware " |
1700 | "configuration."); | 1701 | "configuration."); |
@@ -1703,7 +1704,7 @@ static int add_msa2xxx_enclosure_device(struct ctlr_info *h, | |||
1703 | 1704 | ||
1704 | if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) | 1705 | if (hpsa_update_device_info(h, scsi3addr, this_device, NULL)) |
1705 | return 0; | 1706 | return 0; |
1706 | (*nmsa2xxx_enclosures)++; | 1707 | (*n_ext_target_devs)++; |
1707 | hpsa_set_bus_target_lun(this_device, | 1708 | hpsa_set_bus_target_lun(this_device, |
1708 | tmpdevice->bus, tmpdevice->target, 0); | 1709 | tmpdevice->bus, tmpdevice->target, 0); |
1709 | set_bit(tmpdevice->target, lunzerobits); | 1710 | set_bit(tmpdevice->target, lunzerobits); |
@@ -1800,7 +1801,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1800 | struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice; | 1801 | struct hpsa_scsi_dev_t **currentsd, *this_device, *tmpdevice; |
1801 | int ncurrent = 0; | 1802 | int ncurrent = 0; |
1802 | int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; | 1803 | int reportlunsize = sizeof(*physdev_list) + HPSA_MAX_PHYS_LUN * 8; |
1803 | int i, nmsa2xxx_enclosures, ndevs_to_allocate; | 1804 | int i, n_ext_target_devs, ndevs_to_allocate; |
1804 | int raid_ctlr_position; | 1805 | int raid_ctlr_position; |
1805 | DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS); | 1806 | DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS); |
1806 | 1807 | ||
@@ -1849,7 +1850,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1849 | raid_ctlr_position = nphysicals + nlogicals; | 1850 | raid_ctlr_position = nphysicals + nlogicals; |
1850 | 1851 | ||
1851 | /* adjust our table of devices */ | 1852 | /* adjust our table of devices */ |
1852 | nmsa2xxx_enclosures = 0; | 1853 | n_ext_target_devs = 0; |
1853 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { | 1854 | for (i = 0; i < nphysicals + nlogicals + 1; i++) { |
1854 | u8 *lunaddrbytes, is_OBDR = 0; | 1855 | u8 *lunaddrbytes, is_OBDR = 0; |
1855 | 1856 | ||
@@ -1869,15 +1870,15 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno) | |||
1869 | this_device = currentsd[ncurrent]; | 1870 | this_device = currentsd[ncurrent]; |
1870 | 1871 | ||
1871 | /* | 1872 | /* |
1872 | * For the msa2xxx boxes, we have to insert a LUN 0 which | 1873 | * For external target devices, we have to insert a LUN 0 which |
1873 | * doesn't show up in CCISS_REPORT_PHYSICAL data, but there | 1874 | * doesn't show up in CCISS_REPORT_PHYSICAL data, but there |
1874 | * is nonetheless an enclosure device there. We have to | 1875 | * is nonetheless an enclosure device there. We have to |
1875 | * present that otherwise linux won't find anything if | 1876 | * present that otherwise linux won't find anything if |
1876 | * there is no lun 0. | 1877 | * there is no lun 0. |
1877 | */ | 1878 | */ |
1878 | if (add_msa2xxx_enclosure_device(h, tmpdevice, this_device, | 1879 | if (add_ext_target_dev(h, tmpdevice, this_device, |
1879 | lunaddrbytes, lunzerobits, | 1880 | lunaddrbytes, lunzerobits, |
1880 | &nmsa2xxx_enclosures)) { | 1881 | &n_ext_target_devs)) { |
1881 | ncurrent++; | 1882 | ncurrent++; |
1882 | this_device = currentsd[ncurrent]; | 1883 | this_device = currentsd[ncurrent]; |
1883 | } | 1884 | } |