Skip to content

Commit

Permalink
Do not force VDEV_NAME_TYPE_ID in max_width().
Browse files Browse the repository at this point in the history
Instead add it in the relevant calls to max_width().

Investigation:

The first location of max_width() where VDEV_NAME_TYPE_ID is now added
in show_import() is followed by print_import_config() and print_logs().
Both these print children vdev names that have been retrived using an
explicit VDEV_NAME_TYPE_ID added.

The second location is in status_callback().  This is followed by
print_status_config(), print_logs(), print_l2cache(), and
print_spares(). For l2cache and spares it should not matter as there are
no mirror-X or raidz-X involved.  print_status_config() as above
retrieves the name using explicit VDEV_NAME_TYPE_ID before calling
itself to print children.

The call of max_width() in get_namewidth() is not changed, as this is
used by zpool_do_iostat(), followed by print_iostat(), which does not
add VDEV_NAME_TYPE_ID.

Overall, perhaps it would be better to add VDEV_NAME_TYPE_ID to the
relevant name_flags / cb_name_flags fields, and remove the explicit
adding in called routines?
  • Loading branch information
inkdot7 committed Oct 8, 2016
1 parent 4f9b664 commit fd440b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max,
uint_t c, children;
int ret;

name = zpool_vdev_name(g_zfs, zhp, nv, name_flags | VDEV_NAME_TYPE_ID);
name = zpool_vdev_name(g_zfs, zhp, nv, name_flags);
if (strlen(name) + depth > max)
max = strlen(name) + depth;

Expand Down Expand Up @@ -2030,7 +2030,7 @@ show_import(nvlist_t *config)

(void) printf(gettext(" config:\n\n"));

namewidth = max_width(NULL, nvroot, 0, 0, 0);
namewidth = max_width(NULL, nvroot, 0, 0, VDEV_NAME_TYPE_ID);
if (namewidth < 10)
namewidth = 10;

Expand Down Expand Up @@ -5981,7 +5981,8 @@ status_callback(zpool_handle_t *zhp, void *data)
ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c);
print_scan_status(ps);

namewidth = max_width(zhp, nvroot, 0, 0, cbp->cb_name_flags);
namewidth = max_width(zhp, nvroot, 0, 0, cbp->cb_name_flags |
VDEV_NAME_TYPE_ID);
if (namewidth < 10)
namewidth = 10;

Expand Down

0 comments on commit fd440b8

Please sign in to comment.