Skip to content

Commit 2a673e7

Browse files
allanjudemmaybee
andauthored
Vdev Properties Feature
Add properties, similar to pool properties, to each vdev. This makes use of the existing per-vdev ZAP that was added as part of device evacuation/removal. A large number of read-only properties are exposed, many of the members of struct vdev_t, that provide useful statistics. Adds support for read-only "removing" vdev property. Adds the "allocating" property that defaults to "on" and can be set to "off" to prevent future allocations from that top-level vdev. Supports user-defined vdev properties. Includes support for properties.vdev in SYSFS. Co-authored-by: Allan Jude <[email protected]> Co-authored-by: Mark Maybee <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Mark Maybee <[email protected]> Signed-off-by: Allan Jude <[email protected]> Closes #11711
1 parent 5f64bf7 commit 2a673e7

33 files changed

+2743
-240
lines changed

cmd/zpool/zpool_iter.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct zpool_list {
6060
uu_avl_t *zl_avl;
6161
uu_avl_pool_t *zl_pool;
6262
zprop_list_t **zl_proplist;
63+
zfs_type_t zl_type;
6364
};
6465

6566
/* ARGSUSED */
@@ -90,8 +91,7 @@ add_pool(zpool_handle_t *zhp, void *data)
9091
if (uu_avl_find(zlp->zl_avl, node, NULL, &idx) == NULL) {
9192
if (zlp->zl_proplist &&
9293
zpool_expand_proplist(zhp, zlp->zl_proplist,
93-
zlp->zl_literal)
94-
!= 0) {
94+
zlp->zl_type, zlp->zl_literal) != 0) {
9595
zpool_close(zhp);
9696
free(node);
9797
return (-1);
@@ -113,7 +113,7 @@ add_pool(zpool_handle_t *zhp, void *data)
113113
* line.
114114
*/
115115
zpool_list_t *
116-
pool_list_get(int argc, char **argv, zprop_list_t **proplist,
116+
pool_list_get(int argc, char **argv, zprop_list_t **proplist, zfs_type_t type,
117117
boolean_t literal, int *err)
118118
{
119119
zpool_list_t *zlp;
@@ -131,6 +131,7 @@ pool_list_get(int argc, char **argv, zprop_list_t **proplist,
131131
zpool_no_memory();
132132

133133
zlp->zl_proplist = proplist;
134+
zlp->zl_type = type;
134135

135136
zlp->zl_literal = literal;
136137

@@ -248,12 +249,14 @@ pool_list_count(zpool_list_t *zlp)
248249
*/
249250
int
250251
for_each_pool(int argc, char **argv, boolean_t unavail,
251-
zprop_list_t **proplist, boolean_t literal, zpool_iter_f func, void *data)
252+
zprop_list_t **proplist, zfs_type_t type, boolean_t literal,
253+
zpool_iter_f func, void *data)
252254
{
253255
zpool_list_t *list;
254256
int ret = 0;
255257

256-
if ((list = pool_list_get(argc, argv, proplist, literal, &ret)) == NULL)
258+
if ((list = pool_list_get(argc, argv, proplist, type, literal,
259+
&ret)) == NULL)
257260
return (1);
258261

259262
if (pool_list_iter(list, unavail, func, data) != 0)
@@ -678,8 +681,8 @@ all_pools_for_each_vdev_run(int argc, char **argv, char *cmd,
678681
vcdl->g_zfs = g_zfs;
679682

680683
/* Gather our list of all vdevs in all pools */
681-
for_each_pool(argc, argv, B_TRUE, NULL, B_FALSE,
682-
all_pools_for_each_vdev_gather_cb, vcdl);
684+
for_each_pool(argc, argv, B_TRUE, NULL, ZFS_TYPE_POOL,
685+
B_FALSE, all_pools_for_each_vdev_gather_cb, vcdl);
683686

684687
/* Run command on all vdevs in all pools */
685688
all_pools_for_each_vdev_run_vcdl(vcdl);

0 commit comments

Comments
 (0)