bin/143572: The verbose output from iostat does not set the correct column width when multiple pools are displayed.

Rui DeSousa rui at crazybean.net
Fri Feb 5 07:50:01 UTC 2010


>Number:         143572
>Category:       bin
>Synopsis:       The verbose output from iostat does not set the correct column width when multiple pools are displayed.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 05 07:50:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Rui DeSousa
>Release:        FreeBSD 8.0-RELEASE-p2 amd64
>Organization:
>Environment:
System: FreeBSD mordor.crazybean.net 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #1: Thu Jan 7 03:25:04 EST 2010 rui at mordor.crazybean.net:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
The verbose output from iostat uses the last pool to set the max column width 
for cb_namewidth thus if prior pools use larger device names then the output 
is not aligned.  The patch passes the cb_namewidth so that max_width returns 
the max name width of all pools.

                    capacity     operations    bandwidth
pool              used  avail   read  write   read  write
---------------  -----  -----  -----  -----  -----  -----
.
.
.
    gpt/hydra6       -      -      0      5  2.88K   329K
    gpt/hydra7       -      -      0      5  2.77K   329K
  mirror          628K  1.98G      0     20      0  2.51M
    gpt/hydra_zil0      -      -      0     20     34  2.51M
    gpt/hydra_zil1      -      -      0     20     34  2.51M
cache                -      -      -      -      -      -
  gpt/hydra_cache0  8.06G  19.8G      0      2  3.37K   259K
  gpt/hydra_cache1  8.12G  19.7G      0      2  6.21K   261K
---------------  -----  -----  -----  -----  -----  -----
system           5.86G  26.1G      1     14  11.0K   208K
  mirror         5.86G  26.1G      1     14  11.0K   208K
    gpt/system0      -      -      0      9  8.26K   208K
    gpt/system1      -      -      0      9  8.02K   208K
---------------  -----  -----  -----  -----  -----  -----


	
>How-To-Repeat:
1. Create two ZFS pools with the first pool having larger device names.
2. zpool iostat -v 

	
>Fix:
	

--- zpool_main.c.patch begins here ---
--- cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	2008-11-17 15:49:29.000000000 -0500
+++ cddl/contrib/opensolaris/cmd/zpool/zpool_main.c.rui	2010-02-05 01:18:27.780612396 -0500
@@ -1838,7 +1838,7 @@
 		if (!cb->cb_verbose)
 			cb->cb_namewidth = strlen(zpool_get_name(zhp));
 		else
-			cb->cb_namewidth = max_width(zhp, nvroot, 0, 0);
+			cb->cb_namewidth = max_width(zhp, nvroot, 0, cb->cb_namewidth);
 	}
 
 	/*
--- zpool_main.c.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list