Skip to content

Commit 9665f7a

Browse files
author
Rob Wing
committed
zed: use checksum_n, checksum_t, io_n and io_t for tuning the zed
Use these properties to configure thresholds of the serd engine. The semantics of the values are 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 6ceff4f commit 9665f7a

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

cmd/zed/agents/zfs_diagnosis.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@
3939
#include "zfs_agents.h"
4040
#include "fmd_api.h"
4141

42+
/*
43+
* Default values for the serd engine when processing checksum or io errors. The
44+
* semantics are N <events> in T <seconds>.
45+
*/
46+
#define DEFAULT_CHECKSUM_N 10 /* events */
47+
#define DEFAULT_CHECKSUM_T 600 /* seconds */
48+
#define DEFAULT_IO_N 10 /* events */
49+
#define DEFAULT_IO_T 600 /* seconds */
50+
4251
/*
4352
* Our serd engines are named 'zfs_<pool_guid>_<vdev_guid>_{checksum,io}'. This
4453
* #define reserves enough space for two 64-bit hex values plus the length of
@@ -448,6 +457,8 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
448457
zfs_case_t *zcp, *dcp;
449458
int32_t pool_state;
450459
uint64_t ena, pool_guid, vdev_guid;
460+
uint64_t checksum_n, checksum_t;
461+
uint64_t io_n, io_t;
451462
er_timeval_t pool_load;
452463
er_timeval_t er_when;
453464
nvlist_t *detector;
@@ -784,11 +795,21 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
784795
if (fmd_nvl_class_match(hdl, nvl,
785796
ZFS_MAKE_EREPORT(FM_EREPORT_ZFS_IO))) {
786797
if (zcp->zc_data.zc_serd_io[0] == '\0') {
798+
if (nvlist_lookup_uint64(nvl,
799+
FM_EREPORT_PAYLOAD_ZFS_VDEV_IO_N,
800+
&io_n) != 0) {
801+
io_n = DEFAULT_IO_N;
802+
}
803+
if (nvlist_lookup_uint64(nvl,
804+
FM_EREPORT_PAYLOAD_ZFS_VDEV_IO_T,
805+
&io_t) != 0) {
806+
io_t = DEFAULT_IO_T;
807+
}
787808
zfs_serd_name(zcp->zc_data.zc_serd_io,
788809
pool_guid, vdev_guid, "io");
789810
fmd_serd_create(hdl, zcp->zc_data.zc_serd_io,
790-
fmd_prop_get_int32(hdl, "io_N"),
791-
fmd_prop_get_int64(hdl, "io_T"));
811+
io_n,
812+
SEC2NSEC(io_t));
792813
zfs_case_serialize(zcp);
793814
}
794815
if (fmd_serd_record(hdl, zcp->zc_data.zc_serd_io, ep))
@@ -813,12 +834,23 @@ zfs_fm_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class)
813834
}
814835

815836
if (zcp->zc_data.zc_serd_checksum[0] == '\0') {
837+
if (nvlist_lookup_uint64(nvl,
838+
FM_EREPORT_PAYLOAD_ZFS_VDEV_CKSUM_N,
839+
&checksum_n) != 0) {
840+
checksum_n = DEFAULT_CHECKSUM_N;
841+
}
842+
if (nvlist_lookup_uint64(nvl,
843+
FM_EREPORT_PAYLOAD_ZFS_VDEV_CKSUM_T,
844+
&checksum_t) != 0) {
845+
checksum_t = DEFAULT_CHECKSUM_T;
846+
}
847+
816848
zfs_serd_name(zcp->zc_data.zc_serd_checksum,
817849
pool_guid, vdev_guid, "checksum");
818850
fmd_serd_create(hdl,
819851
zcp->zc_data.zc_serd_checksum,
820-
fmd_prop_get_int32(hdl, "checksum_N"),
821-
fmd_prop_get_int64(hdl, "checksum_T"));
852+
checksum_n,
853+
SEC2NSEC(checksum_t));
822854
zfs_case_serialize(zcp);
823855
}
824856
if (fmd_serd_record(hdl,

0 commit comments

Comments
 (0)