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
This commit is contained in:
Steven Hartland 2012-12-12 16:14:14 +00:00
parent 64b0bf0bb6
commit 7150222c0a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244155
4 changed files with 19 additions and 16 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -48,14 +48,15 @@ TUNABLE_INT("vfs.zfs.zio.exclude_metadata", &zio_exclude_metadata);
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;
}