From nobody@FreeBSD.org  Fri Oct 26 08:36:21 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 27CB41A4
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Oct 2012 08:36:21 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 0C7D78FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Oct 2012 08:36:21 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q9Q8aKmR086259
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 26 Oct 2012 08:36:20 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q9Q8aK4Z086258;
	Fri, 26 Oct 2012 08:36:20 GMT
	(envelope-from nobody)
Message-Id: <201210260836.q9Q8aK4Z086258@red.freebsd.org>
Date: Fri, 26 Oct 2012 08:36:20 GMT
From: Steven Hartland <steven.hartland@multiplay.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add descriptions to ZFS TRIM sysctls (patch included)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173113
>Category:       kern
>Synopsis:       Add descriptions to ZFS TRIM sysctls (patch included)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    smh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 26 08:40:00 UTC 2012
>Closed-Date:    Fri Jun 07 15:01:45 UTC 2013
>Last-Modified:  Fri Jun 07 15:01:45 UTC 2013
>Originator:     Steven Hartland
>Release:        8.3-RELEASE
>Organization:
Multiplay
>Environment:
FreeBSD dev 8.3-RELEASE-p4 FreeBSD 8.3-RELEASE-p4 #22: Mon Sep 17 17:18:32 UTC 2012     root@dev:/usr/obj/usr/src/sys/MULTIPLAY  amd64
>Description:
Patch which adds description support to opensolaris sysctl stats.

Adds descriptions for the new ZFS TRIM stats.

Also removes duplicate zio_trim parts from identifier.

>How-To-Repeat:
N/A
>Fix:
Apply the attached patch

Patch attached with submission follows:

Renamed zfs trim stats removing duplicate zio_trim identifier from the name
Added description option to kstats.
Added descriptions for zio_trim kstats
--- sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c.orig	2012-10-25 21:21:30.619929627 +0000
+++ sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c	2012-10-25 21:35:15.540025058 +0000
@@ -118,7 +118,7 @@
 		SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
 		    SYSCTL_CHILDREN(ksp->ks_sysctl_root), OID_AUTO, ksent->name,
 		    CTLTYPE_QUAD | CTLFLAG_RD, ksent, sizeof(*ksent),
-		    kstat_sysctl, "QU", "");
+		    kstat_sysctl, "QU", ksent->desc);
 	}
 }
 
--- sys/cddl/compat/opensolaris/sys/kstat.h.orig	2012-10-25 21:19:45.151906457 +0000
+++ sys/cddl/compat/opensolaris/sys/kstat.h	2012-10-25 21:30:42.595989713 +0000
@@ -53,6 +53,8 @@
 #define	KSTAT_DATA_INT64	3
 #define	KSTAT_DATA_UINT64	4
 	uchar_t	data_type;
+#define	KSTAT_DESCLEN	128
+	char	desc[KSTAT_DESCLEN];
 	union {
 		uint64_t	ui64;
 	} value;
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h.orig	2012-10-25 21:08:34.369771576 +0000
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	2012-10-25 21:09:21.595777954 +0000
@@ -359,23 +359,23 @@
 	/*
 	 * Number of bytes successfully TRIMmed.
 	 */
-	kstat_named_t zio_trim_bytes;
+	kstat_named_t bytes;
 
 	/*
 	 * Number of successful TRIM requests.
 	 */
-	kstat_named_t zio_trim_success;
+	kstat_named_t success;
 
 	/*
 	 * Number of TRIM requests that failed because TRIM is not
 	 * supported.
 	 */
-	kstat_named_t zio_trim_unsupported;
+	kstat_named_t unsupported;
 
 	/*
 	 * Number of TRIM requests that failed for other reasons.
 	 */
-	kstat_named_t zio_trim_failed;
+	kstat_named_t failed;
 } zio_trim_stats_t;
 
 extern zio_trim_stats_t zio_trim_stats;
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c.orig	2012-10-25 21:03:26.967732770 +0000
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	2012-10-25 22:10:25.871594713 +0000
@@ -44,14 +44,15 @@
 SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, use_uma, CTLFLAG_RDTUN, &zio_use_uma, 0,
     "Use uma(9) for ZIO allocations");
 
-/*
- * See zio.h for more information about these fields.
- */
 zio_trim_stats_t zio_trim_stats = {
-	{ "zio_trim_bytes",		KSTAT_DATA_UINT64 },
-	{ "zio_trim_success",		KSTAT_DATA_UINT64 },
-	{ "zio_trim_unsupported",	KSTAT_DATA_UINT64 },
-	{ "zio_trim_failed",		KSTAT_DATA_UINT64 },
+	{ "bytes",		KSTAT_DATA_UINT64,
+	  "Number of bytes successfully TRIMmed" },
+	{ "success",		KSTAT_DATA_UINT64,
+	  "Number of successful TRIM requests" },
+	{ "unsupported",	KSTAT_DATA_UINT64,
+	  "Number of TRIM requests that failed because TRIM is not supported" },
+	{ "failed",		KSTAT_DATA_UINT64,
+	  "Number of TRIM requests that failed for reasons other than not supported" },
 };
 
 static kstat_t *zio_trim_ksp;
@@ -2536,14 +2537,14 @@
 	if (zio->io_type == ZIO_TYPE_IOCTL && zio->io_cmd == DKIOCTRIM)
 		switch (zio->io_error) {
 		case 0:
-			ZIO_TRIM_STAT_INCR(zio_trim_bytes, zio->io_size);
-			ZIO_TRIM_STAT_BUMP(zio_trim_success);
+			ZIO_TRIM_STAT_INCR(bytes, zio->io_size);
+			ZIO_TRIM_STAT_BUMP(success);
 			break;
 		case EOPNOTSUPP:
-			ZIO_TRIM_STAT_BUMP(zio_trim_unsupported);
+			ZIO_TRIM_STAT_BUMP(unsupported);
 			break;
 		default:
-			ZIO_TRIM_STAT_BUMP(zio_trim_failed);
+			ZIO_TRIM_STAT_BUMP(failed);
 			break;
 		}
 


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->smh 
Responsible-Changed-By: smh 
Responsible-Changed-When: Tue Dec 11 14:08:21 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173113 
State-Changed-From-To: open->patched 
State-Changed-By: smh 
State-Changed-When: Wed Dec 12 16:36:38 UTC 2012 
State-Changed-Why:  
awaiting MFC 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173113 
State-Changed-From-To: patched->closed 
State-Changed-By: smh 
State-Changed-When: Fri Jun 7 15:01:44 UTC 2013 
State-Changed-Why:  
Committed. Thanks! 

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