svn commit: r201587 - stable/8/sys/dev/twe

Alexander Motin mav at FreeBSD.org
Tue Jan 5 14:02:13 UTC 2010


Author: mav
Date: Tue Jan  5 14:02:12 2010
New Revision: 201587
URL: http://svn.freebsd.org/changeset/base/201587

Log:
  MFC 200991:
  Teach twe driver to report array stripe size to GEOM.

Modified:
  stable/8/sys/dev/twe/twe.c
  stable/8/sys/dev/twe/twe_freebsd.c
  stable/8/sys/dev/twe/twevar.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/twe/twe.c
==============================================================================
--- stable/8/sys/dev/twe/twe.c	Tue Jan  5 13:58:18 2010	(r201586)
+++ stable/8/sys/dev/twe/twe.c	Tue Jan  5 14:02:12 2010	(r201587)
@@ -201,7 +201,7 @@ twe_add_unit(struct twe_softc *sc, int u
     int				table, error = 0;
     u_int16_t			dsize;
     TWE_Param			*drives = NULL, *param = NULL;
-    TWE_Unit_Descriptor		*ud;
+    TWE_Array_Descriptor	*ud;
 
     if (unit < 0 || unit > TWE_MAX_UNITS)
 	return (EINVAL);
@@ -244,8 +244,9 @@ twe_add_unit(struct twe_softc *sc, int u
 	error = EIO;
 	goto out;
     }
-    ud = (TWE_Unit_Descriptor *)param->data;
+    ud = (TWE_Array_Descriptor *)param->data;
     dr->td_type = ud->configuration;
+    dr->td_stripe = ud->stripe_size;
 
     /* build synthetic geometry as per controller internal rules */
     if (dr->td_size > 0x200000) {

Modified: stable/8/sys/dev/twe/twe_freebsd.c
==============================================================================
--- stable/8/sys/dev/twe/twe_freebsd.c	Tue Jan  5 13:58:18 2010	(r201586)
+++ stable/8/sys/dev/twe/twe_freebsd.c	Tue Jan  5 14:02:12 2010	(r201587)
@@ -818,6 +818,13 @@ twed_attach(device_t dev)
     sc->twed_disk->d_maxsize = (TWE_MAX_SGL_LENGTH - 1) * PAGE_SIZE;
     sc->twed_disk->d_sectorsize = TWE_BLOCK_SIZE;
     sc->twed_disk->d_mediasize = TWE_BLOCK_SIZE * (off_t)sc->twed_drive->td_size;
+    if (sc->twed_drive->td_type == TWE_UD_CONFIG_RAID0 ||
+	sc->twed_drive->td_type == TWE_UD_CONFIG_RAID5 ||
+	sc->twed_drive->td_type == TWE_UD_CONFIG_RAID10) {
+	    sc->twed_disk->d_stripesize =
+		TWE_BLOCK_SIZE << sc->twed_drive->td_stripe;
+	    sc->twed_disk->d_stripeoffset = 0;
+    }
     sc->twed_disk->d_fwsectors = sc->twed_drive->td_sectors;
     sc->twed_disk->d_fwheads = sc->twed_drive->td_heads;
     sc->twed_disk->d_unit = sc->twed_drive->td_sys_unit;

Modified: stable/8/sys/dev/twe/twevar.h
==============================================================================
--- stable/8/sys/dev/twe/twevar.h	Tue Jan  5 13:58:18 2010	(r201586)
+++ stable/8/sys/dev/twe/twevar.h	Tue Jan  5 14:02:12 2010	(r201587)
@@ -59,6 +59,7 @@ struct twe_drive
     /* unit state and type */
     u_int8_t		td_state;
     u_int8_t		td_type;
+    u_int8_t		td_stripe;
 
     /* handle for attached driver */
     device_t		td_disk;


More information about the svn-src-stable mailing list