kern/173113: Add descriptions to ZFS TRIM sysctls (patch included)
Steven Hartland
steven.hartland at multiplay.co.uk
Fri Oct 26 08:40:01 UTC 2012
>Number: 173113
>Category: kern
>Synopsis: Add descriptions to ZFS TRIM sysctls (patch included)
>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 Oct 26 08:40:00 UTC 2012
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:
More information about the freebsd-bugs
mailing list