1 // SPDX-License-Identifier: CDDL-1.0
2 /*
3 * CDDL HEADER START
4 *
5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License (the "License").
7 * You may not use this file except in compliance with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or https://opensource.org/licenses/CDDL-1.0.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
29 */
30
31 #include <sys/zfs_context.h>
32 #include <sys/vdev_impl.h>
33 #include <sys/spa_impl.h>
34 #include <sys/zio.h>
35 #include <sys/avl.h>
36 #include <sys/dsl_pool.h>
37 #include <sys/metaslab_impl.h>
38 #include <sys/spa.h>
39 #include <sys/abd.h>
40
41 /*
42 * ZFS I/O Scheduler
43 * ---------------
44 *
45 * ZFS issues I/O operations to leaf vdevs to satisfy and complete zios. The
46 * I/O scheduler determines when and in what order those operations are
47 * issued. The I/O scheduler divides operations into five I/O classes
48 * prioritized in the following order: sync read, sync write, async read,
49 * async write, and scrub/resilver. Each queue defines the minimum and
50 * maximum number of concurrent operations that may be issued to the device.
51 * In addition, the device has an aggregate maximum. Note that the sum of the
52 * per-queue minimums must not exceed the aggregate maximum. If the
53 * sum of the per-queue maximums exceeds the aggregate maximum, then the
54 * number of active i/os may reach zfs_vdev_max_active, in which case no
55 * further i/os will be issued regardless of whether all per-queue
56 * minimums have been met.
57 *
58 * For many physical devices, throughput increases with the number of
59 * concurrent operations, but latency typically suffers. Further, physical
60 * devices typically have a limit at which more concurrent operations have no
61 * effect on throughput or can actually cause it to decrease.
62 *
63 * The scheduler selects the next operation to issue by first looking for an
64 * I/O class whose minimum has not been satisfied. Once all are satisfied and
65 * the aggregate maximum has not been hit, the scheduler looks for classes
66 * whose maximum has not been satisfied. Iteration through the I/O classes is
67 * done in the order specified above. No further operations are issued if the
68 * aggregate maximum number of concurrent operations has been hit or if there
69 * are no operations queued for an I/O class that has not hit its maximum.
70 * Every time an i/o is queued or an operation completes, the I/O scheduler
71 * looks for new operations to issue.
72 *
73 * All I/O classes have a fixed maximum number of outstanding operations
74 * except for the async write class. Asynchronous writes represent the data
75 * that is committed to stable storage during the syncing stage for
76 * transaction groups (see txg.c). Transaction groups enter the syncing state
77 * periodically so the number of queued async writes will quickly burst up and
78 * then bleed down to zero. Rather than servicing them as quickly as possible,
79 * the I/O scheduler changes the maximum number of active async write i/os
80 * according to the amount of dirty data in the pool (see dsl_pool.c). Since
81 * both throughput and latency typically increase with the number of
82 * concurrent operations issued to physical devices, reducing the burstiness
83 * in the number of concurrent operations also stabilizes the response time of
84 * operations from other -- and in particular synchronous -- queues. In broad
85 * strokes, the I/O scheduler will issue more concurrent operations from the
86 * async write queue as there's more dirty data in the pool.
87 *
88 * Async Writes
89 *
90 * The number of concurrent operations issued for the async write I/O class
91 * follows a piece-wise linear function defined by a few adjustable points.
92 *
93 * | o---------| <-- zfs_vdev_async_write_max_active
94 * ^ | /^ |
95 * | | / | |
96 * active | / | |
97 * I/O | / | |
98 * count | / | |
99 * | / | |
100 * |------------o | | <-- zfs_vdev_async_write_min_active
101 * 0|____________^______|_________|
102 * 0% | | 100% of zfs_dirty_data_max
103 * | |
104 * | `-- zfs_vdev_async_write_active_max_dirty_percent
105 * `--------- zfs_vdev_async_write_active_min_dirty_percent
106 *
107 * Until the amount of dirty data exceeds a minimum percentage of the dirty
108 * data allowed in the pool, the I/O scheduler will limit the number of
109 * concurrent operations to the minimum. As that threshold is crossed, the
110 * number of concurrent operations issued increases linearly to the maximum at
111 * the specified maximum percentage of the dirty data allowed in the pool.
112 *
113 * Ideally, the amount of dirty data on a busy pool will stay in the sloped
114 * part of the function between zfs_vdev_async_write_active_min_dirty_percent
115 * and zfs_vdev_async_write_active_max_dirty_percent. If it exceeds the
116 * maximum percentage, this indicates that the rate of incoming data is
117 * greater than the rate that the backend storage can handle. In this case, we
118 * must further throttle incoming writes (see dmu_tx_delay() for details).
119 */
120
121 /*
122 * The maximum number of i/os active to each device. Ideally, this will be >=
123 * the sum of each queue's max_active.
124 */
125 uint_t zfs_vdev_max_active = 1000;
126
127 /*
128 * Per-queue limits on the number of i/os active to each device. If the
129 * number of active i/os is < zfs_vdev_max_active, then the min_active comes
130 * into play. We will send min_active from each queue round-robin, and then
131 * send from queues in the order defined by zio_priority_t up to max_active.
132 * Some queues have additional mechanisms to limit number of active I/Os in
133 * addition to min_active and max_active, see below.
134 *
135 * In general, smaller max_active's will lead to lower latency of synchronous
136 * operations. Larger max_active's may lead to higher overall throughput,
137 * depending on underlying storage.
138 *
139 * The ratio of the queues' max_actives determines the balance of performance
140 * between reads, writes, and scrubs. E.g., increasing
141 * zfs_vdev_scrub_max_active will cause the scrub or resilver to complete
142 * more quickly, but reads and writes to have higher latency and lower
143 * throughput.
144 */
145 static uint_t zfs_vdev_sync_read_min_active = 10;
146 static uint_t zfs_vdev_sync_read_max_active = 10;
147 static uint_t zfs_vdev_sync_write_min_active = 10;
148 static uint_t zfs_vdev_sync_write_max_active = 10;
149 static uint_t zfs_vdev_async_read_min_active = 1;
150 /* */ uint_t zfs_vdev_async_read_max_active = 3;
151 static uint_t zfs_vdev_async_write_min_active = 2;
152 static uint_t zfs_vdev_async_write_max_active = 10;
153 static uint_t zfs_vdev_scrub_min_active = 1;
154 static uint_t zfs_vdev_scrub_max_active = 3;
155 static uint_t zfs_vdev_removal_min_active = 1;
156 static uint_t zfs_vdev_removal_max_active = 2;
157 static uint_t zfs_vdev_initializing_min_active = 1;
158 static uint_t zfs_vdev_initializing_max_active = 1;
159 static uint_t zfs_vdev_trim_min_active = 1;
160 static uint_t zfs_vdev_trim_max_active = 2;
161 static uint_t zfs_vdev_rebuild_min_active = 1;
162 static uint_t zfs_vdev_rebuild_max_active = 3;
163
164 /*
165 * When the pool has less than zfs_vdev_async_write_active_min_dirty_percent
166 * dirty data, use zfs_vdev_async_write_min_active. When it has more than
167 * zfs_vdev_async_write_active_max_dirty_percent, use
168 * zfs_vdev_async_write_max_active. The value is linearly interpolated
169 * between min and max.
170 */
171 uint_t zfs_vdev_async_write_active_min_dirty_percent = 30;
172 uint_t zfs_vdev_async_write_active_max_dirty_percent = 60;
173
174 /*
175 * For non-interactive I/O (scrub, resilver, removal, initialize and rebuild),
176 * the number of concurrently-active I/O's is limited to *_min_active, unless
177 * the vdev is "idle". When there are no interactive I/Os active (sync or
178 * async), and zfs_vdev_nia_delay I/Os have completed since the last
179 * interactive I/O, then the vdev is considered to be "idle", and the number
180 * of concurrently-active non-interactive I/O's is increased to *_max_active.
181 */
182 static uint_t zfs_vdev_nia_delay = 5;
183
184 /*
185 * Some HDDs tend to prioritize sequential I/O so high that concurrent
186 * random I/O latency reaches several seconds. On some HDDs it happens
187 * even if sequential I/Os are submitted one at a time, and so setting
188 * *_max_active to 1 does not help. To prevent non-interactive I/Os, like
189 * scrub, from monopolizing the device no more than zfs_vdev_nia_credit
190 * I/Os can be sent while there are outstanding incomplete interactive
191 * I/Os. This enforced wait ensures the HDD services the interactive I/O
192 * within a reasonable amount of time.
193 */
194 static uint_t zfs_vdev_nia_credit = 5;
195
196 /*
197 * To reduce IOPs, we aggregate small adjacent I/Os into one large I/O.
198 * For read I/Os, we also aggregate across small adjacency gaps; for writes
199 * we include spans of optional I/Os to aid aggregation at the disk even when
200 * they aren't able to help us aggregate at this level.
201 */
202 static uint_t zfs_vdev_aggregation_limit = 1 << 20;
203 static uint_t zfs_vdev_aggregation_limit_non_rotating = SPA_OLD_MAXBLOCKSIZE;
204 static uint_t zfs_vdev_read_gap_limit = 32 << 10;
205 static uint_t zfs_vdev_write_gap_limit = 4 << 10;
206
207 static int
vdev_queue_offset_compare(const void * x1,const void * x2)208 vdev_queue_offset_compare(const void *x1, const void *x2)
209 {
210 const zio_t *z1 = (const zio_t *)x1;
211 const zio_t *z2 = (const zio_t *)x2;
212
213 int cmp = TREE_CMP(z1->io_offset, z2->io_offset);
214
215 if (likely(cmp))
216 return (cmp);
217
218 return (TREE_PCMP(z1, z2));
219 }
220
221 #define VDQ_T_SHIFT 29
222
223 static int
vdev_queue_to_compare(const void * x1,const void * x2)224 vdev_queue_to_compare(const void *x1, const void *x2)
225 {
226 const zio_t *z1 = (const zio_t *)x1;
227 const zio_t *z2 = (const zio_t *)x2;
228
229 int tcmp = TREE_CMP(z1->io_timestamp >> VDQ_T_SHIFT,
230 z2->io_timestamp >> VDQ_T_SHIFT);
231 int ocmp = TREE_CMP(z1->io_offset, z2->io_offset);
232 int cmp = tcmp ? tcmp : ocmp;
233
234 if (likely(cmp | (z1->io_queue_state == ZIO_QS_NONE)))
235 return (cmp);
236
237 return (TREE_PCMP(z1, z2));
238 }
239
240 static inline boolean_t
vdev_queue_class_fifo(zio_priority_t p)241 vdev_queue_class_fifo(zio_priority_t p)
242 {
243 return (p == ZIO_PRIORITY_SYNC_READ || p == ZIO_PRIORITY_SYNC_WRITE ||
244 p == ZIO_PRIORITY_TRIM);
245 }
246
247 static void
vdev_queue_class_add(vdev_queue_t * vq,zio_t * zio)248 vdev_queue_class_add(vdev_queue_t *vq, zio_t *zio)
249 {
250 zio_priority_t p = zio->io_priority;
251 vq->vq_cqueued |= 1U << p;
252 if (vdev_queue_class_fifo(p)) {
253 list_insert_tail(&vq->vq_class[p].vqc_list, zio);
254 vq->vq_class[p].vqc_list_numnodes++;
255 }
256 else
257 avl_add(&vq->vq_class[p].vqc_tree, zio);
258 }
259
260 static void
vdev_queue_class_remove(vdev_queue_t * vq,zio_t * zio)261 vdev_queue_class_remove(vdev_queue_t *vq, zio_t *zio)
262 {
263 zio_priority_t p = zio->io_priority;
264 uint32_t empty;
265 if (vdev_queue_class_fifo(p)) {
266 list_t *list = &vq->vq_class[p].vqc_list;
267 list_remove(list, zio);
268 empty = list_is_empty(list);
269 vq->vq_class[p].vqc_list_numnodes--;
270 } else {
271 avl_tree_t *tree = &vq->vq_class[p].vqc_tree;
272 avl_remove(tree, zio);
273 empty = avl_is_empty(tree);
274 }
275 vq->vq_cqueued &= ~(empty << p);
276 }
277
278 static uint_t
vdev_queue_class_min_active(vdev_queue_t * vq,zio_priority_t p)279 vdev_queue_class_min_active(vdev_queue_t *vq, zio_priority_t p)
280 {
281 switch (p) {
282 case ZIO_PRIORITY_SYNC_READ:
283 return (zfs_vdev_sync_read_min_active);
284 case ZIO_PRIORITY_SYNC_WRITE:
285 return (zfs_vdev_sync_write_min_active);
286 case ZIO_PRIORITY_ASYNC_READ:
287 return (zfs_vdev_async_read_min_active);
288 case ZIO_PRIORITY_ASYNC_WRITE:
289 return (zfs_vdev_async_write_min_active);
290 case ZIO_PRIORITY_SCRUB:
291 return (vq->vq_ia_active == 0 ? zfs_vdev_scrub_min_active :
292 MIN(vq->vq_nia_credit, zfs_vdev_scrub_min_active));
293 case ZIO_PRIORITY_REMOVAL:
294 return (vq->vq_ia_active == 0 ? zfs_vdev_removal_min_active :
295 MIN(vq->vq_nia_credit, zfs_vdev_removal_min_active));
296 case ZIO_PRIORITY_INITIALIZING:
297 return (vq->vq_ia_active == 0 ?zfs_vdev_initializing_min_active:
298 MIN(vq->vq_nia_credit, zfs_vdev_initializing_min_active));
299 case ZIO_PRIORITY_TRIM:
300 return (zfs_vdev_trim_min_active);
301 case ZIO_PRIORITY_REBUILD:
302 return (vq->vq_ia_active == 0 ? zfs_vdev_rebuild_min_active :
303 MIN(vq->vq_nia_credit, zfs_vdev_rebuild_min_active));
304 default:
305 panic("invalid priority %u", p);
306 return (0);
307 }
308 }
309
310 static uint_t
vdev_queue_max_async_writes(spa_t * spa)311 vdev_queue_max_async_writes(spa_t *spa)
312 {
313 uint_t writes;
314 uint64_t dirty = 0;
315 dsl_pool_t *dp = spa_get_dsl(spa);
316 uint64_t min_bytes = zfs_dirty_data_max *
317 zfs_vdev_async_write_active_min_dirty_percent / 100;
318 uint64_t max_bytes = zfs_dirty_data_max *
319 zfs_vdev_async_write_active_max_dirty_percent / 100;
320
321 /*
322 * Async writes may occur before the assignment of the spa's
323 * dsl_pool_t if a self-healing zio is issued prior to the
324 * completion of dmu_objset_open_impl().
325 */
326 if (dp == NULL)
327 return (zfs_vdev_async_write_max_active);
328
329 /*
330 * Sync tasks correspond to interactive user actions. To reduce the
331 * execution time of those actions we push data out as fast as possible.
332 */
333 dirty = dp->dp_dirty_total;
334 if (dirty > max_bytes || spa_has_pending_synctask(spa))
335 return (zfs_vdev_async_write_max_active);
336
337 if (dirty < min_bytes)
338 return (zfs_vdev_async_write_min_active);
339
340 /*
341 * linear interpolation:
342 * slope = (max_writes - min_writes) / (max_bytes - min_bytes)
343 * move right by min_bytes
344 * move up by min_writes
345 */
346 writes = (dirty - min_bytes) *
347 (zfs_vdev_async_write_max_active -
348 zfs_vdev_async_write_min_active) /
349 (max_bytes - min_bytes) +
350 zfs_vdev_async_write_min_active;
351 ASSERT3U(writes, >=, zfs_vdev_async_write_min_active);
352 ASSERT3U(writes, <=, zfs_vdev_async_write_max_active);
353 return (writes);
354 }
355
356 static uint_t
vdev_queue_class_max_active(vdev_queue_t * vq,zio_priority_t p)357 vdev_queue_class_max_active(vdev_queue_t *vq, zio_priority_t p)
358 {
359 switch (p) {
360 case ZIO_PRIORITY_SYNC_READ:
361 return (zfs_vdev_sync_read_max_active);
362 case ZIO_PRIORITY_SYNC_WRITE:
363 return (zfs_vdev_sync_write_max_active);
364 case ZIO_PRIORITY_ASYNC_READ:
365 return (zfs_vdev_async_read_max_active);
366 case ZIO_PRIORITY_ASYNC_WRITE:
367 return (vdev_queue_max_async_writes(vq->vq_vdev->vdev_spa));
368 case ZIO_PRIORITY_SCRUB:
369 if (vq->vq_ia_active > 0) {
370 return (MIN(vq->vq_nia_credit,
371 zfs_vdev_scrub_min_active));
372 } else if (vq->vq_nia_credit < zfs_vdev_nia_delay)
373 return (MAX(1, zfs_vdev_scrub_min_active));
374 return (zfs_vdev_scrub_max_active);
375 case ZIO_PRIORITY_REMOVAL:
376 if (vq->vq_ia_active > 0) {
377 return (MIN(vq->vq_nia_credit,
378 zfs_vdev_removal_min_active));
379 } else if (vq->vq_nia_credit < zfs_vdev_nia_delay)
380 return (MAX(1, zfs_vdev_removal_min_active));
381 return (zfs_vdev_removal_max_active);
382 case ZIO_PRIORITY_INITIALIZING:
383 if (vq->vq_ia_active > 0) {
384 return (MIN(vq->vq_nia_credit,
385 zfs_vdev_initializing_min_active));
386 } else if (vq->vq_nia_credit < zfs_vdev_nia_delay)
387 return (MAX(1, zfs_vdev_initializing_min_active));
388 return (zfs_vdev_initializing_max_active);
389 case ZIO_PRIORITY_TRIM:
390 return (zfs_vdev_trim_max_active);
391 case ZIO_PRIORITY_REBUILD:
392 if (vq->vq_ia_active > 0) {
393 return (MIN(vq->vq_nia_credit,
394 zfs_vdev_rebuild_min_active));
395 } else if (vq->vq_nia_credit < zfs_vdev_nia_delay)
396 return (MAX(1, zfs_vdev_rebuild_min_active));
397 return (zfs_vdev_rebuild_max_active);
398 default:
399 panic("invalid priority %u", p);
400 return (0);
401 }
402 }
403
404 /*
405 * Return the i/o class to issue from, or ZIO_PRIORITY_NUM_QUEUEABLE if
406 * there is no eligible class.
407 */
408 static zio_priority_t
vdev_queue_class_to_issue(vdev_queue_t * vq)409 vdev_queue_class_to_issue(vdev_queue_t *vq)
410 {
411 uint32_t cq = vq->vq_cqueued;
412 zio_priority_t p, p1;
413
414 if (cq == 0 || vq->vq_active >= zfs_vdev_max_active)
415 return (ZIO_PRIORITY_NUM_QUEUEABLE);
416
417 /*
418 * Find a queue that has not reached its minimum # outstanding i/os.
419 * Do round-robin to reduce starvation due to zfs_vdev_max_active
420 * and vq_nia_credit limits.
421 */
422 p1 = vq->vq_last_prio + 1;
423 if (p1 >= ZIO_PRIORITY_NUM_QUEUEABLE)
424 p1 = 0;
425 for (p = p1; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) {
426 if ((cq & (1U << p)) != 0 && vq->vq_cactive[p] <
427 vdev_queue_class_min_active(vq, p))
428 goto found;
429 }
430 for (p = 0; p < p1; p++) {
431 if ((cq & (1U << p)) != 0 && vq->vq_cactive[p] <
432 vdev_queue_class_min_active(vq, p))
433 goto found;
434 }
435
436 /*
437 * If we haven't found a queue, look for one that hasn't reached its
438 * maximum # outstanding i/os.
439 */
440 for (p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) {
441 if ((cq & (1U << p)) != 0 && vq->vq_cactive[p] <
442 vdev_queue_class_max_active(vq, p))
443 break;
444 }
445
446 found:
447 vq->vq_last_prio = p;
448 return (p);
449 }
450
451 void
vdev_queue_init(vdev_t * vd)452 vdev_queue_init(vdev_t *vd)
453 {
454 vdev_queue_t *vq = &vd->vdev_queue;
455 zio_priority_t p;
456
457 vq->vq_vdev = vd;
458
459 for (p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) {
460 if (vdev_queue_class_fifo(p)) {
461 list_create(&vq->vq_class[p].vqc_list,
462 sizeof (zio_t),
463 offsetof(struct zio, io_queue_node.l));
464 } else {
465 avl_create(&vq->vq_class[p].vqc_tree,
466 vdev_queue_to_compare, sizeof (zio_t),
467 offsetof(struct zio, io_queue_node.a));
468 }
469 }
470 avl_create(&vq->vq_read_offset_tree,
471 vdev_queue_offset_compare, sizeof (zio_t),
472 offsetof(struct zio, io_offset_node));
473 avl_create(&vq->vq_write_offset_tree,
474 vdev_queue_offset_compare, sizeof (zio_t),
475 offsetof(struct zio, io_offset_node));
476
477 vq->vq_last_offset = 0;
478 list_create(&vq->vq_active_list, sizeof (struct zio),
479 offsetof(struct zio, io_queue_node.l));
480 mutex_init(&vq->vq_lock, NULL, MUTEX_DEFAULT, NULL);
481 }
482
483 void
vdev_queue_fini(vdev_t * vd)484 vdev_queue_fini(vdev_t *vd)
485 {
486 vdev_queue_t *vq = &vd->vdev_queue;
487
488 for (zio_priority_t p = 0; p < ZIO_PRIORITY_NUM_QUEUEABLE; p++) {
489 if (vdev_queue_class_fifo(p))
490 list_destroy(&vq->vq_class[p].vqc_list);
491 else
492 avl_destroy(&vq->vq_class[p].vqc_tree);
493 }
494 avl_destroy(&vq->vq_read_offset_tree);
495 avl_destroy(&vq->vq_write_offset_tree);
496
497 list_destroy(&vq->vq_active_list);
498 mutex_destroy(&vq->vq_lock);
499 }
500
501 static void
vdev_queue_io_add(vdev_queue_t * vq,zio_t * zio)502 vdev_queue_io_add(vdev_queue_t *vq, zio_t *zio)
503 {
504 zio->io_queue_state = ZIO_QS_QUEUED;
505 vdev_queue_class_add(vq, zio);
506 if (zio->io_type == ZIO_TYPE_READ)
507 avl_add(&vq->vq_read_offset_tree, zio);
508 else if (zio->io_type == ZIO_TYPE_WRITE)
509 avl_add(&vq->vq_write_offset_tree, zio);
510 }
511
512 static void
vdev_queue_io_remove(vdev_queue_t * vq,zio_t * zio)513 vdev_queue_io_remove(vdev_queue_t *vq, zio_t *zio)
514 {
515 vdev_queue_class_remove(vq, zio);
516 if (zio->io_type == ZIO_TYPE_READ)
517 avl_remove(&vq->vq_read_offset_tree, zio);
518 else if (zio->io_type == ZIO_TYPE_WRITE)
519 avl_remove(&vq->vq_write_offset_tree, zio);
520 zio->io_queue_state = ZIO_QS_NONE;
521 }
522
523 static boolean_t
vdev_queue_is_interactive(zio_priority_t p)524 vdev_queue_is_interactive(zio_priority_t p)
525 {
526 switch (p) {
527 case ZIO_PRIORITY_SCRUB:
528 case ZIO_PRIORITY_REMOVAL:
529 case ZIO_PRIORITY_INITIALIZING:
530 case ZIO_PRIORITY_REBUILD:
531 return (B_FALSE);
532 default:
533 return (B_TRUE);
534 }
535 }
536
537 static void
vdev_queue_pending_add(vdev_queue_t * vq,zio_t * zio)538 vdev_queue_pending_add(vdev_queue_t *vq, zio_t *zio)
539 {
540 ASSERT(MUTEX_HELD(&vq->vq_lock));
541 ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
542 vq->vq_cactive[zio->io_priority]++;
543 vq->vq_active++;
544 if (vdev_queue_is_interactive(zio->io_priority)) {
545 if (++vq->vq_ia_active == 1)
546 vq->vq_nia_credit = 1;
547 } else if (vq->vq_ia_active > 0) {
548 vq->vq_nia_credit--;
549 }
550 zio->io_queue_state = ZIO_QS_ACTIVE;
551 list_insert_tail(&vq->vq_active_list, zio);
552 }
553
554 static void
vdev_queue_pending_remove(vdev_queue_t * vq,zio_t * zio)555 vdev_queue_pending_remove(vdev_queue_t *vq, zio_t *zio)
556 {
557 ASSERT(MUTEX_HELD(&vq->vq_lock));
558 ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
559 vq->vq_cactive[zio->io_priority]--;
560 vq->vq_active--;
561 if (vdev_queue_is_interactive(zio->io_priority)) {
562 if (--vq->vq_ia_active == 0)
563 vq->vq_nia_credit = 0;
564 else
565 vq->vq_nia_credit = zfs_vdev_nia_credit;
566 } else if (vq->vq_ia_active == 0)
567 vq->vq_nia_credit++;
568 list_remove(&vq->vq_active_list, zio);
569 zio->io_queue_state = ZIO_QS_NONE;
570 }
571
572 static void
vdev_queue_agg_io_done(zio_t * aio)573 vdev_queue_agg_io_done(zio_t *aio)
574 {
575 abd_free(aio->io_abd);
576 }
577
578 /*
579 * Compute the range spanned by two i/os, which is the endpoint of the last
580 * (lio->io_offset + lio->io_size) minus start of the first (fio->io_offset).
581 * Conveniently, the gap between fio and lio is given by -IO_SPAN(lio, fio);
582 * thus fio and lio are adjacent if and only if IO_SPAN(lio, fio) == 0.
583 */
584 #define IO_SPAN(fio, lio) ((lio)->io_offset + (lio)->io_size - (fio)->io_offset)
585 #define IO_GAP(fio, lio) (-IO_SPAN(lio, fio))
586
587 /*
588 * Sufficiently adjacent io_offset's in ZIOs will be aggregated. We do this
589 * by creating a gang ABD from the adjacent ZIOs io_abd's. By using
590 * a gang ABD we avoid doing memory copies to and from the parent,
591 * child ZIOs. The gang ABD also accounts for gaps between adjacent
592 * io_offsets by simply getting the zero ABD for writes or allocating
593 * a new ABD for reads and placing them in the gang ABD as well.
594 */
595 static zio_t *
vdev_queue_aggregate(vdev_queue_t * vq,zio_t * zio)596 vdev_queue_aggregate(vdev_queue_t *vq, zio_t *zio)
597 {
598 zio_t *first, *last, *aio, *dio, *mandatory, *nio;
599 uint64_t maxgap = 0;
600 uint64_t size;
601 uint64_t limit;
602 boolean_t stretch = B_FALSE;
603 uint64_t next_offset;
604 abd_t *abd;
605 avl_tree_t *t;
606
607 /*
608 * TRIM aggregation should not be needed since code in zfs_trim.c can
609 * submit TRIM I/O for extents up to zfs_trim_extent_bytes_max (128M).
610 */
611 if (zio->io_type == ZIO_TYPE_TRIM)
612 return (NULL);
613
614 if (zio->io_flags & ZIO_FLAG_DONT_AGGREGATE)
615 return (NULL);
616
617 if (vq->vq_vdev->vdev_nonrot)
618 limit = zfs_vdev_aggregation_limit_non_rotating;
619 else
620 limit = zfs_vdev_aggregation_limit;
621 if (limit == 0)
622 return (NULL);
623 limit = MIN(limit, SPA_MAXBLOCKSIZE);
624
625 /*
626 * I/Os to distributed spares are directly dispatched to the dRAID
627 * leaf vdevs for aggregation. See the comment at the end of the
628 * zio_vdev_io_start() function.
629 */
630 ASSERT(vq->vq_vdev->vdev_ops != &vdev_draid_spare_ops);
631
632 first = last = zio;
633
634 if (zio->io_type == ZIO_TYPE_READ) {
635 maxgap = zfs_vdev_read_gap_limit;
636 t = &vq->vq_read_offset_tree;
637 } else {
638 ASSERT3U(zio->io_type, ==, ZIO_TYPE_WRITE);
639 t = &vq->vq_write_offset_tree;
640 }
641
642 /*
643 * We can aggregate I/Os that are sufficiently adjacent and of
644 * the same flavor, as expressed by the AGG_INHERIT flags.
645 * The latter requirement is necessary so that certain
646 * attributes of the I/O, such as whether it's a normal I/O
647 * or a scrub/resilver, can be preserved in the aggregate.
648 * We can include optional I/Os, but don't allow them
649 * to begin a range as they add no benefit in that situation.
650 */
651
652 /*
653 * We keep track of the last non-optional I/O.
654 */
655 mandatory = (first->io_flags & ZIO_FLAG_OPTIONAL) ? NULL : first;
656
657 /*
658 * Walk backwards through sufficiently contiguous I/Os
659 * recording the last non-optional I/O.
660 */
661 zio_flag_t flags = zio->io_flags & ZIO_FLAG_AGG_INHERIT;
662 while ((dio = AVL_PREV(t, first)) != NULL &&
663 (dio->io_flags & ZIO_FLAG_AGG_INHERIT) == flags &&
664 IO_SPAN(dio, last) <= limit &&
665 IO_GAP(dio, first) <= maxgap &&
666 dio->io_type == zio->io_type) {
667 first = dio;
668 if (mandatory == NULL && !(first->io_flags & ZIO_FLAG_OPTIONAL))
669 mandatory = first;
670 }
671
672 /*
673 * Skip any initial optional I/Os.
674 */
675 while ((first->io_flags & ZIO_FLAG_OPTIONAL) && first != last) {
676 first = AVL_NEXT(t, first);
677 ASSERT(first != NULL);
678 }
679
680
681 /*
682 * Walk forward through sufficiently contiguous I/Os.
683 * The aggregation limit does not apply to optional i/os, so that
684 * we can issue contiguous writes even if they are larger than the
685 * aggregation limit.
686 */
687 while ((dio = AVL_NEXT(t, last)) != NULL &&
688 (dio->io_flags & ZIO_FLAG_AGG_INHERIT) == flags &&
689 (IO_SPAN(first, dio) <= limit ||
690 (dio->io_flags & ZIO_FLAG_OPTIONAL)) &&
691 IO_SPAN(first, dio) <= SPA_MAXBLOCKSIZE &&
692 IO_GAP(last, dio) <= maxgap &&
693 dio->io_type == zio->io_type) {
694 last = dio;
695 if (!(last->io_flags & ZIO_FLAG_OPTIONAL))
696 mandatory = last;
697 }
698
699 /*
700 * Now that we've established the range of the I/O aggregation
701 * we must decide what to do with trailing optional I/Os.
702 * For reads, there's nothing to do. While we are unable to
703 * aggregate further, it's possible that a trailing optional
704 * I/O would allow the underlying device to aggregate with
705 * subsequent I/Os. We must therefore determine if the next
706 * non-optional I/O is close enough to make aggregation
707 * worthwhile.
708 */
709 if (zio->io_type == ZIO_TYPE_WRITE && mandatory != NULL) {
710 zio_t *nio = last;
711 while ((dio = AVL_NEXT(t, nio)) != NULL &&
712 IO_GAP(nio, dio) == 0 &&
713 IO_GAP(mandatory, dio) <= zfs_vdev_write_gap_limit) {
714 nio = dio;
715 if (!(nio->io_flags & ZIO_FLAG_OPTIONAL)) {
716 stretch = B_TRUE;
717 break;
718 }
719 }
720 }
721
722 if (stretch) {
723 /*
724 * We are going to include an optional io in our aggregated
725 * span, thus closing the write gap. Only mandatory i/os can
726 * start aggregated spans, so make sure that the next i/o
727 * after our span is mandatory.
728 */
729 dio = AVL_NEXT(t, last);
730 ASSERT3P(dio, !=, NULL);
731 dio->io_flags &= ~ZIO_FLAG_OPTIONAL;
732 } else {
733 /* do not include the optional i/o */
734 while (last != mandatory && last != first) {
735 ASSERT(last->io_flags & ZIO_FLAG_OPTIONAL);
736 last = AVL_PREV(t, last);
737 ASSERT(last != NULL);
738 }
739 }
740
741 if (first == last)
742 return (NULL);
743
744 size = IO_SPAN(first, last);
745 ASSERT3U(size, <=, SPA_MAXBLOCKSIZE);
746
747 abd = abd_alloc_gang();
748 if (abd == NULL)
749 return (NULL);
750
751 aio = zio_vdev_delegated_io(first->io_vd, first->io_offset,
752 abd, size, first->io_type, zio->io_priority,
753 flags | ZIO_FLAG_DONT_QUEUE, vdev_queue_agg_io_done, NULL);
754 aio->io_timestamp = first->io_timestamp;
755
756 nio = first;
757 next_offset = first->io_offset;
758 do {
759 dio = nio;
760 nio = AVL_NEXT(t, dio);
761 ASSERT3P(dio, !=, NULL);
762 zio_add_child(dio, aio);
763 vdev_queue_io_remove(vq, dio);
764
765 if (dio->io_offset != next_offset) {
766 /* allocate a buffer for a read gap */
767 ASSERT3U(dio->io_type, ==, ZIO_TYPE_READ);
768 ASSERT3U(dio->io_offset, >, next_offset);
769 abd = abd_alloc_for_io(
770 dio->io_offset - next_offset, B_TRUE);
771 abd_gang_add(aio->io_abd, abd, B_TRUE);
772 }
773 if (dio->io_abd &&
774 (dio->io_size != abd_get_size(dio->io_abd))) {
775 /* abd size not the same as IO size */
776 ASSERT3U(abd_get_size(dio->io_abd), >, dio->io_size);
777 abd = abd_get_offset_size(dio->io_abd, 0, dio->io_size);
778 abd_gang_add(aio->io_abd, abd, B_TRUE);
779 } else {
780 if (dio->io_flags & ZIO_FLAG_NODATA) {
781 /* allocate a buffer for a write gap */
782 ASSERT3U(dio->io_type, ==, ZIO_TYPE_WRITE);
783 ASSERT0P(dio->io_abd);
784 abd_gang_add(aio->io_abd,
785 abd_get_zeros(dio->io_size), B_TRUE);
786 } else {
787 /*
788 * We pass B_FALSE to abd_gang_add()
789 * because we did not allocate a new
790 * ABD, so it is assumed the caller
791 * will free this ABD.
792 */
793 abd_gang_add(aio->io_abd, dio->io_abd,
794 B_FALSE);
795 }
796 }
797 next_offset = dio->io_offset + dio->io_size;
798 } while (dio != last);
799 ASSERT3U(abd_get_size(aio->io_abd), ==, aio->io_size);
800
801 /*
802 * Callers must call zio_vdev_io_bypass() and zio_execute() for
803 * aggregated (parent) I/Os so that we could avoid dropping the
804 * queue's lock here to avoid a deadlock that we could encounter
805 * due to lock order reversal between vq_lock and io_lock in
806 * zio_change_priority().
807 */
808 return (aio);
809 }
810
811 static zio_t *
vdev_queue_io_to_issue(vdev_queue_t * vq)812 vdev_queue_io_to_issue(vdev_queue_t *vq)
813 {
814 zio_t *zio, *aio;
815 zio_priority_t p;
816 avl_index_t idx;
817 avl_tree_t *tree;
818
819 again:
820 ASSERT(MUTEX_HELD(&vq->vq_lock));
821
822 p = vdev_queue_class_to_issue(vq);
823
824 if (p == ZIO_PRIORITY_NUM_QUEUEABLE) {
825 /* No eligible queued i/os */
826 return (NULL);
827 }
828
829 if (vdev_queue_class_fifo(p)) {
830 zio = list_head(&vq->vq_class[p].vqc_list);
831 } else {
832 /*
833 * For LBA-ordered queues (async / scrub / initializing),
834 * issue the I/O which follows the most recently issued I/O
835 * in LBA (offset) order, but to avoid starvation only within
836 * the same 0.5 second interval as the first I/O.
837 */
838 tree = &vq->vq_class[p].vqc_tree;
839 zio = aio = avl_first(tree);
840 if (zio->io_offset < vq->vq_last_offset) {
841 vq->vq_io_search.io_timestamp = zio->io_timestamp;
842 vq->vq_io_search.io_offset = vq->vq_last_offset;
843 zio = avl_find(tree, &vq->vq_io_search, &idx);
844 if (zio == NULL) {
845 zio = avl_nearest(tree, idx, AVL_AFTER);
846 if (zio == NULL ||
847 (zio->io_timestamp >> VDQ_T_SHIFT) !=
848 (aio->io_timestamp >> VDQ_T_SHIFT))
849 zio = aio;
850 }
851 }
852 }
853 ASSERT3U(zio->io_priority, ==, p);
854
855 aio = vdev_queue_aggregate(vq, zio);
856 if (aio != NULL) {
857 zio = aio;
858 } else {
859 vdev_queue_io_remove(vq, zio);
860
861 /*
862 * If the I/O is or was optional and therefore has no data, we
863 * need to simply discard it. We need to drop the vdev queue's
864 * lock to avoid a deadlock that we could encounter since this
865 * I/O will complete immediately.
866 */
867 if (zio->io_flags & ZIO_FLAG_NODATA) {
868 mutex_exit(&vq->vq_lock);
869 zio_vdev_io_bypass(zio);
870 zio_execute(zio);
871 mutex_enter(&vq->vq_lock);
872 goto again;
873 }
874 }
875
876 vdev_queue_pending_add(vq, zio);
877 vq->vq_last_offset = zio->io_offset + zio->io_size;
878
879 return (zio);
880 }
881
882 static boolean_t
vdev_should_queue_io(zio_t * zio)883 vdev_should_queue_io(zio_t *zio)
884 {
885 vdev_t *vd = zio->io_vd;
886 boolean_t should_queue = B_TRUE;
887
888 /*
889 * Add zio with ZIO_FLAG_NODATA to queue as bypass code
890 * currently does not handle certain cases (gang abd, raidz
891 * write aggregation).
892 */
893 if (zio->io_flags & ZIO_FLAG_NODATA)
894 return (B_TRUE);
895
896 switch (vd->vdev_scheduler) {
897 case VDEV_SCHEDULER_AUTO:
898 if (vd->vdev_nonrot && vd->vdev_is_blkdev)
899 should_queue = B_FALSE;
900 break;
901 case VDEV_SCHEDULER_ON:
902 should_queue = B_TRUE;
903 break;
904 case VDEV_SCHEDULER_OFF:
905 should_queue = B_FALSE;
906 break;
907 default:
908 should_queue = B_TRUE;
909 break;
910 }
911 return (should_queue);
912 }
913
914 zio_t *
vdev_queue_io(zio_t * zio)915 vdev_queue_io(zio_t *zio)
916 {
917 vdev_queue_t *vq = &zio->io_vd->vdev_queue;
918 zio_t *dio, *nio;
919 zio_link_t *zl = NULL;
920
921 if (zio->io_flags & ZIO_FLAG_DONT_QUEUE)
922 return (zio);
923
924 /*
925 * Children i/os inherent their parent's priority, which might
926 * not match the child's i/o type. Fix it up here.
927 */
928 if (zio->io_type == ZIO_TYPE_READ) {
929 ASSERT(zio->io_priority != ZIO_PRIORITY_TRIM);
930
931 if (zio->io_priority != ZIO_PRIORITY_SYNC_READ &&
932 zio->io_priority != ZIO_PRIORITY_ASYNC_READ &&
933 zio->io_priority != ZIO_PRIORITY_SCRUB &&
934 zio->io_priority != ZIO_PRIORITY_REMOVAL &&
935 zio->io_priority != ZIO_PRIORITY_INITIALIZING &&
936 zio->io_priority != ZIO_PRIORITY_REBUILD) {
937 zio->io_priority = ZIO_PRIORITY_ASYNC_READ;
938 }
939 } else if (zio->io_type == ZIO_TYPE_WRITE) {
940 ASSERT(zio->io_priority != ZIO_PRIORITY_TRIM);
941
942 if (zio->io_priority != ZIO_PRIORITY_SYNC_WRITE &&
943 zio->io_priority != ZIO_PRIORITY_ASYNC_WRITE &&
944 zio->io_priority != ZIO_PRIORITY_REMOVAL &&
945 zio->io_priority != ZIO_PRIORITY_INITIALIZING &&
946 zio->io_priority != ZIO_PRIORITY_REBUILD) {
947 zio->io_priority = ZIO_PRIORITY_ASYNC_WRITE;
948 }
949 } else {
950 ASSERT(zio->io_type == ZIO_TYPE_TRIM);
951 ASSERT(zio->io_priority == ZIO_PRIORITY_TRIM);
952 }
953
954 zio->io_flags |= ZIO_FLAG_DONT_QUEUE;
955 zio->io_timestamp = gethrtime();
956
957 if (!vdev_should_queue_io(zio)) {
958 zio->io_queue_state = ZIO_QS_NONE;
959 return (zio);
960 }
961
962 mutex_enter(&vq->vq_lock);
963 vdev_queue_io_add(vq, zio);
964 nio = vdev_queue_io_to_issue(vq);
965 mutex_exit(&vq->vq_lock);
966
967 if (nio == NULL)
968 return (NULL);
969
970 if (nio->io_done == vdev_queue_agg_io_done) {
971 while ((dio = zio_walk_parents(nio, &zl)) != NULL) {
972 ASSERT3U(dio->io_type, ==, nio->io_type);
973 zio_vdev_io_bypass(dio);
974 zio_execute(dio);
975 }
976 zio_nowait(nio);
977 return (NULL);
978 }
979
980 return (nio);
981 }
982
983 void
vdev_queue_io_done(zio_t * zio)984 vdev_queue_io_done(zio_t *zio)
985 {
986 vdev_queue_t *vq = &zio->io_vd->vdev_queue;
987 zio_t *dio, *nio;
988 zio_link_t *zl = NULL;
989
990 hrtime_t now = gethrtime();
991 vq->vq_io_complete_ts = now;
992 vq->vq_io_delta_ts = zio->io_delta = now - zio->io_timestamp;
993
994 if (zio->io_queue_state == ZIO_QS_NONE)
995 return;
996
997 mutex_enter(&vq->vq_lock);
998 vdev_queue_pending_remove(vq, zio);
999
1000 while ((nio = vdev_queue_io_to_issue(vq)) != NULL) {
1001 mutex_exit(&vq->vq_lock);
1002 if (nio->io_done == vdev_queue_agg_io_done) {
1003 while ((dio = zio_walk_parents(nio, &zl)) != NULL) {
1004 ASSERT3U(dio->io_type, ==, nio->io_type);
1005 zio_vdev_io_bypass(dio);
1006 zio_execute(dio);
1007 }
1008 zio_nowait(nio);
1009 } else {
1010 zio_vdev_io_reissue(nio);
1011 zio_execute(nio);
1012 }
1013 mutex_enter(&vq->vq_lock);
1014 }
1015
1016 mutex_exit(&vq->vq_lock);
1017 }
1018
1019 void
vdev_queue_change_io_priority(zio_t * zio,zio_priority_t priority)1020 vdev_queue_change_io_priority(zio_t *zio, zio_priority_t priority)
1021 {
1022 vdev_queue_t *vq = &zio->io_vd->vdev_queue;
1023
1024 /*
1025 * ZIO_PRIORITY_NOW is used by the vdev cache code and the aggregate zio
1026 * code to issue IOs without adding them to the vdev queue. In this
1027 * case, the zio is already going to be issued as quickly as possible
1028 * and so it doesn't need any reprioritization to help.
1029 */
1030 if (zio->io_priority == ZIO_PRIORITY_NOW)
1031 return;
1032
1033 ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
1034 ASSERT3U(priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
1035
1036 if (zio->io_type == ZIO_TYPE_READ) {
1037 if (priority != ZIO_PRIORITY_SYNC_READ &&
1038 priority != ZIO_PRIORITY_ASYNC_READ &&
1039 priority != ZIO_PRIORITY_SCRUB)
1040 priority = ZIO_PRIORITY_ASYNC_READ;
1041 } else {
1042 ASSERT(zio->io_type == ZIO_TYPE_WRITE);
1043 if (priority != ZIO_PRIORITY_SYNC_WRITE &&
1044 priority != ZIO_PRIORITY_ASYNC_WRITE)
1045 priority = ZIO_PRIORITY_ASYNC_WRITE;
1046 }
1047
1048 mutex_enter(&vq->vq_lock);
1049
1050 /*
1051 * If the zio is in none of the queues we can simply change
1052 * the priority. If the zio is waiting to be submitted we must
1053 * remove it from the queue and re-insert it with the new priority.
1054 * Otherwise, the zio is currently active and we cannot change its
1055 * priority.
1056 */
1057 if (zio->io_queue_state == ZIO_QS_QUEUED) {
1058 vdev_queue_class_remove(vq, zio);
1059 zio->io_priority = priority;
1060 vdev_queue_class_add(vq, zio);
1061 } else if (zio->io_queue_state == ZIO_QS_NONE) {
1062 zio->io_priority = priority;
1063 }
1064
1065 mutex_exit(&vq->vq_lock);
1066 }
1067
1068 boolean_t
vdev_queue_pool_busy(spa_t * spa)1069 vdev_queue_pool_busy(spa_t *spa)
1070 {
1071 dsl_pool_t *dp = spa_get_dsl(spa);
1072 uint64_t min_bytes = zfs_dirty_data_max *
1073 zfs_vdev_async_write_active_min_dirty_percent / 100;
1074
1075 return (dp->dp_dirty_total > min_bytes);
1076 }
1077
1078 /*
1079 * As these two methods are only used for load calculations we're not
1080 * concerned if we get an incorrect value on 32bit platforms due to lack of
1081 * vq_lock mutex use here, instead we prefer to keep it lock free for
1082 * performance.
1083 */
1084 uint32_t
vdev_queue_length(vdev_t * vd)1085 vdev_queue_length(vdev_t *vd)
1086 {
1087 return (vd->vdev_queue.vq_active);
1088 }
1089
1090 uint64_t
vdev_queue_last_offset(vdev_t * vd)1091 vdev_queue_last_offset(vdev_t *vd)
1092 {
1093 return (vd->vdev_queue.vq_last_offset);
1094 }
1095
1096 uint64_t
vdev_queue_class_length(vdev_t * vd,zio_priority_t p)1097 vdev_queue_class_length(vdev_t *vd, zio_priority_t p)
1098 {
1099 vdev_queue_t *vq = &vd->vdev_queue;
1100 if (vdev_queue_class_fifo(p))
1101 return (vq->vq_class[p].vqc_list_numnodes);
1102 else
1103 return (avl_numnodes(&vq->vq_class[p].vqc_tree));
1104 }
1105
1106 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, aggregation_limit, UINT, ZMOD_RW,
1107 "Max vdev I/O aggregation size");
1108
1109 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, aggregation_limit_non_rotating, UINT,
1110 ZMOD_RW, "Max vdev I/O aggregation size for non-rotating media");
1111
1112 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, read_gap_limit, UINT, ZMOD_RW,
1113 "Aggregate read I/O over gap");
1114
1115 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, write_gap_limit, UINT, ZMOD_RW,
1116 "Aggregate write I/O over gap");
1117
1118 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, max_active, UINT, ZMOD_RW,
1119 "Maximum number of active I/Os per vdev");
1120
1121 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, async_write_active_max_dirty_percent,
1122 UINT, ZMOD_RW, "Async write concurrency max threshold");
1123
1124 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, async_write_active_min_dirty_percent,
1125 UINT, ZMOD_RW, "Async write concurrency min threshold");
1126
1127 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, async_read_max_active, UINT, ZMOD_RW,
1128 "Max active async read I/Os per vdev");
1129
1130 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, async_read_min_active, UINT, ZMOD_RW,
1131 "Min active async read I/Os per vdev");
1132
1133 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, async_write_max_active, UINT, ZMOD_RW,
1134 "Max active async write I/Os per vdev");
1135
1136 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, async_write_min_active, UINT, ZMOD_RW,
1137 "Min active async write I/Os per vdev");
1138
1139 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, initializing_max_active, UINT, ZMOD_RW,
1140 "Max active initializing I/Os per vdev");
1141
1142 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, initializing_min_active, UINT, ZMOD_RW,
1143 "Min active initializing I/Os per vdev");
1144
1145 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, removal_max_active, UINT, ZMOD_RW,
1146 "Max active removal I/Os per vdev");
1147
1148 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, removal_min_active, UINT, ZMOD_RW,
1149 "Min active removal I/Os per vdev");
1150
1151 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, scrub_max_active, UINT, ZMOD_RW,
1152 "Max active scrub I/Os per vdev");
1153
1154 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, scrub_min_active, UINT, ZMOD_RW,
1155 "Min active scrub I/Os per vdev");
1156
1157 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, sync_read_max_active, UINT, ZMOD_RW,
1158 "Max active sync read I/Os per vdev");
1159
1160 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, sync_read_min_active, UINT, ZMOD_RW,
1161 "Min active sync read I/Os per vdev");
1162
1163 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, sync_write_max_active, UINT, ZMOD_RW,
1164 "Max active sync write I/Os per vdev");
1165
1166 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, sync_write_min_active, UINT, ZMOD_RW,
1167 "Min active sync write I/Os per vdev");
1168
1169 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, trim_max_active, UINT, ZMOD_RW,
1170 "Max active trim/discard I/Os per vdev");
1171
1172 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, trim_min_active, UINT, ZMOD_RW,
1173 "Min active trim/discard I/Os per vdev");
1174
1175 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, rebuild_max_active, UINT, ZMOD_RW,
1176 "Max active rebuild I/Os per vdev");
1177
1178 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, rebuild_min_active, UINT, ZMOD_RW,
1179 "Min active rebuild I/Os per vdev");
1180
1181 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, nia_credit, UINT, ZMOD_RW,
1182 "Number of non-interactive I/Os to allow in sequence");
1183
1184 ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, nia_delay, UINT, ZMOD_RW,
1185 "Number of non-interactive I/Os before _max_active");
1186