Skip to contentSkip to conversation

mptsas: eliminate ghost devices

PATCH In review Eric Moore 2 participants 2 messages Jun 30, 2006

Subsystems (2)
lore
Share & tools
lore

Eric Moore

author
#0 lore raw

PATCH 1/1 mptsas: eliminate ghost devices

Quoted 2 lines · James Bottomley

The attached patch eliminates all these ghosts by not allocating any devices for them if the SAS address is the SAS address of the parent.

In older version of sas transport, it wouldn't work unless the ghost remote phys were reported. I'm glad to see this restriction go away.

Quoted 17 lines
(quoted diff) +11 -0
@@ -1647,6 +1649,27 @@ static int mptsas_probe_one_phy(struct d
 				goto out;
 
 		mptsas_parse_device_info(&identify, &phy_info->attached);
+		if (scsi_is_host_device(parent)) {
+			struct mptsas_portinfo *port_info;
+			int i;
+
+			mutex_lock(&ioc->sas_topology_mutex);
+			port_info = mptsas_find_portinfo_by_handle(ioc,
+
 ioc->handle);
+			mutex_unlock(&ioc->sas_topology_mutex);
+
+			for (i = 0; i < port_info->num_phys; i++)
+				if

(port_info->phy_info[i].identify.sas_address ==

Review

Quoted 3 lines
(quoted diff) +3 -0
+				    identify.sas_address)
+					goto out;
+

This is code segment is not required. This can be done much simplier. All hba phys that are connected to an expander will have device type equal to END_DEVICE and the target_port_protocols set to zero. Here is my suggested patch, to apply over previous patch making expander port_ids zero based.

drivers/message/fusion/mptsas.c +13 -0
diff -uarpN b/drivers/message/fusion/mptsas.c a/drivers/message/fusion/mptsas.c
@@ -1635,8 +1635,10 @@ static int mptsas_probe_one_phy(struct d
 	if (!mptsas_get_rphy(phy_info) && port && !port->rphy) {
 
 		struct sas_rphy *rphy;
+		struct device *parent;
 		struct sas_identify identify;
 
+		parent = dev->parent->parent;
 		/*
 		 * Let the hotplug_work thread handle processing
 		 * the adding/removing of devices that occur
@@ -1647,6 +1649,17 @@ static int mptsas_probe_one_phy(struct d
 				goto out;
 
 		mptsas_parse_device_info(&identify, &phy_info->attached);
+		if (scsi_is_host_device(parent)) {
+			if (!identify.target_port_protocols &&
+				(identify.device_type == SAS_END_DEVICE))
+				goto out;
+		} else if (scsi_is_sas_rphy(parent)) {
+			struct sas_rphy *parent_rphy = dev_to_rphy(parent);
+			if (identify.sas_address ==
+			    parent_rphy->identify.sas_address)
+				goto out;
+		}
+
 		switch (identify.device_type) {
 		case SAS_END_DEVICE:
 			rphy = sas_end_device_alloc(port);
#1 lore raw
Quoted 5 lines · Eric Moore
drivers/message/fusion/mptsas.c +3 -0
+               if (scsi_is_host_device(parent)) {
+                       if (!identify.target_port_protocols &&
+                               (identify.device_type ==

SAS_END_DEVICE))
+ goto out;

Won't this happen for any initiator, rather than just the parent (i.e. in a multi-initiator environment we won't see anything even for remote initiators)?

James