1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Tony Hutter <hutter2@llnl.gov>
3 Date: Sun, 4 Mar 2018 17:34:51 -0800
4 Subject: [PATCH] Change checksum & IO delay ratelimit values
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Change checksum & IO delay ratelimit thresholds from 5/sec to 20/sec.
10 This allows zed to actually trigger if a bunch of these events arrive in
11 a short period of time (zed has a threshold of 10 events in 10 sec).
12 Previously, if you had, say, 100 checksum errors in 1 sec, it would get
13 ratelimited to 5/sec which wouldn't trigger zed to fault the drive.
15 Also, convert the checksum and IO delay thresholds to module params for
18 Reviewed-by: loli10K <ezomori.nozomu@gmail.com>
19 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
20 Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
21 Signed-off-by: Tony Hutter <hutter2@llnl.gov>
23 (cherry picked from commit 6dc40e2ada2d0d008bd314ff3525f2b0acc2bb01)
24 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
26 include/sys/vdev_impl.h | 2 --
27 include/sys/zfs_ratelimit.h | 12 +++++++++---
28 module/zcommon/zfs_comutil.c | 4 ++--
29 module/zfs/vdev.c | 23 +++++++++++++++++++++--
30 man/man5/zfs-module-parameters.5 | 39 +++++++++++++++++++++++++++++++++++++++
31 5 files changed, 71 insertions(+), 9 deletions(-)
33 diff --git a/include/sys/vdev_impl.h b/include/sys/vdev_impl.h
34 index 13c495822..4f9f1a903 100644
35 --- a/include/sys/vdev_impl.h
36 +++ b/include/sys/vdev_impl.h
37 @@ -255,8 +255,6 @@ struct vdev {
38 * We rate limit ZIO delay and ZIO checksum events, since they
39 * can flood ZED with tons of events when a drive is acting up.
41 -#define DELAYS_PER_SECOND 5
42 -#define CHECKSUMS_PER_SECOND 5
43 zfs_ratelimit_t vdev_delay_rl;
44 zfs_ratelimit_t vdev_checksum_rl;
46 diff --git a/include/sys/zfs_ratelimit.h b/include/sys/zfs_ratelimit.h
47 index f36e07841..012825fad 100644
48 --- a/include/sys/zfs_ratelimit.h
49 +++ b/include/sys/zfs_ratelimit.h
54 - unsigned int burst; /* Number to allow per interval */
55 - unsigned int interval; /* Interval length in seconds */
58 + * Pointer to number of events per interval. We do this to
59 + * allow the burst to be a (changeable) module parameter.
61 + unsigned int *burst;
63 + unsigned int interval; /* Interval length in seconds */
67 int zfs_ratelimit(zfs_ratelimit_t *rl);
68 -void zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int burst,
69 +void zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int *burst,
70 unsigned int interval);
71 void zfs_ratelimit_fini(zfs_ratelimit_t *rl);
73 diff --git a/module/zcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c
74 index 52cb7e365..44cdc8523 100644
75 --- a/module/zcommon/zfs_comutil.c
76 +++ b/module/zcommon/zfs_comutil.c
77 @@ -215,7 +215,7 @@ const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = {
78 * interval: Interval time in seconds
81 -zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int burst,
82 +zfs_ratelimit_init(zfs_ratelimit_t *rl, unsigned int *burst,
83 unsigned int interval)
86 @@ -270,7 +270,7 @@ zfs_ratelimit(zfs_ratelimit_t *rl)
90 - if (rl->count >= rl->burst) {
91 + if (rl->count >= *rl->burst) {
92 rc = 0; /* We're ratelimiting */
95 diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
96 index df07d893d..0786fbb83 100644
97 --- a/module/zfs/vdev.c
98 +++ b/module/zfs/vdev.c
101 int metaslabs_per_vdev = 200;
104 + * Rate limit delay events to this many IO delays per second.
106 +unsigned int zfs_delays_per_second = 20;
109 + * Rate limit checksum events after this many checksum errors per second.
111 +unsigned int zfs_checksums_per_second = 20;
114 * Virtual device management.
116 @@ -357,8 +367,8 @@ vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid, vdev_ops_t *ops)
117 * and checksum events so that we don't overwhelm ZED with thousands
118 * of events when a disk is acting up.
120 - zfs_ratelimit_init(&vd->vdev_delay_rl, DELAYS_PER_SECOND, 1);
121 - zfs_ratelimit_init(&vd->vdev_checksum_rl, CHECKSUMS_PER_SECOND, 1);
122 + zfs_ratelimit_init(&vd->vdev_delay_rl, &zfs_delays_per_second, 1);
123 + zfs_ratelimit_init(&vd->vdev_checksum_rl, &zfs_checksums_per_second, 1);
125 list_link_init(&vd->vdev_config_dirty_node);
126 list_link_init(&vd->vdev_state_dirty_node);
127 @@ -3776,5 +3786,14 @@ module_param(metaslabs_per_vdev, int, 0644);
128 MODULE_PARM_DESC(metaslabs_per_vdev,
129 "Divide added vdev into approximately (but no more than) this number "
132 +module_param(zfs_delays_per_second, uint, 0644);
133 +MODULE_PARM_DESC(zfs_delays_per_second, "Rate limit delay events to this many "
134 + "IO delays per second");
136 +module_param(zfs_checksums_per_second, uint, 0644);
137 + MODULE_PARM_DESC(zfs_checksums_per_second, "Rate limit checksum events "
138 + "to this many checksum errors per second (do not set below zed"
142 diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5
143 index d4daffde6..8d5ac2576 100644
144 --- a/man/man5/zfs-module-parameters.5
145 +++ b/man/man5/zfs-module-parameters.5
146 @@ -739,6 +739,34 @@ Disable pool import at module load by ignoring the cache file (typically \fB/etc
147 Use \fB1\fR for yes (default) and \fB0\fR for no.
153 +\fBzfs_checksums_per_second\fR (int)
156 +Rate limit checksum events to this many per second. Note that this should
157 +not be set below the zed thresholds (currently 10 checksums over 10 sec)
158 +or else zed may not trigger any action.
166 +\fBzfs_commit_timeout_pct\fR (int)
169 +This controls the amount of time that a ZIL block (lwb) will remain "open"
170 +when it isn't "full", and it has a thread waiting for it to be committed to
171 +stable storage. The timeout is scaled based on a percentage of the last lwb
172 +latency to avoid significantly impacting the latency of each individual
173 +transaction record (itx).
175 +Default value: \fB5\fR%.
181 @@ -866,6 +894,17 @@ Note: \fBzfs_delay_scale\fR * \fBzfs_dirty_data_max\fR must be < 2^64.
182 Default value: \fB500,000\fR.
188 +\fBzfs_delays_per_second\fR (int)
191 +Rate limit IO delay events to this many per second.