Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 2013 09:21:22 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r251916 - stable/9/sys/geom/raid
Message-ID:  <201306180921.r5I9LM1X083014@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Jun 18 09:21:21 2013
New Revision: 251916
URL: http://svnweb.freebsd.org/changeset/base/251916

Log:
  MFC r248068 (by sbruno):
  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

Modified:
  stable/9/sys/geom/raid/g_raid.c

Modified: stable/9/sys/geom/raid/g_raid.c
==============================================================================
--- stable/9/sys/geom/raid/g_raid.c	Tue Jun 18 09:19:59 2013	(r251915)
+++ stable/9/sys/geom/raid/g_raid.c	Tue Jun 18 09:21:21 2013	(r251916)
@@ -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?201306180921.r5I9LM1X083014>