[PATCH] 0/1: Hold global HostRAID spares in a special spare array

"Darrick J. Wong" <[email protected]>
Newsgroups gmane.linux.ataraid
Organization IBM LTC
Message-ID <[email protected]>
Hi all,

The attached patch makes the HostRAID handler put global HostRAID spares
into a hidden array called ".asr_spares".  In the future, event_io will
grab spares from this hidden array when necessary.

This patch should apply cleanly against 1.0.0rc11-pre1.

Questions?  Comments?

--Darrick

Signed-off-by: Darrick J. Wong <[email protected]>

_______________________________________________
Ataraid-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ataraid-list
asr-spare_1.patch (text/x-patch, 1.6 KB)
diff -Naurp v7.orig/lib/format/ataraid/asr.c v7.asr.spare/lib/format/ataraid/asr.c
--- v7.orig/lib/format/ataraid/asr.c	2006-02-17 09:26:44.000000000 -0800
+++ v7.asr.spare/lib/format/ataraid/asr.c	2006-05-12 15:16:10.000000000 -0700
@@ -22,6 +22,8 @@
 
 static const char *handler = HANDLER;
 
+#define SPARE_ARRAY	".asr_spares"
+
 /* Map ASR disk status to dmraid status */
 static enum status disk_status(struct asr_raid_configline *disk) {
 	if (disk == NULL)
@@ -547,6 +549,37 @@ static struct raid_set *asr_group(struct
 	struct raid_set *set, *sset;
 	char buf[BUFSIZE];
 
+	if (T_SPARE(rd)) {
+		/*
+		 * If this drive really _is_ attached to a specific
+		 * RAID set, then just attach it.  Really old HostRAID cards
+		 * do this... but I don't have any hardware to test this.
+		 */
+		/*
+		 * FIXME: dmraid ignores spares attached to RAID arrays.
+		 * For now, we'll let it get sucked into the ASR spare pool. 
+		 * If we need it, we'll reconfigure it; if not, nobody touches
+		 * it.
+		 *
+		set = find_set(lc, name(lc, asr), FIND_TOP, rd, LC_RS(lc),
+			       NO_CREATE, NO_CREATE_ARG);
+		 */
+
+		/* Otherwise, make a global spare pool. */
+		set = find_or_alloc_raid_set(lc, (char*)SPARE_ARRAY,
+			FIND_TOP, rd, LC_RS(lc), NO_CREATE, NO_CREATE_ARG);
+
+		/*
+		 * Setting the type to t_spare guarantees that dmraid won't
+		 * try to set up a real device-mapper mapping.
+		 */
+		set->type = t_spare;
+
+		/* Add the disk to the set. */
+		list_add_sorted(lc, &set->devs, &rd->devs, dev_sort);
+		return set;
+	}
+
 	/* Find the top level FWL/FWL2 for this device. */
 	top_idx = find_toplevel(lc, asr);
 	if (top_idx < 0) {
signature.asc (application/pgp-signature, 191 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEZQ2+a6vRYYgWQuURApH1AJ9c2TQm98bh/pmTjkcvsrZq4tXfwQCdHXMF
ppIYz++cfVQT7Lp7qVU2pMo=
=vjVj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.