From owner-svn-src-head@FreeBSD.ORG Fri Mar 8 20:07:33 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7A9866CA; Fri, 8 Mar 2013 20:07:33 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5C328809; Fri, 8 Mar 2013 20:07:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r28K7XVs047055; Fri, 8 Mar 2013 20:07:33 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r28K7XQH047053; Fri, 8 Mar 2013 20:07:33 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201303082007.r28K7XQH047053@svn.freebsd.org> From: Sean Bruno Date: Fri, 8 Mar 2013 20:07:33 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2013 20:07:33 -0000 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;