From owner-svn-src-head@FreeBSD.ORG Thu Dec 24 21:39:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64ADE106566B; Thu, 24 Dec 2009 21:39:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38C158FC21; Thu, 24 Dec 2009 21:39:31 +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 nBOLdVsL042038; Thu, 24 Dec 2009 21:39:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBOLdV5P042035; Thu, 24 Dec 2009 21:39:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200912242139.nBOLdV5P042035@svn.freebsd.org> From: Alexander Motin Date: Thu, 24 Dec 2009 21:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200968 - head/usr.sbin/diskinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2009 21:39:31 -0000 Author: mav Date: Thu Dec 24 21:39:30 2009 New Revision: 200968 URL: http://svn.freebsd.org/changeset/base/200968 Log: Make diskinfo report disk stripe size and offset. It should help users to make file systems optimally aligned and tuned for better performance. Modified: head/usr.sbin/diskinfo/diskinfo.8 head/usr.sbin/diskinfo/diskinfo.c Modified: head/usr.sbin/diskinfo/diskinfo.8 ============================================================================== --- head/usr.sbin/diskinfo/diskinfo.8 Thu Dec 24 20:55:14 2009 (r200967) +++ head/usr.sbin/diskinfo/diskinfo.8 Thu Dec 24 21:39:30 2009 (r200968) @@ -46,7 +46,8 @@ and optionally runs a naive performance .Pp If given no arguments, the output will be a single line per specified device with the following fields: device name, sectorsize, media size in bytes, -media size in sectors, firmware cylinders, firmware heads, and firmware sectors. +media size in sectors, stripe size, stripe offset, firmware cylinders, +firmware heads, and firmware sectors. The last three fields are only present if the information is available. .Pp If given the Modified: head/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- head/usr.sbin/diskinfo/diskinfo.c Thu Dec 24 20:55:14 2009 (r200967) +++ head/usr.sbin/diskinfo/diskinfo.c Thu Dec 24 21:39:30 2009 (r200968) @@ -58,7 +58,7 @@ main(int argc, char **argv) { int i, ch, fd, error; char buf[BUFSIZ], ident[DISK_IDENT_SIZE]; - off_t mediasize; + off_t mediasize, stripesize, stripeoffset; u_int sectorsize, fwsectors, fwheads; while ((ch = getopt(argc, argv, "ctv")) != -1) { @@ -104,11 +104,19 @@ main(int argc, char **argv) error = ioctl(fd, DIOCGFWHEADS, &fwheads); if (error) fwheads = 0; + error = ioctl(fd, DIOCGSTRIPESIZE, &stripesize); + if (error) + stripesize = 0; + error = ioctl(fd, DIOCGSTRIPEOFFSET, &stripeoffset); + if (error) + stripeoffset = 0; if (!opt_v) { printf("%s", argv[i]); printf("\t%u", sectorsize); printf("\t%jd", (intmax_t)mediasize); printf("\t%jd", (intmax_t)mediasize/sectorsize); + printf("\t%jd", (intmax_t)stripesize); + printf("\t%jd", (intmax_t)stripeoffset); if (fwsectors != 0 && fwheads != 0) { printf("\t%jd", (intmax_t)mediasize / (fwsectors * fwheads * sectorsize)); @@ -124,6 +132,8 @@ main(int argc, char **argv) (intmax_t)mediasize, buf); printf("\t%-12jd\t# mediasize in sectors\n", (intmax_t)mediasize/sectorsize); + printf("\t%-12jd\t# stripesize\n", stripesize); + printf("\t%-12jd\t# stripeoffset\n", stripeoffset); if (fwsectors != 0 && fwheads != 0) { printf("\t%-12jd\t# Cylinders according to firmware.\n", (intmax_t)mediasize / (fwsectors * fwheads * sectorsize));