Print this page
NEX-3729 KRRP changes mess up iostat(1M)
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-4426 iostat(1M) should be able to handle KSTAT_DATA_STRING
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>

@@ -126,10 +126,12 @@
                                         /* format (-d, -D, -e, -E, -x -X -Y) */
 static  uint_t  do_cpu;                 /* show cpu info (-c) */
 static  uint_t  do_interval;            /* do intervals (-I) */
 static  int     do_partitions;          /* per-partition stats (-p) */
 static  int     do_partitions_only;     /* per-partition stats only (-P) */
+static  int     do_zfs;
+static  int     do_zfs_only;
                                         /* no per-device stats for disks */
 static  uint_t  do_conversions;         /* display disks as cXtYdZ (-n) */
 static  uint_t  do_megabytes;           /* display data in MB/sec (-M) */
 static  uint_t  do_controller;          /* display controller info (-C) */
 static  uint_t  do_raw;                 /* emit raw format (-r) */

@@ -151,11 +153,11 @@
 
 #define SMALL_SCRATCH_BUFLEN    MAXNAMELEN
 
 static int      iodevs_nl;              /* name field width */
 #define IODEVS_NL_MIN           6       /* not too thin for "device" */
-#define IODEVS_NL_MAX           24      /* but keep full width under 80 */
+#define IODEVS_NL_MAX           64      /* but keep full width under 80 */
 
 static  char    disk_header[132];
 static  uint_t  dh_len;                 /* disk header length for centering */
 static  int     lineout;                /* data waiting to be printed? */
 

@@ -223,11 +225,11 @@
         types |= SNAP_CPUS;
 
         if (do_disk)
                 types |= SNAP_IODEVS;
 
-        if (do_disk && !do_partitions_only)
+        if (do_disk && !do_partitions_only && !do_zfs_only)
                 df.if_allowed_types |= IODEV_DISK;
         if (do_disk & DISK_IOPATH_LI) {
                 df.if_allowed_types |= IODEV_IOPATH_LTI;
                 types |= SNAP_IOPATHS_LI;
         }

@@ -237,10 +239,12 @@
         }
         if (do_disk & DISK_ERROR_MASK)
                 types |= SNAP_IODEV_ERRORS;
         if (do_partitions || do_partitions_only)
                 df.if_allowed_types |= IODEV_PARTITION;
+        if (do_zfs || do_zfs_only)
+                df.if_allowed_types |= IODEV_ZFS;
         if (do_conversions)
                 types |= SNAP_IODEV_PRETTY;
         if (do_devid)
                 types |= SNAP_IODEV_DEVID;
         if (do_controller) {

@@ -962,10 +966,14 @@
             "instead of Kb/sec\n"
             "\t\t-n:    convert device names to cXdYtZ format\n"
             "\t\t-p:    report per-partition disk statistics\n"
             "\t\t-P:    report per-partition disk statistics only,\n"
             "\t\t\tno per-device disk statistics\n"
+            "\t\t-f:    report ZFS-level statistics for ZFS pool and\n"
+            "\t\t\tindividual vdevs\n"
+            "\t\t-F:    report ZFS pool and individual physical vdevs\n"
+            "\t\t\tstatistics only, no per-device statistics\n"
             "\t\t-r:    Display data in comma separated format\n"
             "\t\t-s:    Suppress state change messages\n"
             "\t\t-T d|u Display a timestamp in date (d) or unix "
             "time_t (u)\n"
             "\t\t-t:    display chars read/written to terminals\n"

@@ -1080,11 +1088,11 @@
         int             c;
         int             errflg = 0;
         extern char     *optarg;
         extern int      optind;
 
-        while ((c = getopt(argc, argv, "tdDxXYCciIpPnmMeEszrT:l:")) != EOF)
+        while ((c = getopt(argc, argv, "tdDxXYCciIpPfFnmMeEszrT:l:")) != EOF)
                 switch (c) {
                 case 't':
                         do_tty++;
                         break;
                 case 'd':

@@ -1121,10 +1129,16 @@
                         do_partitions++;
                         break;
                 case 'P':
                         do_partitions_only++;
                         break;
+                case 'f':
+                        do_zfs++;
+                        break;
+                case 'F':
+                        do_zfs_only++;
+                        break;
                 case 'n':
                         do_conversions++;
                         break;
                 case 'M':
                         do_megabytes++;