]> git.proxmox.com Git - zfsonlinux.git/blob - zfs-patches/0046-Change-checksum-IO-delay-ratelimit-values.patch
revert potentially buggy zap_add change
[zfsonlinux.git] / zfs-patches / 0046-Change-checksum-IO-delay-ratelimit-values.patch
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
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
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.
14
15 Also, convert the checksum and IO delay thresholds to module params for
16 easy testing.
17
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>
22 Closes #7252
23 (cherry picked from commit 6dc40e2ada2d0d008bd314ff3525f2b0acc2bb01)
24 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
25 ---
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(-)
32
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.
40 */
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;
45 };
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
50 @@ -25,13 +25,19 @@
51 typedef struct {
52 hrtime_t start;
53 unsigned int count;
54 - unsigned int burst; /* Number to allow per interval */
55 - unsigned int interval; /* Interval length in seconds */
56 +
57 + /*
58 + * Pointer to number of events per interval. We do this to
59 + * allow the burst to be a (changeable) module parameter.
60 + */
61 + unsigned int *burst;
62 +
63 + unsigned int interval; /* Interval length in seconds */
64 kmutex_t lock;
65 } zfs_ratelimit_t;
66
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);
72
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
79 */
80 void
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)
84 {
85 rl->count = 0;
86 @@ -270,7 +270,7 @@ zfs_ratelimit(zfs_ratelimit_t *rl)
87 rl->start = now;
88 rl->count = 0;
89 } else {
90 - if (rl->count >= rl->burst) {
91 + if (rl->count >= *rl->burst) {
92 rc = 0; /* We're ratelimiting */
93 }
94 }
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
99 @@ -56,6 +56,16 @@
100 */
101 int metaslabs_per_vdev = 200;
102
103 +/*
104 + * Rate limit delay events to this many IO delays per second.
105 + */
106 +unsigned int zfs_delays_per_second = 20;
107 +
108 +/*
109 + * Rate limit checksum events after this many checksum errors per second.
110 + */
111 +unsigned int zfs_checksums_per_second = 20;
112 +
113 /*
114 * Virtual device management.
115 */
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.
119 */
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);
124
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 "
130 "of metaslabs");
131 +
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");
135 +
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"
139 + "threshold).");
140 /* END CSTYLED */
141 #endif
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.
148 .RE
149
150 +.sp
151 +.ne 2
152 +.na
153 +\fBzfs_checksums_per_second\fR (int)
154 +.ad
155 +.RS 12n
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.
159 +.sp
160 +Default value: 20
161 +.RE
162 +
163 +.sp
164 +.ne 2
165 +.na
166 +\fBzfs_commit_timeout_pct\fR (int)
167 +.ad
168 +.RS 12n
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).
174 +.sp
175 +Default value: \fB5\fR%.
176 +.RE
177 +
178 .sp
179 .ne 2
180 .na
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.
183 .RE
184
185 +.sp
186 +.ne 2
187 +.na
188 +\fBzfs_delays_per_second\fR (int)
189 +.ad
190 +.RS 12n
191 +Rate limit IO delay events to this many per second.
192 +.sp
193 +Default value: 20
194 +.RE
195 +
196 .sp
197 .ne 2
198 .na
199 --
200 2.14.2
201