svn commit: r200934 - in head/sys: geom sys

Alexander Motin mav at FreeBSD.org
Thu Dec 24 11:05:23 UTC 2009


Author: mav
Date: Thu Dec 24 11:05:23 2009
New Revision: 200934
URL: http://svn.freebsd.org/changeset/base/200934

Log:
  Add two disk ioctls, giving user-level tools information about disk/array
  stripe (optimal access block) size and offset.

Modified:
  head/sys/geom/geom_dev.c
  head/sys/sys/disk.h

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Thu Dec 24 10:43:44 2009	(r200933)
+++ head/sys/geom/geom_dev.c	Thu Dec 24 11:05:23 2009	(r200934)
@@ -323,7 +323,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd
 			return (ENOENT);
 		strlcpy(data, pp->name, i);
 		break;
-
+	case DIOCGSTRIPESIZE:
+		*(off_t *)data = cp->provider->stripesize;
+		break;
+	case DIOCGSTRIPEOFFSET:
+		*(off_t *)data = cp->provider->stripeoffset;
+		break;
 	default:
 		if (cp->provider->geom->ioctl != NULL) {
 			error = cp->provider->geom->ioctl(cp->provider, cmd, data, fflag, td);

Modified: head/sys/sys/disk.h
==============================================================================
--- head/sys/sys/disk.h	Thu Dec 24 10:43:44 2009	(r200933)
+++ head/sys/sys/disk.h	Thu Dec 24 11:05:23 2009	(r200934)
@@ -104,4 +104,16 @@ void disk_err(struct bio *bp, const char
 	 * must be at least MAXPATHLEN bytes long.
 	 */
 
+#define DIOCGSTRIPESIZE	_IOR('d', 139, off_t)	/* Get stripe size in bytes */
+	/*-
+	 * Get the size of the device's optimal access block in bytes.
+	 * This should be a multiple of the sectorsize.
+	 */
+
+#define DIOCGSTRIPEOFFSET _IOR('d', 140, off_t)	/* Get stripe offset in bytes */
+	/*-
+	 * Get the offset of the first device's optimal access block in bytes.
+	 * This should be a multiple of the sectorsize.
+	 */
+
 #endif /* _SYS_DISK_H_ */


More information about the svn-src-all mailing list