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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/stat/iostat/iostat.c
          +++ new/usr/src/cmd/stat/iostat/iostat.c
↓ open down ↓ 120 lines elided ↑ open up ↑
 121  121  /*
 122  122   * Flags representing arguments from command line
 123  123   */
 124  124  static  uint_t  do_tty;                 /* show tty info (-t) */
 125  125  static  uint_t  do_disk;                /* show disk info per selected */
 126  126                                          /* format (-d, -D, -e, -E, -x -X -Y) */
 127  127  static  uint_t  do_cpu;                 /* show cpu info (-c) */
 128  128  static  uint_t  do_interval;            /* do intervals (-I) */
 129  129  static  int     do_partitions;          /* per-partition stats (-p) */
 130  130  static  int     do_partitions_only;     /* per-partition stats only (-P) */
      131 +static  int     do_zfs;
      132 +static  int     do_zfs_only;
 131  133                                          /* no per-device stats for disks */
 132  134  static  uint_t  do_conversions;         /* display disks as cXtYdZ (-n) */
 133  135  static  uint_t  do_megabytes;           /* display data in MB/sec (-M) */
 134  136  static  uint_t  do_controller;          /* display controller info (-C) */
 135  137  static  uint_t  do_raw;                 /* emit raw format (-r) */
 136  138  static  uint_t  timestamp_fmt = NODATE; /* timestamp  each display (-T) */
 137  139  static  uint_t  do_devid;               /* -E should show devid */
 138  140  
 139  141  /*
 140  142   * Default number of disk drives to be displayed in basic format
↓ open down ↓ 5 lines elided ↑ open up ↑
 146  148  static  uint_t  suppress_state;         /* skip state change messages */
 147  149  static  uint_t  suppress_zero;          /* skip zero valued lines */
 148  150  static  uint_t  show_mountpts;          /* show mount points */
 149  151  static  int     interval;               /* interval (seconds) to output */
 150  152  static  int     iter;                   /* iterations from command line */
 151  153  
 152  154  #define SMALL_SCRATCH_BUFLEN    MAXNAMELEN
 153  155  
 154  156  static int      iodevs_nl;              /* name field width */
 155  157  #define IODEVS_NL_MIN           6       /* not too thin for "device" */
 156      -#define IODEVS_NL_MAX           24      /* but keep full width under 80 */
      158 +#define IODEVS_NL_MAX           64      /* but keep full width under 80 */
 157  159  
 158  160  static  char    disk_header[132];
 159  161  static  uint_t  dh_len;                 /* disk header length for centering */
 160  162  static  int     lineout;                /* data waiting to be printed? */
 161  163  
 162  164  static struct snapshot *newss;
 163  165  static struct snapshot *oldss;
 164  166  static  double  getime;                 /* elapsed time */
 165  167  static  double  percent;                /* 100 / etime */
 166  168  
↓ open down ↓ 51 lines elided ↑ open up ↑
 218  220  
 219  221          /*
 220  222           * iostat historically showed CPU changes, even though
 221  223           * it doesn't provide much useful information
 222  224           */
 223  225          types |= SNAP_CPUS;
 224  226  
 225  227          if (do_disk)
 226  228                  types |= SNAP_IODEVS;
 227  229  
 228      -        if (do_disk && !do_partitions_only)
      230 +        if (do_disk && !do_partitions_only && !do_zfs_only)
 229  231                  df.if_allowed_types |= IODEV_DISK;
 230  232          if (do_disk & DISK_IOPATH_LI) {
 231  233                  df.if_allowed_types |= IODEV_IOPATH_LTI;
 232  234                  types |= SNAP_IOPATHS_LI;
 233  235          }
 234  236          if (do_disk & DISK_IOPATH_LTI) {
 235  237                  df.if_allowed_types |= IODEV_IOPATH_LTI;
 236  238                  types |= SNAP_IOPATHS_LTI;
 237  239          }
 238  240          if (do_disk & DISK_ERROR_MASK)
 239  241                  types |= SNAP_IODEV_ERRORS;
 240  242          if (do_partitions || do_partitions_only)
 241  243                  df.if_allowed_types |= IODEV_PARTITION;
      244 +        if (do_zfs || do_zfs_only)
      245 +                df.if_allowed_types |= IODEV_ZFS;
 242  246          if (do_conversions)
 243  247                  types |= SNAP_IODEV_PRETTY;
 244  248          if (do_devid)
 245  249                  types |= SNAP_IODEV_DEVID;
 246  250          if (do_controller) {
 247  251                  if (!(do_disk & PRINT_VERTICAL) ||
 248  252                      (do_disk & DISK_EXTENDED_ERRORS))
 249  253                          fail(0, "-C can only be used with -e or -x.");
 250  254                  types |= SNAP_CONTROLLERS;
 251  255                  df.if_allowed_types |= IODEV_CONTROLLER;
↓ open down ↓ 705 lines elided ↑ open up ↑
 957  961              "\t\t-I:    report the counts in each interval,\n"
 958  962              "\t\t\tinstead of rates, where applicable\n"
 959  963              "\t\t-l n:  Limit the number of disks to n\n"
 960  964              "\t\t-m:    Display mount points (most useful with -p)\n"
 961  965              "\t\t-M:    Display data throughput in MB/sec "
 962  966              "instead of Kb/sec\n"
 963  967              "\t\t-n:    convert device names to cXdYtZ format\n"
 964  968              "\t\t-p:    report per-partition disk statistics\n"
 965  969              "\t\t-P:    report per-partition disk statistics only,\n"
 966  970              "\t\t\tno per-device disk statistics\n"
      971 +            "\t\t-f:    report ZFS-level statistics for ZFS pool and\n"
      972 +            "\t\t\tindividual vdevs\n"
      973 +            "\t\t-F:    report ZFS pool and individual physical vdevs\n"
      974 +            "\t\t\tstatistics only, no per-device statistics\n"
 967  975              "\t\t-r:    Display data in comma separated format\n"
 968  976              "\t\t-s:    Suppress state change messages\n"
 969  977              "\t\t-T d|u Display a timestamp in date (d) or unix "
 970  978              "time_t (u)\n"
 971  979              "\t\t-t:    display chars read/written to terminals\n"
 972  980              "\t\t-x:    display extended disk statistics\n"
 973  981              "\t\t-X:    display I/O path statistics\n"
 974  982              "\t\t-Y:    display I/O path (I/T/L) statistics\n"
 975  983              "\t\t-z:    Suppress entries with all zero values\n");
 976  984          exit(1);
↓ open down ↓ 98 lines elided ↑ open up ↑
1075 1083  }
1076 1084  
1077 1085  void
1078 1086  do_args(int argc, char **argv)
1079 1087  {
1080 1088          int             c;
1081 1089          int             errflg = 0;
1082 1090          extern char     *optarg;
1083 1091          extern int      optind;
1084 1092  
1085      -        while ((c = getopt(argc, argv, "tdDxXYCciIpPnmMeEszrT:l:")) != EOF)
     1093 +        while ((c = getopt(argc, argv, "tdDxXYCciIpPfFnmMeEszrT:l:")) != EOF)
1086 1094                  switch (c) {
1087 1095                  case 't':
1088 1096                          do_tty++;
1089 1097                          break;
1090 1098                  case 'd':
1091 1099                          do_disk |= DISK_OLD;
1092 1100                          break;
1093 1101                  case 'D':
1094 1102                          do_disk |= DISK_NEW;
1095 1103                          break;
↓ open down ↓ 20 lines elided ↑ open up ↑
1116 1124                          break;
1117 1125                  case 'I':
1118 1126                          do_interval++;
1119 1127                          break;
1120 1128                  case 'p':
1121 1129                          do_partitions++;
1122 1130                          break;
1123 1131                  case 'P':
1124 1132                          do_partitions_only++;
1125 1133                          break;
     1134 +                case 'f':
     1135 +                        do_zfs++;
     1136 +                        break;
     1137 +                case 'F':
     1138 +                        do_zfs_only++;
     1139 +                        break;
1126 1140                  case 'n':
1127 1141                          do_conversions++;
1128 1142                          break;
1129 1143                  case 'M':
1130 1144                          do_megabytes++;
1131 1145                          break;
1132 1146                  case 'e':
1133 1147                          do_disk |= DISK_ERRORS;
1134 1148                          break;
1135 1149                  case 'E':
↓ open down ↓ 636 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX