From rui@crazybean.net  Fri Feb  5 07:45:12 2010
Return-Path: <rui@crazybean.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF597106568B
	for <freebsd-gnats-submit@freebsd.org>; Fri,  5 Feb 2010 07:45:12 +0000 (UTC)
	(envelope-from rui@crazybean.net)
Received: from que31.charter.net (que31.charter.net [209.225.8.23])
	by mx1.freebsd.org (Postfix) with ESMTP id 8D2E38FC0A
	for <freebsd-gnats-submit@freebsd.org>; Fri,  5 Feb 2010 07:45:12 +0000 (UTC)
Received: from imp09 ([10.20.200.9]) by mta11.charter.net
          (InterMail vM.7.09.02.04 201-2219-117-106-20090629) with ESMTP
          id <20100205070733.EVTS8038.mta11.charter.net@imp09>
          for <freebsd-gnats-submit@freebsd.org>;
          Fri, 5 Feb 2010 02:07:33 -0500
Received: from mordor.crazybean.net ([24.151.31.171])
	by imp09 with smtp.charter.net
	id e77U1d00J3hXYqY0577ZLs; Fri, 05 Feb 2010 02:07:33 -0500
Received: by mordor.crazybean.net (Postfix, from userid 1001)
	id 98D6810EA; Fri,  5 Feb 2010 02:05:43 -0500 (EST)
Message-Id: <20100205070543.98D6810EA@mordor.crazybean.net>
Date: Fri,  5 Feb 2010 02:05:43 -0500 (EST)
From: Rui DeSousa <rui@crazybean.net>
Reply-To: Rui DeSousa <rui@crazybean.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: The verbose output from iostat does not set the correct column width when multiple pools are displayed.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         143572
>Category:       bin
>Synopsis:       [zfs] zpool(1): [patch] 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-fs
>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:  Tue Oct 05 22:21:34 UTC 2010
>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@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:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: arundel 
Responsible-Changed-When: Tue Oct 5 22:21:12 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143572 
>Unformatted:
