mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Add zpool status -s (slow I/Os) and -p (parseable)
This patch adds a new slow I/Os (-s) column to zpool status to show the number of VDEV slow I/Os. This is the number of I/Os that didn't complete in zio_slow_io_ms milliseconds. It also adds a new parsable (-p) flag to display exact values. NAME STATE READ WRITE CKSUM SLOW testpool ONLINE 0 0 0 - mirror-0 ONLINE 0 0 0 - loop0 ONLINE 0 0 0 20 loop1 ONLINE 0 0 0 0 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #7756 Closes #6885
This commit is contained in:
committed by
Brian Behlendorf
parent
877d925a9e
commit
ad796b8a3b
+45
-8
@@ -365,8 +365,8 @@ get_usage(zpool_help_t idx)
|
||||
case HELP_RESILVER:
|
||||
return (gettext("\tresilver <pool> ...\n"));
|
||||
case HELP_STATUS:
|
||||
return (gettext("\tstatus [-c [script1,script2,...]] [-gLPvxD]"
|
||||
"[-T d|u] [pool] ... \n"
|
||||
return (gettext("\tstatus [-c [script1,script2,...]] "
|
||||
"[-gLpPsvxD] [-T d|u] [pool] ... \n"
|
||||
"\t [interval [count]]\n"));
|
||||
case HELP_UPGRADE:
|
||||
return (gettext("\tupgrade\n"
|
||||
@@ -1669,10 +1669,12 @@ typedef struct status_cbdata {
|
||||
int cb_namewidth;
|
||||
boolean_t cb_allpools;
|
||||
boolean_t cb_verbose;
|
||||
boolean_t cb_literal;
|
||||
boolean_t cb_explain;
|
||||
boolean_t cb_first;
|
||||
boolean_t cb_dedup_stats;
|
||||
boolean_t cb_print_status;
|
||||
boolean_t cb_print_slow_ios;
|
||||
vdev_cmd_data_list_t *vcdl;
|
||||
} status_cbdata_t;
|
||||
|
||||
@@ -1788,10 +1790,34 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
name, state);
|
||||
|
||||
if (!isspare) {
|
||||
zfs_nicenum(vs->vs_read_errors, rbuf, sizeof (rbuf));
|
||||
zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf));
|
||||
zfs_nicenum(vs->vs_checksum_errors, cbuf, sizeof (cbuf));
|
||||
(void) printf(" %5s %5s %5s", rbuf, wbuf, cbuf);
|
||||
if (cb->cb_literal) {
|
||||
printf(" %5llu %5llu %5llu",
|
||||
(u_longlong_t)vs->vs_read_errors,
|
||||
(u_longlong_t)vs->vs_write_errors,
|
||||
(u_longlong_t)vs->vs_checksum_errors);
|
||||
} else {
|
||||
zfs_nicenum(vs->vs_read_errors, rbuf, sizeof (rbuf));
|
||||
zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf));
|
||||
zfs_nicenum(vs->vs_checksum_errors, cbuf,
|
||||
sizeof (cbuf));
|
||||
printf(" %5s %5s %5s", rbuf, wbuf, cbuf);
|
||||
}
|
||||
|
||||
if (cb->cb_print_slow_ios) {
|
||||
if (children == 0) {
|
||||
/* Only leafs vdevs have slow IOs */
|
||||
zfs_nicenum(vs->vs_slow_ios, rbuf,
|
||||
sizeof (rbuf));
|
||||
} else {
|
||||
snprintf(rbuf, sizeof (rbuf), "-");
|
||||
}
|
||||
|
||||
if (cb->cb_literal)
|
||||
printf(" %5llu", (u_longlong_t)vs->vs_slow_ios);
|
||||
else
|
||||
printf(" %5s", rbuf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT,
|
||||
@@ -7175,6 +7201,9 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
cbp->cb_namewidth, "NAME", "STATE", "READ", "WRITE",
|
||||
"CKSUM");
|
||||
|
||||
if (cbp->cb_print_slow_ios)
|
||||
(void) printf(" %5s", gettext("SLOW"));
|
||||
|
||||
if (cbp->vcdl != NULL)
|
||||
print_cmd_columns(cbp->vcdl, 0);
|
||||
|
||||
@@ -7241,13 +7270,15 @@ status_callback(zpool_handle_t *zhp, void *data)
|
||||
}
|
||||
|
||||
/*
|
||||
* zpool status [-c [script1,script2,...]] [-gLPvx] [-T d|u] [pool] ...
|
||||
* zpool status [-c [script1,script2,...]] [-gLpPsvx] [-T d|u] [pool] ...
|
||||
* [interval [count]]
|
||||
*
|
||||
* -c CMD For each vdev, run command CMD
|
||||
* -g Display guid for individual vdev name.
|
||||
* -L Follow links when resolving vdev path name.
|
||||
* -p Display values in parsable (exact) format.
|
||||
* -P Display full path for vdev name.
|
||||
* -s Display slow IOs column.
|
||||
* -v Display complete error logs
|
||||
* -x Display only pools with potential problems
|
||||
* -D Display dedup status (undocumented)
|
||||
@@ -7266,7 +7297,7 @@ zpool_do_status(int argc, char **argv)
|
||||
char *cmd = NULL;
|
||||
|
||||
/* check options */
|
||||
while ((c = getopt(argc, argv, "c:gLPvxDT:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "c:gLpPsvxDT:")) != -1) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
if (cmd != NULL) {
|
||||
@@ -7298,9 +7329,15 @@ zpool_do_status(int argc, char **argv)
|
||||
case 'L':
|
||||
cb.cb_name_flags |= VDEV_NAME_FOLLOW_LINKS;
|
||||
break;
|
||||
case 'p':
|
||||
cb.cb_literal = B_TRUE;
|
||||
break;
|
||||
case 'P':
|
||||
cb.cb_name_flags |= VDEV_NAME_PATH;
|
||||
break;
|
||||
case 's':
|
||||
cb.cb_print_slow_ios = B_TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
cb.cb_verbose = B_TRUE;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user