svn commit: r244155 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys

Steven Hartland smh at FreeBSD.org
Wed Dec 12 16:14:15 UTC 2012


Author: smh
Date: Wed Dec 12 16:14:14 2012
New Revision: 244155
URL: http://svnweb.freebsd.org/changeset/base/244155

Log:
  Renamed zfs trim stats removing duplicate zio_trim identifier from the name
  Added description option to kstats.
  Added descriptions for zio_trim kstats
  
  PR:		kern/173113
  Submitted by:	Steven Hartland
  Reviewed by:	pjd
  Approved by:	pjd
  MFC after:	2 weeks

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
  head/sys/cddl/compat/opensolaris/sys/kstat.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c
==============================================================================
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c	Wed Dec 12 15:45:03 2012	(r244154)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kstat.c	Wed Dec 12 16:14:14 2012	(r244155)
@@ -118,7 +118,7 @@ kstat_install(kstat_t *ksp)
 		SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
 		    SYSCTL_CHILDREN(ksp->ks_sysctl_root), OID_AUTO, ksent->name,
 		    CTLTYPE_U64 | CTLFLAG_RD, ksent, sizeof(*ksent),
-		    kstat_sysctl, "QU", "");
+		    kstat_sysctl, "QU", ksent->desc);
 	}
 }
 

Modified: head/sys/cddl/compat/opensolaris/sys/kstat.h
==============================================================================
--- head/sys/cddl/compat/opensolaris/sys/kstat.h	Wed Dec 12 15:45:03 2012	(r244154)
+++ head/sys/cddl/compat/opensolaris/sys/kstat.h	Wed Dec 12 16:14:14 2012	(r244155)
@@ -53,6 +53,8 @@ typedef struct kstat_named {
 #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;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Wed Dec 12 15:45:03 2012	(r244154)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h	Wed Dec 12 16:14:14 2012	(r244155)
@@ -372,23 +372,23 @@ typedef struct zio_trim_stats {
 	/*
 	 * 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;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Wed Dec 12 15:45:03 2012	(r244154)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Wed Dec 12 16:14:14 2012	(r244155)
@@ -48,14 +48,15 @@ TUNABLE_INT("vfs.zfs.zio.exclude_metadat
 SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, exclude_metadata, CTLFLAG_RDTUN, &zio_exclude_metadata, 0,
     "Exclude metadata buffers from dumps as well");
 
-/*
- * 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;
@@ -2660,14 +2661,14 @@ zio_vdev_io_assess(zio_t *zio)
 	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;
 		}
 


More information about the svn-src-all mailing list