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
This commit is contained in:
Sean Bruno 2013-03-08 20:07:32 +00:00
parent b3469f58a7
commit bd9fba0cfe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248068
2 changed files with 25 additions and 0 deletions

View File

@ -305,6 +305,9 @@ Write errors are always considered as disk failures.
Time to wait for missing array components on startup. Time to wait for missing array components on startup.
.It Va kern.geom.raid. Ns Ar X Ns Va .enable : No 1 .It Va kern.geom.raid. Ns Ar X Ns Va .enable : No 1
Enable taste for specific metadata or transformation module. 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 .El
.Sh EXIT STATUS .Sh EXIT STATUS
Exit status is 0 on success, and non-zero if the command fails. Exit status is 0 on success, and non-zero if the command fails.

View File

@ -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, SYSCTL_UINT(_kern_geom_raid, OID_AUTO, idle_threshold, CTLFLAG_RW,
&g_raid_idle_threshold, 1000000, &g_raid_idle_threshold, 1000000,
"Time in microseconds to consider a volume idle."); "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 { \ #define MSLEEP(rv, ident, mtx, priority, wmesg, timeout) do { \
G_RAID_DEBUG(4, "%s: Sleeping %p.", __func__, (ident)); \ 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_raid_softc *sc;
struct g_provider *pp; struct g_provider *pp;
char name[G_RAID_MAX_VOLUMENAME]; char name[G_RAID_MAX_VOLUMENAME];
char announce_buf[80], buf1[32];
off_t off; off_t off;
sc = vol->v_softc; sc = vol->v_softc;
@ -1650,6 +1656,22 @@ g_raid_launch_provider(struct g_raid_volume *vol)
/* Otherwise use sequential volume number. */ /* Otherwise use sequential volume number. */
snprintf(name, sizeof(name), "raid/r%d", vol->v_global_id); 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 = g_new_providerf(sc->sc_geom, "%s", name);
pp->private = vol; pp->private = vol;
pp->mediasize = vol->v_mediasize; pp->mediasize = vol->v_mediasize;