Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2011 11:03:25 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Alexander Motin <mav@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r221101 - in head/sys/geom: . concat journal mirror raid3 shsec stripe virstor
Message-ID:  <20110427080325.GV48734@deviant.kiev.zoral.com.ua>
In-Reply-To: <201104270010.p3R0AQQv044866@svn.freebsd.org>
References:  <201104270010.p3R0AQQv044866@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--yOCDj6dCdxu1mn4c
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Apr 27, 2011 at 12:10:26AM +0000, Alexander Motin wrote:
> Author: mav
> Date: Wed Apr 27 00:10:26 2011
> New Revision: 221101
> URL: http://svn.freebsd.org/changeset/base/221101
>=20
> Log:
>   Implement relaxed comparision for hardcoded provider names to make it
>   ignore adX/adaY difference in both directions to simplify migration to
>   the CAM-based ATA or back.
>=20
> Modified:
>   head/sys/geom/concat/g_concat.c
>   head/sys/geom/geom.h
>   head/sys/geom/geom_subr.c
>   head/sys/geom/journal/g_journal.c
>   head/sys/geom/mirror/g_mirror.c
>   head/sys/geom/raid3/g_raid3.c
>   head/sys/geom/shsec/g_shsec.c
>   head/sys/geom/stripe/g_stripe.c
>   head/sys/geom/virstor/g_virstor.c
>=20
> Modified: head/sys/geom/concat/g_concat.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/geom/concat/g_concat.c	Tue Apr 26 23:00:32 2011	(r221100)
> +++ head/sys/geom/concat/g_concat.c	Wed Apr 27 00:10:26 2011	(r221101)
> @@ -678,7 +678,8 @@ g_concat_taste(struct g_class *mp, struc
>  	if (md.md_version < 4)
>  		md.md_provsize =3D pp->mediasize;
> =20
> -	if (md.md_provider[0] !=3D '\0' && strcmp(md.md_provider, pp->name) !=
=3D 0)
> +	if (md.md_provider[0] !=3D '\0' &&
> +	    !g_compare_names(md.md_provider, pp->name))
>  		return (NULL);
>  	if (md.md_provsize !=3D pp->mediasize)
>  		return (NULL);
>=20
> Modified: head/sys/geom/geom.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/geom/geom.h	Tue Apr 26 23:00:32 2011	(r221100)
> +++ head/sys/geom/geom.h	Wed Apr 27 00:10:26 2011	(r221101)
> @@ -238,6 +238,7 @@ void g_waitidlelock(void);
>  /* geom_subr.c */
>  int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl);
>  int g_attach(struct g_consumer *cp, struct g_provider *pp);
> +int g_compare_names(const char *namea, const char *nameb);
>  void g_destroy_consumer(struct g_consumer *cp);
>  void g_destroy_geom(struct g_geom *pp);
>  void g_destroy_provider(struct g_provider *pp);
>=20
> Modified: head/sys/geom/geom_subr.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/sys/geom/geom_subr.c	Tue Apr 26 23:00:32 2011	(r221100)
> +++ head/sys/geom/geom_subr.c	Wed Apr 27 00:10:26 2011	(r221101)
> @@ -1017,6 +1017,43 @@ g_getattr__(const char *attr, struct g_c
>  	return (0);
>  }
> =20
> +static int
> +g_get_device_prefix_len(const char *name)
> +{
> +	int len;
> +
> +	if (strncmp(name, "ada", 3) =3D=3D 0)
> +		len =3D 3;
> +	else if (strncmp(name, "ad", 2) =3D=3D 0)
> +		len =3D 2;
> +	else
> +		return (0);
> +	if (name[len] < '0' || name[len] > '9')
> +		return (0);
> +	do {
> +		len++;
> +	} while (name[len] >=3D '0' && name[len] <=3D '9');
> +	return (len);
> +}
> +
> +int
> +g_compare_names(const char *namea, const char *nameb)
> +{
> +	int deva, devb;
> +
> +	if (strcmp(namea, nameb) =3D=3D 0)
> +		return (1);
> +	deva =3D g_get_device_prefix_len(namea);
> +	if (deva =3D=3D 0)
> +		return (0);
> +	devb =3D g_get_device_prefix_len(nameb);
> +	if (devb =3D=3D 0)
> +		return (0);
> +	if (strcmp(namea + deva, nameb + devb) =3D=3D 0)
> +		return (1);
> +	return (0);
> +}
> +
This is most likely my misunderstanding of things.

Can we have a legitimate situation where both ada* and ad* devices coexist
on the same system ? E.g. on-board AHCI and legacy PATA controller ?

Wouldn't this hack then wreak the havoc ? Can the hack be put under the
control of some tunable ?

--yOCDj6dCdxu1mn4c
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk23zcwACgkQC3+MBN1Mb4hrjQCeP+S6FfrYF/fQOi73swqlLrY7
ueEAmwRJfT8TYREdrolXGYGK3Noj4sI8
=orH1
-----END PGP SIGNATURE-----

--yOCDj6dCdxu1mn4c--



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