Skip to content

Commit a2f157d

Browse files
author
Rob Wing
committed
vdev: add checksum_n, checksum_t, io_n, and io_t vdev properties
These properties will be used for tuning the zed. Specifically for configuring the serd engine thresholds of N <errors> in T <seconds>. Sponsored-by: Seagate Technology LLC Submitted-by: Klara, Inc. Signed-off-by: Rob Wing <rob.wing@klarasystems.com>
1 parent fbeb024 commit a2f157d

File tree

7 files changed

+137
-1
lines changed

7 files changed

+137
-1
lines changed

include/sys/fs/zfs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@ typedef enum {
356356
VDEV_PROP_REMOVING,
357357
VDEV_PROP_ALLOCATING,
358358
VDEV_PROP_FAILFAST,
359+
VDEV_PROP_CHECKSUM_N,
360+
VDEV_PROP_CHECKSUM_T,
361+
VDEV_PROP_IO_N,
362+
VDEV_PROP_IO_T,
359363
VDEV_NUM_PROPS
360364
} vdev_prop_t;
361365

include/sys/vdev_impl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,14 @@ struct vdev {
469469
zfs_ratelimit_t vdev_delay_rl;
470470
zfs_ratelimit_t vdev_deadman_rl;
471471
zfs_ratelimit_t vdev_checksum_rl;
472+
473+
/*
474+
* Checksum and IO thresholds for tuning ZED
475+
*/
476+
uint64_t vdev_checksum_n;
477+
uint64_t vdev_checksum_t;
478+
uint64_t vdev_io_n;
479+
uint64_t vdev_io_t;
472480
};
473481

474482
#define VDEV_PAD_SIZE (8 << 10)

lib/libzfs/libzfs.abi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,11 @@
32153215
<enumerator name='VDEV_PROP_REMOVING' value='39'/>
32163216
<enumerator name='VDEV_PROP_ALLOCATING' value='40'/>
32173217
<enumerator name='VDEV_PROP_FAILFAST' value='41'/>
3218-
<enumerator name='VDEV_NUM_PROPS' value='42'/>
3218+
<enumerator name='VDEV_PROP_CHECKSUM_N' value='42'/>
3219+
<enumerator name='VDEV_PROP_CHECKSUM_T' value='43'/>
3220+
<enumerator name='VDEV_PROP_IO_N' value='43'/>
3221+
<enumerator name='VDEV_PROP_IO_T' value='44'/>
3222+
<enumerator name='VDEV_NUM_PROPS' value='45'/>
32193223
</enum-decl>
32203224
<typedef-decl name='vdev_prop_t' type-id='1573bec8' id='5aa5c90c'/>
32213225
<enum-decl name='vdev_state' id='21566197'>

lib/libzfs/libzfs_pool.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5011,6 +5011,17 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name,
50115011
(u_longlong_t)intval);
50125012
}
50135013
break;
5014+
case VDEV_PROP_CHECKSUM_N:
5015+
case VDEV_PROP_CHECKSUM_T:
5016+
case VDEV_PROP_IO_N:
5017+
case VDEV_PROP_IO_T:
5018+
if (intval == UINT64_MAX) {
5019+
(void) strlcpy(buf, "-", len);
5020+
} else {
5021+
(void) snprintf(buf, len, "%llu",
5022+
(u_longlong_t)intval);
5023+
}
5024+
break;
50145025
case VDEV_PROP_FRAGMENTATION:
50155026
if (intval == UINT64_MAX) {
50165027
(void) strlcpy(buf, "-", len);

lib/libzfs/libzfs_util.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,6 +1681,18 @@ zprop_parse_value(libzfs_handle_t *hdl, nvpair_t *elem, int prop,
16811681
*ivalp = UINT64_MAX;
16821682
}
16831683

1684+
/*
1685+
* Special handling for "checksum_*=none". In this case it's not
1686+
* 0 but UINT64_MAX.
1687+
*/
1688+
if ((type & ZFS_TYPE_VDEV) && isnone &&
1689+
(prop == VDEV_PROP_CHECKSUM_N ||
1690+
prop == VDEV_PROP_CHECKSUM_T ||
1691+
prop == VDEV_PROP_IO_N ||
1692+
prop == VDEV_PROP_IO_T)) {
1693+
*ivalp = UINT64_MAX;
1694+
}
1695+
16841696
/*
16851697
* Special handling for setting 'refreservation' to 'auto'. Use
16861698
* UINT64_MAX to tell the caller to use zfs_fix_auto_resv().

module/zcommon/zpool_prop.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,18 @@ vdev_prop_init(void)
410410
sfeatures);
411411

412412
/* default numeric properties */
413+
zprop_register_number(VDEV_PROP_CHECKSUM_N, "checksum_n", UINT64_MAX,
414+
PROP_DEFAULT, ZFS_TYPE_VDEV, "<events>", "CKSUM_N", B_FALSE,
415+
sfeatures);
416+
zprop_register_number(VDEV_PROP_CHECKSUM_T, "checksum_t", UINT64_MAX,
417+
PROP_DEFAULT, ZFS_TYPE_VDEV, "<seconds>", "CKSUM_T", B_FALSE,
418+
sfeatures);
419+
zprop_register_number(VDEV_PROP_IO_N, "io_n", UINT64_MAX,
420+
PROP_DEFAULT, ZFS_TYPE_VDEV, "<events>", "IO_N", B_FALSE,
421+
sfeatures);
422+
zprop_register_number(VDEV_PROP_IO_T, "io_t", UINT64_MAX,
423+
PROP_DEFAULT, ZFS_TYPE_VDEV, "<seconds>", "IO_T", B_FALSE,
424+
sfeatures);
413425

414426
/* default index (boolean) properties */
415427
zprop_register_index(VDEV_PROP_REMOVING, "removing", 0,

module/zfs/vdev.c

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,14 @@ vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid, vdev_ops_t *ops)
667667
zfs_ratelimit_init(&vd->vdev_checksum_rl,
668668
&zfs_checksum_events_per_second, 1);
669669

670+
/*
671+
* Default Thresholds for tuning ZED
672+
*/
673+
vd->vdev_checksum_n = vdev_prop_default_numeric(VDEV_PROP_CHECKSUM_N);
674+
vd->vdev_checksum_t = vdev_prop_default_numeric(VDEV_PROP_CHECKSUM_T);
675+
vd->vdev_io_n = vdev_prop_default_numeric(VDEV_PROP_IO_N);
676+
vd->vdev_io_t = vdev_prop_default_numeric(VDEV_PROP_IO_T);
677+
670678
list_link_init(&vd->vdev_config_dirty_node);
671679
list_link_init(&vd->vdev_state_dirty_node);
672680
list_link_init(&vd->vdev_initialize_node);
@@ -3622,6 +3630,39 @@ vdev_load(vdev_t *vd)
36223630
}
36233631
}
36243632

3633+
if (vd->vdev_top_zap != 0 || vd->vdev_leaf_zap != 0) {
3634+
uint64_t zapobj;
3635+
3636+
if (vd->vdev_top_zap != 0)
3637+
zapobj = vd->vdev_top_zap;
3638+
else
3639+
zapobj = vd->vdev_leaf_zap;
3640+
3641+
error = vdev_prop_get_int(vd, VDEV_PROP_CHECKSUM_N,
3642+
&vd->vdev_checksum_n);
3643+
if (error && error != ENOENT)
3644+
vdev_dbgmsg(vd, "vdev_load: zap_lookup(zap=%llu) "
3645+
"failed [error=%d]", (u_longlong_t)zapobj, error);
3646+
3647+
error = vdev_prop_get_int(vd, VDEV_PROP_CHECKSUM_T,
3648+
&vd->vdev_checksum_t);
3649+
if (error && error != ENOENT)
3650+
vdev_dbgmsg(vd, "vdev_load: zap_lookup(zap=%llu) "
3651+
"failed [error=%d]", (u_longlong_t)zapobj, error);
3652+
3653+
error = vdev_prop_get_int(vd, VDEV_PROP_IO_N,
3654+
&vd->vdev_io_n);
3655+
if (error && error != ENOENT)
3656+
vdev_dbgmsg(vd, "vdev_load: zap_lookup(zap=%llu) "
3657+
"failed [error=%d]", (u_longlong_t)zapobj, error);
3658+
3659+
error = vdev_prop_get_int(vd, VDEV_PROP_IO_T,
3660+
&vd->vdev_io_t);
3661+
if (error && error != ENOENT)
3662+
vdev_dbgmsg(vd, "vdev_load: zap_lookup(zap=%llu) "
3663+
"failed [error=%d]", (u_longlong_t)zapobj, error);
3664+
}
3665+
36253666
/*
36263667
* If this is a top-level vdev, initialize its metaslabs.
36273668
*/
@@ -5761,6 +5802,34 @@ vdev_prop_set(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
57615802
}
57625803
vd->vdev_failfast = intval & 1;
57635804
break;
5805+
case VDEV_PROP_CHECKSUM_N:
5806+
if (nvpair_value_uint64(elem, &intval) != 0) {
5807+
error = EINVAL;
5808+
break;
5809+
}
5810+
vd->vdev_checksum_n = intval;
5811+
break;
5812+
case VDEV_PROP_CHECKSUM_T:
5813+
if (nvpair_value_uint64(elem, &intval) != 0) {
5814+
error = EINVAL;
5815+
break;
5816+
}
5817+
vd->vdev_checksum_t = intval;
5818+
break;
5819+
case VDEV_PROP_IO_N:
5820+
if (nvpair_value_uint64(elem, &intval) != 0) {
5821+
error = EINVAL;
5822+
break;
5823+
}
5824+
vd->vdev_io_n = intval;
5825+
break;
5826+
case VDEV_PROP_IO_T:
5827+
if (nvpair_value_uint64(elem, &intval) != 0) {
5828+
error = EINVAL;
5829+
break;
5830+
}
5831+
vd->vdev_io_t = intval;
5832+
break;
57645833
default:
57655834
/* Most processing is done in vdev_props_set_sync */
57665835
break;
@@ -6090,6 +6159,22 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
60906159
vdev_prop_add_list(outnvl, propname, strval,
60916160
intval, src);
60926161
break;
6162+
case VDEV_PROP_CHECKSUM_N:
6163+
case VDEV_PROP_CHECKSUM_T:
6164+
case VDEV_PROP_IO_N:
6165+
case VDEV_PROP_IO_T:
6166+
err = vdev_prop_get_int(vd, prop, &intval);
6167+
if (err && err != ENOENT)
6168+
break;
6169+
6170+
if (intval == vdev_prop_default_numeric(prop))
6171+
src = ZPROP_SRC_DEFAULT;
6172+
else
6173+
src = ZPROP_SRC_LOCAL;
6174+
6175+
vdev_prop_add_list(outnvl, propname, NULL,
6176+
intval, src);
6177+
break;
60936178
/* Text Properties */
60946179
case VDEV_PROP_COMMENT:
60956180
/* Exists in the ZAP below */

0 commit comments

Comments
 (0)