MFV r289535: 5767 fix several problems with zfs test suite
Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Approved by: Gordon Ross <gwr@nexenta.com> Author: John Wren Kennedy <john.kennedy@delphix.com> illumos/illumos-gate@52244c0958 In fact, only unrelated part of that commit is applicable: 8. zpool list -v doesn't print spares It also doesn't correctly identify log devices.
This commit is contained in:
commit
ebe70171e0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=289536
@ -2940,6 +2940,9 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
|||||||
uint_t c, children;
|
uint_t c, children;
|
||||||
char *vname;
|
char *vname;
|
||||||
boolean_t scripted = cb->cb_scripted;
|
boolean_t scripted = cb->cb_scripted;
|
||||||
|
uint64_t islog = B_FALSE;
|
||||||
|
boolean_t haslog = B_FALSE;
|
||||||
|
char *dashes = "%-*s - - - - - -\n";
|
||||||
|
|
||||||
verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
|
verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
|
||||||
(uint64_t **)&vs, &c) == 0);
|
(uint64_t **)&vs, &c) == 0);
|
||||||
@ -2990,24 +2993,47 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
|
|||||||
ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole)
|
ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (nvlist_lookup_uint64(child[c],
|
||||||
|
ZPOOL_CONFIG_IS_LOG, &islog) == 0 && islog) {
|
||||||
|
haslog = B_TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE);
|
vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE);
|
||||||
print_list_stats(zhp, vname, child[c], cb, depth + 2);
|
print_list_stats(zhp, vname, child[c], cb, depth + 2);
|
||||||
free(vname);
|
free(vname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (haslog == B_TRUE) {
|
||||||
* Include level 2 ARC devices in iostat output
|
/* LINTED E_SEC_PRINTF_VAR_FMT */
|
||||||
*/
|
(void) printf(dashes, cb->cb_namewidth, "log");
|
||||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE,
|
|
||||||
&child, &children) != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (children > 0) {
|
|
||||||
(void) printf("%-*s - - - - - "
|
|
||||||
"-\n", cb->cb_namewidth, "cache");
|
|
||||||
for (c = 0; c < children; c++) {
|
for (c = 0; c < children; c++) {
|
||||||
vname = zpool_vdev_name(g_zfs, zhp, child[c],
|
if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG,
|
||||||
B_FALSE);
|
&islog) != 0 || !islog)
|
||||||
|
continue;
|
||||||
|
vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE);
|
||||||
|
print_list_stats(zhp, vname, child[c], cb, depth + 2);
|
||||||
|
free(vname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE,
|
||||||
|
&child, &children) == 0 && children > 0) {
|
||||||
|
/* LINTED E_SEC_PRINTF_VAR_FMT */
|
||||||
|
(void) printf(dashes, cb->cb_namewidth, "cache");
|
||||||
|
for (c = 0; c < children; c++) {
|
||||||
|
vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE);
|
||||||
|
print_list_stats(zhp, vname, child[c], cb, depth + 2);
|
||||||
|
free(vname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child,
|
||||||
|
&children) == 0 && children > 0) {
|
||||||
|
/* LINTED E_SEC_PRINTF_VAR_FMT */
|
||||||
|
(void) printf(dashes, cb->cb_namewidth, "spare");
|
||||||
|
for (c = 0; c < children; c++) {
|
||||||
|
vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE);
|
||||||
print_list_stats(zhp, vname, child[c], cb, depth + 2);
|
print_list_stats(zhp, vname, child[c], cb, depth + 2);
|
||||||
free(vname);
|
free(vname);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user