Skip to content

Commit

Permalink
Add some missing vdev properties (#16346)
Browse files Browse the repository at this point in the history
Sponsored-by: Klara, Inc.
Sponsored-By: Wasabi Technology, Inc.

Signed-off-by: Don Brady <[email protected]>
Co-authored-by: Don Brady <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
  • Loading branch information
Don Brady and don-brady authored Jul 23, 2024
1 parent 6657f89 commit fb6d8cf
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 2 deletions.
3 changes: 3 additions & 0 deletions include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 4 additions & 1 deletion lib/libzfs/libzfs.abi
Original file line number Diff line number Diff line change
Expand Up @@ -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'>
Expand Down
7 changes: 7 additions & 0 deletions lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 */
Expand Down
10 changes: 9 additions & 1 deletion man/man7/vdevprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions module/zcommon/zpool_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 18 additions & 0 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ typeset -a properties=(
io_t
slow_io_n
slow_io_t
trim_support
trim_errors
slow_ios
)

0 comments on commit fb6d8cf

Please sign in to comment.