Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2013 20:07:33 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r248068 - in head: sbin/geom/class/raid sys/geom/raid
Message-ID:  <201303082007.r28K7XQH047053@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Fri Mar  8 20:07:32 2013
New Revision: 248068
URL: http://svnweb.freebsd.org/changeset/base/248068

Log:
  Add legacy support to geom raid to create a /dev/arX device for support
  of upgrading older machines using ataraid(4) to newer releases.
  
  This optional parameter is controlled via kern.geom.raid.legacy_aliases
  and will create a /dev/ar0 device that will point at /dev/raid/r0 for
  example.
  
  Tested on Dell SC 1425 DDF-1 format software raid controllers installing from
  stable/7 and upgrading to stable/9 without having to adjust /etc/fstab
  
  Reviewed by:	mav
  Obtained from:	Yahoo!
  MFC after:	2 Weeks

Modified:
  head/sbin/geom/class/raid/graid.8
  head/sys/geom/raid/g_raid.c

Modified: head/sbin/geom/class/raid/graid.8
==============================================================================
--- head/sbin/geom/class/raid/graid.8	Fri Mar  8 19:36:44 2013	(r248067)
+++ head/sbin/geom/class/raid/graid.8	Fri Mar  8 20:07:32 2013	(r248068)
@@ -305,6 +305,9 @@ Write errors are always considered as di
 Time to wait for missing array components on startup.
 .It Va kern.geom.raid. Ns Ar X Ns Va .enable : No 1
 Enable taste for specific metadata or transformation module.
+.It Va kern.geom.raid.legacy_aliases : No 0
+Enable geom raid emulation of /dev/ar%d devices from ataraid(4)
+This should aid the upgrade of systems from legacy to modern releases.
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and non-zero if the command fails.

Modified: head/sys/geom/raid/g_raid.c
==============================================================================
--- head/sys/geom/raid/g_raid.c	Fri Mar  8 19:36:44 2013	(r248067)
+++ head/sys/geom/raid/g_raid.c	Fri Mar  8 20:07:32 2013	(r248068)
@@ -92,6 +92,11 @@ TUNABLE_INT("kern.geom.raid.idle_thresho
 SYSCTL_UINT(_kern_geom_raid, OID_AUTO, idle_threshold, CTLFLAG_RW,
     &g_raid_idle_threshold, 1000000,
     "Time in microseconds to consider a volume idle.");
+static u_int ar_legacy_aliases = 1;
+SYSCTL_INT(_kern_geom_raid, OID_AUTO, legacy_aliases, CTLFLAG_RW,
+           &ar_legacy_aliases, 0, "Create aliases named as the legacy ataraid style.");
+TUNABLE_INT("kern.geom_raid.legacy_aliases", &ar_legacy_aliases);
+
 
 #define	MSLEEP(rv, ident, mtx, priority, wmesg, timeout)	do {	\
 	G_RAID_DEBUG(4, "%s: Sleeping %p.", __func__, (ident));		\
@@ -1637,6 +1642,7 @@ g_raid_launch_provider(struct g_raid_vol
 	struct g_raid_softc *sc;
 	struct g_provider *pp;
 	char name[G_RAID_MAX_VOLUMENAME];
+	char   announce_buf[80], buf1[32];
 	off_t off;
 
 	sc = vol->v_softc;
@@ -1650,6 +1656,22 @@ g_raid_launch_provider(struct g_raid_vol
 		/* Otherwise use sequential volume number. */
 		snprintf(name, sizeof(name), "raid/r%d", vol->v_global_id);
 	}
+
+	/*
+	 * Create a /dev/ar%d that the old ataraid(4) stack once
+	 * created as an alias for /dev/raid/r%d if requested.
+	 * This helps going from stable/7 ataraid devices to newer
+	 * FreeBSD releases. sbruno 07 MAY 2013
+	 */
+
+        if (ar_legacy_aliases) {
+		snprintf(announce_buf, sizeof(announce_buf),
+                        "kern.devalias.%s", name);
+                snprintf(buf1, sizeof(buf1),
+                        "ar%d", vol->v_global_id);
+                setenv(announce_buf, buf1);
+        }
+
 	pp = g_new_providerf(sc->sc_geom, "%s", name);
 	pp->private = vol;
 	pp->mediasize = vol->v_mediasize;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303082007.r28K7XQH047053>