Date: Tue, 5 Jan 2010 13:56:58 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r201585 - stable/8/usr.sbin/diskinfo Message-ID: <201001051356.o05DuwrX016197@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Tue Jan 5 13:56:58 2010 New Revision: 201585 URL: http://svn.freebsd.org/changeset/base/201585 Log: MFC 200968: Make diskinfo report disk stripe size and offset. It should help users to make file systems optimally aligned and tuned for better performance. Modified: stable/8/usr.sbin/diskinfo/diskinfo.8 stable/8/usr.sbin/diskinfo/diskinfo.c Directory Properties: stable/8/usr.sbin/diskinfo/ (props changed) Modified: stable/8/usr.sbin/diskinfo/diskinfo.8 ============================================================================== --- stable/8/usr.sbin/diskinfo/diskinfo.8 Tue Jan 5 13:55:49 2010 (r201584) +++ stable/8/usr.sbin/diskinfo/diskinfo.8 Tue Jan 5 13:56:58 2010 (r201585) @@ -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: stable/8/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- stable/8/usr.sbin/diskinfo/diskinfo.c Tue Jan 5 13:55:49 2010 (r201584) +++ stable/8/usr.sbin/diskinfo/diskinfo.c Tue Jan 5 13:56:58 2010 (r201585) @@ -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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001051356.o05DuwrX016197>