From owner-svn-src-all@FreeBSD.ORG Wed Oct 6 00:13:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66B41106564A; Wed, 6 Oct 2010 00:13:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5474D8FC13; Wed, 6 Oct 2010 00:13:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o960Duoh077101; Wed, 6 Oct 2010 00:13:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o960DumB077094; Wed, 6 Oct 2010 00:13:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010060013.o960DumB077094@svn.freebsd.org> From: Xin LI Date: Wed, 6 Oct 2010 00:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213467 - in stable/8: lib/libgeom sbin/geom/class/sched sbin/geom/core sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 00:13:56 -0000 Author: delphij Date: Wed Oct 6 00:13:55 2010 New Revision: 213467 URL: http://svn.freebsd.org/changeset/base/213467 Log: MFC r202454,202457,202458,202586,207842,207844,208099: Expose stripesize and stripeoffset via kernel sysctl as well as userland library and the geom(8) utility. Modified: stable/8/lib/libgeom/geom_util.c stable/8/lib/libgeom/geom_xml2tree.c stable/8/lib/libgeom/libgeom.3 stable/8/lib/libgeom/libgeom.h stable/8/sbin/geom/core/geom.c stable/8/sys/geom/geom_dump.c Directory Properties: stable/8/lib/libgeom/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) 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/lib/libgeom/geom_util.c ============================================================================== --- stable/8/lib/libgeom/geom_util.c Tue Oct 5 23:27:06 2010 (r213466) +++ stable/8/lib/libgeom/geom_util.c Wed Oct 6 00:13:55 2010 (r213467) @@ -114,6 +114,32 @@ g_sectorsize(int fd) } /* + * Return stripe size of the given provider. + */ +off_t +g_stripesize(int fd) +{ + off_t stripesize; + + if (g_ioctl_arg(fd, DIOCGSTRIPESIZE, &stripesize) == -1) + return (-1); + return (stripesize); +} + +/* + * Return stripe size of the given provider. + */ +off_t +g_stripeoffset(int fd) +{ + off_t stripeoffset; + + if (g_ioctl_arg(fd, DIOCGSTRIPEOFFSET, &stripeoffset) == -1) + return (-1); + return (stripeoffset); +} + +/* * Return the correct provider name. */ char * Modified: stable/8/lib/libgeom/geom_xml2tree.c ============================================================================== --- stable/8/lib/libgeom/geom_xml2tree.c Tue Oct 5 23:27:06 2010 (r213466) +++ stable/8/lib/libgeom/geom_xml2tree.c Wed Oct 6 00:13:55 2010 (r213467) @@ -230,6 +230,16 @@ EndElement(void *userData, const char *n free(p); return; } + if (!strcmp(name, "stripesize") && mt->provider != NULL) { + mt->provider->lg_stripesize = strtoumax(p, NULL, 0); + free(p); + return; + } + if (!strcmp(name, "stripeoffset") && mt->provider != NULL) { + mt->provider->lg_stripeoffset = strtoumax(p, NULL, 0); + free(p); + return; + } if (!strcmp(name, "config")) { mt->config = NULL; Modified: stable/8/lib/libgeom/libgeom.3 ============================================================================== --- stable/8/lib/libgeom/libgeom.3 Tue Oct 5 23:27:06 2010 (r213466) +++ stable/8/lib/libgeom/libgeom.3 Wed Oct 6 00:13:55 2010 (r213467) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 8, 2008 +.Dd January 16, 2010 .Dt LIBGEOM 3 .Os .Sh NAME @@ -50,6 +50,8 @@ .Nm g_close , .Nm g_mediasize , .Nm g_sectorsize , +.Nm g_stripeoffset , +.Nm g_stripesize , .Nm g_flush , .Nm g_delete , .Nm g_device_path , @@ -101,6 +103,10 @@ .Fn g_mediasize "int fd" .Ft ssize_t .Fn g_sectorsize "int fd" +.Ft ssize_t +.Fn g_stripeoffset "int fd" +.Ft ssize_t +.Fn g_stripesize "int fd" .Ft int .Fn g_flush "int fd" .Ft int @@ -297,6 +303,14 @@ The function returns sector size of the given provider. .Pp The +.Fn g_stripeoffset +function returns stripe offset of the given provider. +.Pp +The +.Fn g_stripesize +function returns stripe size of the given provider. +.Pp +The .Fn g_flush function sends .Dv BIO_FLUSH Modified: stable/8/lib/libgeom/libgeom.h ============================================================================== --- stable/8/lib/libgeom/libgeom.h Tue Oct 5 23:27:06 2010 (r213466) +++ stable/8/lib/libgeom/libgeom.h Wed Oct 6 00:13:55 2010 (r213467) @@ -123,6 +123,8 @@ struct gprovider { char *lg_mode; off_t lg_mediasize; u_int lg_sectorsize; + off_t lg_stripeoffset; + off_t lg_stripesize; struct gconf lg_config; }; @@ -149,6 +151,8 @@ int g_open(const char *, int); int g_close(int); off_t g_mediasize(int); ssize_t g_sectorsize(int); +off_t g_stripeoffset(int); +off_t g_stripesize(int); int g_flush(int); int g_delete(int, off_t, off_t); int g_get_ident(int, char *, size_t); Modified: stable/8/sbin/geom/core/geom.c ============================================================================== --- stable/8/sbin/geom/core/geom.c Tue Oct 5 23:27:06 2010 (r213466) +++ stable/8/sbin/geom/core/geom.c Wed Oct 6 00:13:55 2010 (r213467) @@ -673,6 +673,10 @@ list_one_provider(struct gprovider *pp, printf("%sMediasize: %jd (%s)\n", prefix, (intmax_t)pp->lg_mediasize, buf); printf("%sSectorsize: %u\n", prefix, pp->lg_sectorsize); + if (pp->lg_stripesize > 0 || pp->lg_stripeoffset > 0) { + printf("%sStripesize: %ju\n", prefix, pp->lg_stripesize); + printf("%sStripeoffset: %ju\n", prefix, pp->lg_stripeoffset); + } printf("%sMode: %s\n", prefix, pp->lg_mode); LIST_FOREACH(conf, &pp->lg_config, lg_config) { printf("%s%s: %s\n", prefix, conf->lg_name, conf->lg_val); @@ -697,6 +701,10 @@ list_one_consumer(struct gconsumer *cp, printf("%sMediasize: %jd (%s)\n", prefix, (intmax_t)pp->lg_mediasize, buf); printf("%sSectorsize: %u\n", prefix, pp->lg_sectorsize); + if (pp->lg_stripesize > 0 || pp->lg_stripeoffset > 0) { + printf("%sStripesize: %ju\n", prefix, pp->lg_stripesize); + printf("%sStripeoffset: %ju\n", prefix, pp->lg_stripeoffset); + } printf("%sMode: %s\n", prefix, cp->lg_mode); } LIST_FOREACH(conf, &cp->lg_config, lg_config) { Modified: stable/8/sys/geom/geom_dump.c ============================================================================== --- stable/8/sys/geom/geom_dump.c Tue Oct 5 23:27:06 2010 (r213466) +++ stable/8/sys/geom/geom_dump.c Wed Oct 6 00:13:55 2010 (r213467) @@ -207,6 +207,10 @@ g_conf_provider(struct sbuf *sb, struct sbuf_printf(sb, "\t %jd\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t %u\n", pp->sectorsize); + if (pp->stripesize > 0) { + sbuf_printf(sb, "\t %u\n", pp->stripesize); + sbuf_printf(sb, "\t %u\n", pp->stripeoffset); + } if (pp->geom->flags & G_GEOM_WITHER) ; else if (pp->geom->dumpconf != NULL) {