diff options
author | sbruno <sbruno@FreeBSD.org> | 2013-03-08 20:07:32 +0000 |
---|---|---|
committer | sbruno <sbruno@FreeBSD.org> | 2013-03-08 20:07:32 +0000 |
commit | 22372779e59998ec6a0a5be2cb59b2b090af6bdc (patch) | |
tree | e69c60001dd27da2d5f9780e593c3d6d30ab0738 /sys | |
parent | 0119fcdaa7209e6b01db9cd061d739cb74e12a22 (diff) | |
download | FreeBSD-src-22372779e59998ec6a0a5be2cb59b2b090af6bdc.zip FreeBSD-src-22372779e59998ec6a0a5be2cb59b2b090af6bdc.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/geom/raid/g_raid.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c index 91d14c3..e3dd6ba 100644 --- a/sys/geom/raid/g_raid.c +++ b/sys/geom/raid/g_raid.c @@ -92,6 +92,11 @@ TUNABLE_INT("kern.geom.raid.idle_threshold", &g_raid_idle_threshold); 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_volume *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_volume *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; |