Skip to contentSkip to conversation

Evaluate TGPS setting for device handler detection

PATCH New Hannes Reinecke 1 participant 1 message Mar 18, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Evaluate TGPS setting for device handler detection

For correct ALUA support we should evaluate the TPGS setting of the device and only attach to it if not zero.

---
 drivers/scsi/device_handler/scsi_dh.c       |    9 +++-
 drivers/scsi/device_handler/scsi_dh_alua.c  |   68 ++++-----------------------
 drivers/scsi/device_handler/scsi_dh_emc.c   |    8 ++--
 drivers/scsi/device_handler/scsi_dh_hp_sw.c |   10 ++--
 drivers/scsi/device_handler/scsi_dh_rdac.c  |   38 +++++++-------
 include/scsi/scsi_device.h                  |    1 +
 6 files changed, 45 insertions(+), 89 deletions(-)
drivers/scsi/device_handler/scsi_dh.c +7 -2
index a518f2e..8162fff 100644
@@ -28,6 +28,7 @@ struct scsi_dh_devinfo_list {
 	struct list_head node;
 	char vendor[9];
 	char model[17];
+	char tpgs;
 	struct scsi_device_handler *handler;
 };
 
@@ -60,7 +61,8 @@ scsi_dh_cache_lookup(struct scsi_device *sdev)
 	spin_lock(&list_lock);
 	list_for_each_entry(tmp, &scsi_dh_dev_list, node) {
 		if (!strncmp(sdev->vendor, tmp->vendor, strlen(tmp->vendor)) &&
-		    !strncmp(sdev->model, tmp->model, strlen(tmp->model))) {
+		    !strncmp(sdev->model, tmp->model, strlen(tmp->model)) &&
+		    (!tmp->tpgs || (sdev->tpgs & tmp->tpgs) != 0)) {
 			found_dh = tmp->handler;
 			break;
 		}
@@ -79,7 +81,9 @@ static int scsi_dh_handler_lookup(struct scsi_device_handler *scsi_dh,
 		if (!strncmp(sdev->vendor, scsi_dh->devlist[i].vendor,
 			     strlen(scsi_dh->devlist[i].vendor)) &&
 		    !strncmp(sdev->model, scsi_dh->devlist[i].model,
-			     strlen(scsi_dh->devlist[i].model))) {
+			     strlen(scsi_dh->devlist[i].model)) &&
+		    (!scsi_dh->devlist[i].tpgs ||
+		     (sdev->tpgs & scsi_dh->devlist[i].tpgs) != 0)) {
 			found = 1;
 			break;
 		}
@@ -128,6 +132,7 @@ device_handler_match(struct scsi_device_handler *scsi_dh,
 			strncpy(tmp->model, sdev->model, 16);
 			tmp->vendor[8] = '\0';
 			tmp->model[16] = '\0';
+			tmp->tpgs = sdev->tpgs;
 			tmp->handler = found_dh;
 			spin_lock(&list_lock);
 			list_add(&tmp->node, &scsi_dh_dev_list);
drivers/scsi/device_handler/scsi_dh_alua.c +9 -59

99 lines not on this page · raw message

drivers/scsi/device_handler/scsi_dh_emc.c +4 -4
index 0e572d2..ff2e653 100644
@@ -563,10 +563,10 @@ done:
 }
 
 static const struct scsi_dh_devlist clariion_dev_list[] = {
-	{"DGC", "RAID"},
-	{"DGC", "DISK"},
-	{"DGC", "VRAID"},
-	{NULL, NULL},
+	{"DGC", "RAID", 0},
+	{"DGC", "DISK", 0},
+	{"DGC", "VRAID", 0},
+	{NULL, NULL, 0},
 };
 
 static int clariion_bus_attach(struct scsi_device *sdev);
drivers/scsi/device_handler/scsi_dh_hp_sw.c +5 -5
index f7da753..3dbfbbf 100644
@@ -287,11 +287,11 @@ static int hp_sw_activate(struct scsi_device *sdev)
 }
 
 static const struct scsi_dh_devlist hp_sw_dh_data_list[] = {
-	{"COMPAQ", "MSA1000 VOLUME"},
-	{"COMPAQ", "HSV110"},
-	{"HP", "HSV100"},
-	{"DEC", "HSG80"},
-	{NULL, NULL},
+	{"COMPAQ", "MSA1000 VOLUME", 0},
+	{"COMPAQ", "HSV110", 0},
+	{"HP", "HSV100", 0},
+	{"DEC", "HSG80", 0},
+	{NULL, NULL, 0},
 };
 
 static int hp_sw_bus_attach(struct scsi_device *sdev);
drivers/scsi/device_handler/scsi_dh_rdac.c +19 -19
index 43b8c51..ad046bd 100644
@@ -609,25 +609,25 @@ static int rdac_check_sense(struct scsi_device *sdev,
 }
 
 static const struct scsi_dh_devlist rdac_dev_list[] = {
-	{"IBM", "1722"},
-	{"IBM", "1724"},
-	{"IBM", "1726"},
-	{"IBM", "1742"},
-	{"IBM", "1814"},
-	{"IBM", "1815"},
-	{"IBM", "1818"},
-	{"IBM", "3526"},
-	{"SGI", "TP9400"},
-	{"SGI", "TP9500"},
-	{"SGI", "IS"},
-	{"STK", "OPENstorage D280"},
-	{"SUN", "CSM200_R"},
-	{"SUN", "LCSM100_F"},
-	{"DELL", "MD3000"},
-	{"DELL", "MD3000i"},
-	{"LSI", "INF-01-00"},
-	{"ENGENIO", "INF-01-00"},
-	{NULL, NULL},
+	{"IBM", "1722", 0},
+	{"IBM", "1724", 0},
+	{"IBM", "1726", 0},
+	{"IBM", "1742", 0},
+	{"IBM", "1814", 0},
+	{"IBM", "1815", 0},
+	{"IBM", "1818", 0},
+	{"IBM", "3526", 0},
+	{"SGI", "TP9400", 0},
+	{"SGI", "TP9500", 0},
+	{"SGI", "IS", 0},
+	{"STK", "OPENstorage D280", 0},
+	{"SUN", "CSM200_R", 0},
+	{"SUN", "LCSM100_F", 0},
+	{"DELL", "MD3000", 0},
+	{"DELL", "MD3000i", 0},
+	{"LSI", "INF-01-00", 0},
+	{"ENGENIO", "INF-01-00", 0},
+	{NULL, NULL, 0},
 };
 
 static int rdac_bus_attach(struct scsi_device *sdev);
include/scsi/scsi_device.h +1 -0
index 22aaf72..6a90798 100644
@@ -173,6 +173,7 @@ struct scsi_device {
 struct scsi_dh_devlist {
 	char *vendor;
 	char *model;
+	char tpgs;
 };
 
 struct scsi_device_handler {
Signature · 1 line
1.5.3.2