Skip to content

Commit

Permalink
zpool iostat -S shows which vdevs are ssd, hdd or mixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
inkdot7 committed Oct 8, 2016
1 parent 1903075 commit 4f9b664
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
42 changes: 39 additions & 3 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ get_usage(zpool_help_t idx) {
"[-R root] [-F [-n]]\n"
"\t <pool | id> [newpool]\n"));
case HELP_IOSTAT:
return (gettext("\tiostat [-T d | u] [-ghHLpPvy] "
return (gettext("\tiostat [-T d | u] [-ghHLpPSvy] "
"[[-lq]|[-r|-w]]\n"
"\t [[pool ...]|[pool vdev ...]|[vdev ...]] "
"[interval [count]]\n"));
Expand Down Expand Up @@ -2571,6 +2571,7 @@ typedef struct iostat_cbdata {
boolean_t cb_verbose;
boolean_t cb_literal;
boolean_t cb_scripted;
boolean_t cb_rotational;
zpool_list_t *cb_list;
} iostat_cbdata_t;

Expand Down Expand Up @@ -2786,6 +2787,9 @@ print_iostat_dashes(iostat_cbdata_t *cb, unsigned int force_column_width,
(void) printf("-");
}

if (cb->cb_rotational)
printf(" -");

/* For each bit in flags */
for (f = flags; f; f &= ~(1ULL << idx)) {
unsigned int column_width;
Expand Down Expand Up @@ -2845,10 +2849,16 @@ print_iostat_header_impl(iostat_cbdata_t *cb, unsigned int force_column_width,
printf("%*s", namewidth, "");


if (cb->cb_rotational)
printf(" N");

print_iostat_labels(cb, force_column_width, iostat_top_labels);

printf("%-*s", namewidth, title);

if (cb->cb_rotational)
printf(" R");

print_iostat_labels(cb, force_column_width, iostat_bottom_labels);

print_iostat_separator_impl(cb, force_column_width);
Expand Down Expand Up @@ -3348,6 +3358,26 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
(int)(cb->cb_namewidth - strlen(name) -
depth), "");
}
if (cb->cb_rotational) {
if (cb->cb_scripted)
printf("\t");
else
printf(" ");
switch (newvs->vs_nonrotational) {
case VDEV_NONROTATIONAL_YES:
(void) printf("y");
break;
case VDEV_NONROTATIONAL_MIXED:
(void) printf("m");
break;
case VDEV_NONROTATIONAL_NO:
(void) printf("n");
break;
default:
(void) printf("?");
break;
}
}
}

/* Calculate our scaling factor */
Expand Down Expand Up @@ -3910,7 +3940,7 @@ fsleep(float sec) {


/*
* zpool iostat [-ghHLpPvy] [[-lq]|[-r|-w]] [-n name] [-T d|u]
* zpool iostat [-ghHLpPSvy] [[-lq]|[-r|-w]] [-n name] [-T d|u]
* [[ pool ...]|[pool vdev ...]|[vdev ...]]
* [interval [count]]
*
Expand All @@ -3926,6 +3956,7 @@ fsleep(float sec) {
* -q Display queue depths
* -w Display latency histograms
* -r Display request size histogram
* -S Display marker for solid-state based devices, and mixed.
* -T Display a timestamp in date(1) or Unix format
*
* This command can be tricky because we want to be able to deal with pool
Expand All @@ -3950,6 +3981,7 @@ zpool_do_iostat(int argc, char **argv)
boolean_t guid = B_FALSE;
boolean_t follow_links = B_FALSE;
boolean_t full_name = B_FALSE;
boolean_t rotational = B_FALSE;
iostat_cbdata_t cb = { 0 };

/* Used for printing error message */
Expand All @@ -3959,7 +3991,7 @@ zpool_do_iostat(int argc, char **argv)
uint64_t unsupported_flags;

/* check options */
while ((c = getopt(argc, argv, "gLPT:vyhplqrwH")) != -1) {
while ((c = getopt(argc, argv, "gLPT:vyhplqrSwH")) != -1) {
switch (c) {
case 'g':
guid = B_TRUE;
Expand Down Expand Up @@ -3994,6 +4026,9 @@ zpool_do_iostat(int argc, char **argv)
case 'r':
rq_histo = B_TRUE;
break;
case 'S':
rotational = B_TRUE;
break;
case 'y':
omit_since_boot = B_TRUE;
break;
Expand Down Expand Up @@ -4022,6 +4057,7 @@ zpool_do_iostat(int argc, char **argv)
cb.cb_iteration = 0;
cb.cb_namewidth = 0;
cb.cb_verbose = verbose;
cb.cb_rotational = rotational;

/* Get our interval and count values (if any) */
if (guid) {
Expand Down
13 changes: 11 additions & 2 deletions man/man8/zpool.8
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ zpool \- configures ZFS storage pools

.LP
.nf
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-ghHLpPvy\fR] [\fB-lq\fR]|[\fB-r\fR|-\fBw\fR]]
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-ghHLpPSvy\fR] [\fB-lq\fR]|[\fB-r\fR|-\fBw\fR]]
[[\fIpool\fR ...]|[\fIpool vdev\fR ...]|[\fIvdev\fR ...]] [\fIinterval\fR[\fIcount\fR]]\fR

.fi
Expand Down Expand Up @@ -1510,7 +1510,7 @@ Scan using the default search path, the libblkid cache will not be consulted. A
.sp
.ne 2
.na
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-ghHLpPvy\fR] [[\fB-lq\fR]|[\fB-r\fR|\fB-w\fR]] [[\fIpool\fR ...]|[\fIpool vdev\fR ...]|[\fIvdev\fR ...]] [\fIinterval\fR[\fIcount\fR]]\fR
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-ghHLpPSvy\fR] [[\fB-lq\fR]|[\fB-r\fR|\fB-w\fR]] [[\fIpool\fR ...]|[\fIpool vdev\fR ...]|[\fIvdev\fR ...]] [\fIinterval\fR[\fIcount\fR]]\fR

.ad
.sp .6
Expand Down Expand Up @@ -1595,6 +1595,15 @@ request size stats with the block layer requests; it's possible ZIOs can
be broken up before being sent to the block device.
.RE

.sp
.ne 2
.na
\fB\fB-S\fR\fR
.ad
.RS 12n
Display whether a pool or vdev is based on solid-state devices, i.e. non-rotational, marked with a "y". Other devices are marked with "n". Mixed mirrored devices that have at least one solid-state member are marked "m". A pool is considered mixed if all members are at least mixed.
.RE

.sp
.ne 2
.na
Expand Down

0 comments on commit 4f9b664

Please sign in to comment.