Commit a5b38d31 authored by John Garry's avatar John Garry Committed by Martin K. Petersen

scsi: libsas: Improve vague log in SAS rediscovery

When an expander PHY which was part of a wideport disconnects, we would see
a log like this from sas_rediscover():

[   39.695554] sas: phy20 part of wide port with phy16

Here, phy20 is the PHY that disconnected, and phy16 is the lowest indexed
member PHY of the wideport.

The log implies the phy20 is still part of the wideport with phy16, so is
misleading or, at least, vague.

Improve the logs in SAS rediscovery by removing this log and adding a log
in sas_rediscover_dev() to tell what's really going on.

While we're at it, also make the logs in sas_find_bcast_dev() more
informative (and more consistent with the reset of the expander logs).
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent f7ddb43e
...@@ -1876,10 +1876,12 @@ static int sas_find_bcast_dev(struct domain_device *dev, ...@@ -1876,10 +1876,12 @@ static int sas_find_bcast_dev(struct domain_device *dev,
if (phy_id != -1) { if (phy_id != -1) {
*src_dev = dev; *src_dev = dev;
ex->ex_change_count = ex_change_count; ex->ex_change_count = ex_change_count;
pr_info("Expander phy change count has changed\n"); pr_info("ex %016llx phy%d change count has changed\n",
SAS_ADDR(dev->sas_addr), phy_id);
return res; return res;
} else } else
pr_info("Expander phys DID NOT change\n"); pr_info("ex %016llx phys DID NOT change\n",
SAS_ADDR(dev->sas_addr));
} }
list_for_each_entry(ch, &ex->children, siblings) { list_for_each_entry(ch, &ex->children, siblings) {
if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) { if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
...@@ -2028,14 +2030,22 @@ static bool dev_type_flutter(enum sas_device_type new, enum sas_device_type old) ...@@ -2028,14 +2030,22 @@ static bool dev_type_flutter(enum sas_device_type new, enum sas_device_type old)
return false; return false;
} }
static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
bool last, int sibling)
{ {
struct expander_device *ex = &dev->ex_dev; struct expander_device *ex = &dev->ex_dev;
struct ex_phy *phy = &ex->ex_phy[phy_id]; struct ex_phy *phy = &ex->ex_phy[phy_id];
enum sas_device_type type = SAS_PHY_UNUSED; enum sas_device_type type = SAS_PHY_UNUSED;
u8 sas_addr[SAS_ADDR_SIZE]; u8 sas_addr[SAS_ADDR_SIZE];
char msg[80] = "";
int res; int res;
if (!last)
sprintf(msg, ", part of a wide port with phy%d", sibling);
pr_debug("ex %016llx rediscovering phy%d%s\n", SAS_ADDR(dev->sas_addr),
phy_id, msg);
memset(sas_addr, 0, SAS_ADDR_SIZE); memset(sas_addr, 0, SAS_ADDR_SIZE);
res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type); res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
switch (res) { switch (res) {
...@@ -2115,13 +2125,11 @@ static int sas_rediscover(struct domain_device *dev, const int phy_id) ...@@ -2115,13 +2125,11 @@ static int sas_rediscover(struct domain_device *dev, const int phy_id)
continue; continue;
if (SAS_ADDR(phy->attached_sas_addr) == if (SAS_ADDR(phy->attached_sas_addr) ==
SAS_ADDR(changed_phy->attached_sas_addr)) { SAS_ADDR(changed_phy->attached_sas_addr)) {
pr_debug("phy%d part of wide port with phy%d\n",
phy_id, i);
last = false; last = false;
break; break;
} }
} }
res = sas_rediscover_dev(dev, phy_id, last); res = sas_rediscover_dev(dev, phy_id, last, i);
} else } else
res = sas_discover_new(dev, phy_id); res = sas_discover_new(dev, phy_id);
return res; return res;
......
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