diff options
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzpool/common/util.c')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzpool/common/util.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzpool/common/util.c b/cddl/contrib/opensolaris/lib/libzpool/common/util.c index 71894c2af290..d2ed31a46832 100644 --- a/cddl/contrib/opensolaris/lib/libzpool/common/util.c +++ b/cddl/contrib/opensolaris/lib/libzpool/common/util.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright (c) 2017, Intel Corporation. */ #include <assert.h> @@ -49,7 +50,6 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) uint_t c, children; char used[6], avail[6]; char rops[6], wops[6], rbytes[6], wbytes[6], rerr[6], werr[6], cerr[6]; - char *prefix = ""; if (indent == 0 && desc != NULL) { (void) printf(" " @@ -59,15 +59,24 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) } if (desc != NULL) { - (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log); - - if (is_log) - prefix = "log "; + char *suffix = "", *bias = NULL; + char bias_suffix[32]; + (void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_IS_LOG, &is_log); + (void) nvlist_lookup_string(nv, ZPOOL_CONFIG_ALLOCATION_BIAS, + &bias); if (nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c) != 0) vs = &v0; + if (bias != NULL) { + (void) snprintf(bias_suffix, sizeof (bias_suffix), + " (%s)", bias); + suffix = bias_suffix; + } else if (is_log) { + suffix = " (log)"; + } + sec = MAX(1, vs->vs_timestamp / NANOSEC); nicenum(vs->vs_alloc, used, sizeof (used)); @@ -84,9 +93,9 @@ show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) (void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n", indent, "", - prefix, - (int)(indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12)), desc, + (int)(indent+strlen(desc)-25-(vs->vs_space ? 0 : 12)), + suffix, vs->vs_space ? 6 : 0, vs->vs_space ? used : "", vs->vs_space ? 6 : 0, vs->vs_space ? avail : "", rops, wops, rbytes, wbytes, rerr, werr, cerr); |