All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: christophe varoqui <christophe.varoqui@free.fr>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] S/390 DASD support for multipath-tools
Date: Wed, 07 Dec 2005 14:52:52 +0100	[thread overview]
Message-ID: <4396E934.2020306@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Hi Christophe,

this patch adds S/390 DASD support for multipath-tools.
As the DASD do have their own type of multipathing (called PAV there)
I don't see why multipath-tools shouldn't support it.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke			hare@suse.de
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

[-- Attachment #2: multipath-tools-dasd-support.patch --]
[-- Type: text/x-patch, Size: 4028 bytes --]

Add support for S/390 DASD

On newer zSeries hardware the default disks (called DASDs) have a
multipath feature built-in (aka PAV for Parallel Access Volumes).
This patch enables support for these disks.

Signed-off-by: Hannes Reinecke

---

 libmultipath/discovery.c |   64 +++++++++++++++++++++++++++++++++++++++++++++-
 libmultipath/hwtable.c   |    4 +++
 libmultipath/structs.h   |    3 +-
 3 files changed, 68 insertions(+), 3 deletions(-)

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -181,6 +181,8 @@ sysfs_get_##fname (char * sysfs_path, ch
 	return 0; \
 }
 
+declare_sysfs_get_str(devtype, "%s/block/%s/device/devtype");
+declare_sysfs_get_str(cutype, "%s/block/%s/device/cutype");
 declare_sysfs_get_str(vendor, "%s/block/%s/device/vendor");
 declare_sysfs_get_str(model, "%s/block/%s/device/model");
 declare_sysfs_get_str(rev, "%s/block/%s/device/rev");
@@ -392,6 +394,8 @@ sysfs_get_bus (char * sysfs_path, struct
 		curpath->bus = SYSFS_BUS_SCSI;
 	else if (!strncmp(sdev->bus, "ide", 3))
 		curpath->bus = SYSFS_BUS_IDE;
+	else if (!strncmp(sdev->bus, "ccw", 3))
+		curpath->bus = SYSFS_BUS_CCW;
 	else
 		return 1;
 
@@ -469,6 +473,59 @@ scsi_sysfs_pathinfo (struct path * curpa
 }
 
 static int
+ccw_sysfs_pathinfo (struct path * curpath)
+{
+	char attr_path[FILE_NAME_SIZE];
+	char attr_buff[FILE_NAME_SIZE];
+
+	sprintf(curpath->vendor_id, "IBM");
+
+	condlog(3, "vendor = %s", curpath->vendor_id);
+
+	if (sysfs_get_devtype(sysfs_path, curpath->dev,
+			      attr_buff, FILE_NAME_SIZE))
+		return 1;
+
+	if (!strncmp(attr_buff, "3370", 4)) {
+		sprintf(curpath->product_id,"S/390 DASD FBA");
+	} else if (!strncmp(attr_buff, "9336", 4)) {
+		sprintf(curpath->product_id,"S/390 DASD FBA");
+	} else {
+		sprintf(curpath->product_id,"S/390 DASD ECKD");
+	}
+
+	condlog(3, "product = %s", curpath->product_id);
+
+	/*
+	 * host / bus / target / lun
+	 */
+	if(safe_sprintf(attr_path, "%s/block/%s/device",
+			sysfs_path, curpath->dev)) {
+		condlog(0, "attr_path too small");
+		return 1;
+	}
+	if (0 > sysfs_get_link(attr_path, attr_buff, sizeof(attr_buff)))
+		return 1;
+	
+	basename(attr_buff, attr_path);
+
+	condlog(3, "device path %s", attr_path);
+
+	curpath->sg_id.lun = 0;
+	sscanf(attr_path, "%i.%i.%x",
+			&curpath->sg_id.host_no,
+			&curpath->sg_id.channel,
+			&curpath->sg_id.scsi_id);
+	condlog(3, "h:b:t:l = %i:%i:%i:%i",
+			curpath->sg_id.host_no,
+			curpath->sg_id.channel,
+			curpath->sg_id.scsi_id,
+			curpath->sg_id.lun);
+
+	return 0;
+}
+
+static int
 common_sysfs_pathinfo (struct path * curpath)
 {
 	if (sysfs_get_bus(sysfs_path, curpath))
@@ -498,10 +555,13 @@ sysfs_pathinfo(struct path * curpath)
 
 	if (curpath->bus == SYSFS_BUS_UNDEF)
 		return 0;
-	else if (curpath->bus == SYSFS_BUS_SCSI)
+	else if (curpath->bus == SYSFS_BUS_SCSI) {
 		if (scsi_sysfs_pathinfo(curpath))
 			return 1;
-
+	} else if (curpath->bus == SYSFS_BUS_CCW) {
+		if (ccw_sysfs_pathinfo(curpath))
+			return 1;
+	}
 	return 0;
 }
 
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -53,6 +53,10 @@ setup_default_hwtable (vector hw)
 	/* IBM SAN Volume Controller */
 	r += store_hwe_ext(hw, "IBM", "2145", MULTIBUS, DEFAULT_GETUID,
 		   NULL, "0", "1 queue_if_no_path", "tur", FAILBACK_UNDEF);
+	/* IBM S/390 ECKD DASD */
+	r += store_hwe_ext(hw, "IBM", "S/390 DASD ECKD", MULTIBUS,
+		   "/sbin/dasdview -j /dev/%n", NULL, "0", "0",
+		   "directio", FAILBACK_UNDEF);
 	r += store_hwe_ext(hw, "NETAPP", "LUN", GROUP_BY_PRIO, DEFAULT_GETUID,
 		  "/sbin/mpath_prio_netapp /dev/%n", NULL,
 		  "1 queue_if_no_path", "readsector0", FAILBACK_UNDEF);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -38,7 +38,8 @@ enum failback_mode {
 enum sysfs_buses {
 	SYSFS_BUS_UNDEF,
 	SYSFS_BUS_SCSI,
-	SYSFS_BUS_IDE
+	SYSFS_BUS_IDE,
+	SYSFS_BUS_CCW
 };
 
 enum pathstates {

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



                 reply	other threads:[~2005-12-07 13:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4396E934.2020306@suse.de \
    --to=hare@suse.de \
    --cc=christophe.varoqui@free.fr \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.