Add some missing vdev properties (#16346)

Sponsored-by: Klara, Inc.
Sponsored-By: Wasabi Technology, Inc.

Signed-off-by: Don Brady <don.brady@klarasystems.com>
Co-authored-by: Don Brady <don.brady@klarasystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
This commit is contained in:
Don Brady 2024-07-23 17:34:09 -06:00 committed by GitHub
parent 6657f89eca
commit fb6d8cf229
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 53 additions and 2 deletions

View File

@ -368,6 +368,9 @@ typedef enum {
VDEV_PROP_RAIDZ_EXPANDING,
VDEV_PROP_SLOW_IO_N,
VDEV_PROP_SLOW_IO_T,
VDEV_PROP_TRIM_SUPPORT,
VDEV_PROP_TRIM_ERRORS,
VDEV_PROP_SLOW_IOS,
VDEV_NUM_PROPS
} vdev_prop_t;

View File

@ -5702,7 +5702,10 @@
<enumerator name='VDEV_PROP_RAIDZ_EXPANDING' value='46'/>
<enumerator name='VDEV_PROP_SLOW_IO_N' value='47'/>
<enumerator name='VDEV_PROP_SLOW_IO_T' value='48'/>
<enumerator name='VDEV_NUM_PROPS' value='49'/>
<enumerator name='VDEV_PROP_TRIM_SUPPORT' value='49'/>
<enumerator name='VDEV_PROP_TRIM_ERRORS' value='50'/>
<enumerator name='VDEV_PROP_SLOW_IOS' value='51'/>
<enumerator name='VDEV_NUM_PROPS' value='52'/>
</enum-decl>
<typedef-decl name='vdev_prop_t' type-id='1573bec8' id='5aa5c90c'/>
<class-decl name='zpool_load_policy' size-in-bits='256' is-struct='yes' visibility='default' id='2f65b36f'>

View File

@ -5225,6 +5225,8 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
case VDEV_PROP_WRITE_ERRORS:
case VDEV_PROP_CHECKSUM_ERRORS:
case VDEV_PROP_INITIALIZE_ERRORS:
case VDEV_PROP_TRIM_ERRORS:
case VDEV_PROP_SLOW_IOS:
case VDEV_PROP_OPS_NULL:
case VDEV_PROP_OPS_READ:
case VDEV_PROP_OPS_WRITE:
@ -5304,6 +5306,11 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
src = fnvlist_lookup_uint64(nv, ZPROP_SOURCE);
intval = fnvlist_lookup_uint64(nv, ZPROP_VALUE);
} else {
/* 'trim_support' only valid for leaf vdevs */
if (prop == VDEV_PROP_TRIM_SUPPORT) {
(void) strlcpy(buf, "-", len);
break;
}
src = ZPROP_SRC_DEFAULT;
intval = vdev_prop_default_numeric(prop);
/* Only use if provided by the RAIDZ VDEV above */

View File

@ -102,8 +102,14 @@ Parent of this vdev
Comma separated list of children of this vdev
.It Sy numchildren
The number of children belonging to this vdev
.It Sy read_errors , write_errors , checksum_errors , initialize_errors
.It Sy read_errors , write_errors , checksum_errors , initialize_errors , trim_errors
The number of errors of each type encountered by this vdev
.It Sy slow_ios
The number of slow I/Os encountered by this vdev,
These represent I/O operations that didn't complete in
.Sy zio_slow_io_ms
milliseconds
.Pq Sy 30000 No by default .
.It Sy null_ops , read_ops , write_ops , free_ops , claim_ops , trim_ops
The number of I/O operations of each type performed by this vdev
.It Xo
@ -113,6 +119,8 @@ The number of I/O operations of each type performed by this vdev
The cumulative size of all operations of each type performed by this vdev
.It Sy removing
If this device is currently being removed from the pool
.It Sy trim_support
Indicates if a leaf device supports trim operations.
.El
.Pp
The following native properties can be used to change the behavior of a vdev.

View File

@ -381,6 +381,12 @@ vdev_prop_init(void)
zprop_register_number(VDEV_PROP_INITIALIZE_ERRORS,
"initialize_errors", 0, PROP_READONLY, ZFS_TYPE_VDEV, "<errors>",
"INITERR", B_FALSE, sfeatures);
zprop_register_number(VDEV_PROP_TRIM_ERRORS, "trim_errors", 0,
PROP_READONLY, ZFS_TYPE_VDEV, "<errors>", "TRIMERR", B_FALSE,
sfeatures);
zprop_register_number(VDEV_PROP_SLOW_IOS, "slow_ios", 0,
PROP_READONLY, ZFS_TYPE_VDEV, "<slowios>", "SLOW", B_FALSE,
sfeatures);
zprop_register_number(VDEV_PROP_OPS_NULL, "null_ops", 0,
PROP_READONLY, ZFS_TYPE_VDEV, "<operations>", "NULLOP", B_FALSE,
sfeatures);
@ -448,6 +454,9 @@ vdev_prop_init(void)
zprop_register_index(VDEV_PROP_RAIDZ_EXPANDING, "raidz_expanding", 0,
PROP_READONLY, ZFS_TYPE_VDEV, "on | off", "RAIDZ_EXPANDING",
boolean_table, sfeatures);
zprop_register_index(VDEV_PROP_TRIM_SUPPORT, "trim_support", 0,
PROP_READONLY, ZFS_TYPE_VDEV, "on | off", "TRIMSUP",
boolean_table, sfeatures);
/* default index properties */
zprop_register_index(VDEV_PROP_FAILFAST, "failfast", B_TRUE,

View File

@ -6222,6 +6222,16 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
vd->vdev_stat.vs_initialize_errors,
ZPROP_SRC_NONE);
continue;
case VDEV_PROP_TRIM_ERRORS:
vdev_prop_add_list(outnvl, propname, NULL,
vd->vdev_stat.vs_trim_errors,
ZPROP_SRC_NONE);
continue;
case VDEV_PROP_SLOW_IOS:
vdev_prop_add_list(outnvl, propname, NULL,
vd->vdev_stat.vs_slow_ios,
ZPROP_SRC_NONE);
continue;
case VDEV_PROP_OPS_NULL:
vdev_prop_add_list(outnvl, propname, NULL,
vd->vdev_stat.vs_ops[ZIO_TYPE_NULL],
@ -6306,6 +6316,14 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
ZPROP_SRC_NONE);
}
continue;
case VDEV_PROP_TRIM_SUPPORT:
/* only valid for leaf vdevs */
if (vd->vdev_ops->vdev_op_leaf) {
vdev_prop_add_list(outnvl, propname,
NULL, vd->vdev_has_trim,
ZPROP_SRC_NONE);
}
continue;
/* Numeric Properites */
case VDEV_PROP_ALLOCATING:
/* Leaf vdevs cannot have this property */

View File

@ -72,4 +72,7 @@ typeset -a properties=(
io_t
slow_io_n
slow_io_t
trim_support
trim_errors
slow_ios
)