]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r307894, and update
[FreeBSD/FreeBSD.git] / sys / cddl / contrib / opensolaris / uts / common / fs / zfs / vdev_mirror.c
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25
26 /*
27  * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
28  */
29
30 #include <sys/zfs_context.h>
31 #include <sys/spa.h>
32 #include <sys/vdev_impl.h>
33 #include <sys/zio.h>
34 #include <sys/abd.h>
35 #include <sys/fs/zfs.h>
36
37 /*
38  * Virtual device vector for mirroring.
39  */
40
41 typedef struct mirror_child {
42         vdev_t          *mc_vd;
43         uint64_t        mc_offset;
44         int             mc_error;
45         int             mc_load;
46         uint8_t         mc_tried;
47         uint8_t         mc_skipped;
48         uint8_t         mc_speculative;
49 } mirror_child_t;
50
51 typedef struct mirror_map {
52         int             *mm_preferred;
53         int             mm_preferred_cnt;
54         int             mm_children;
55         boolean_t       mm_replacing;
56         boolean_t       mm_root;
57         mirror_child_t  mm_child[];
58 } mirror_map_t;
59
60 static int vdev_mirror_shift = 21;
61
62 #ifdef _KERNEL
63 SYSCTL_DECL(_vfs_zfs_vdev);
64 static SYSCTL_NODE(_vfs_zfs_vdev, OID_AUTO, mirror, CTLFLAG_RD, 0,
65     "ZFS VDEV Mirror");
66 #endif
67
68 /*
69  * The load configuration settings below are tuned by default for
70  * the case where all devices are of the same rotational type.
71  *
72  * If there is a mixture of rotating and non-rotating media, setting
73  * non_rotating_seek_inc to 0 may well provide better results as it
74  * will direct more reads to the non-rotating vdevs which are more
75  * likely to have a higher performance.
76  */
77
78 /* Rotating media load calculation configuration. */
79 static int rotating_inc = 0;
80 #ifdef _KERNEL
81 SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_inc, CTLFLAG_RWTUN,
82     &rotating_inc, 0, "Rotating media load increment for non-seeking I/O's");
83 #endif
84
85 static int rotating_seek_inc = 5;
86 #ifdef _KERNEL
87 SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_inc, CTLFLAG_RWTUN,
88     &rotating_seek_inc, 0, "Rotating media load increment for seeking I/O's");
89 #endif
90
91 static int rotating_seek_offset = 1 * 1024 * 1024;
92 #ifdef _KERNEL
93 SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_offset, CTLFLAG_RWTUN,
94     &rotating_seek_offset, 0, "Offset in bytes from the last I/O which "
95     "triggers a reduced rotating media seek increment");
96 #endif
97
98 /* Non-rotating media load calculation configuration. */
99 static int non_rotating_inc = 0;
100 #ifdef _KERNEL
101 SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_inc, CTLFLAG_RWTUN,
102     &non_rotating_inc, 0,
103     "Non-rotating media load increment for non-seeking I/O's");
104 #endif
105
106 static int non_rotating_seek_inc = 1;
107 #ifdef _KERNEL
108 SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_seek_inc, CTLFLAG_RWTUN,
109     &non_rotating_seek_inc, 0,
110     "Non-rotating media load increment for seeking I/O's");
111 #endif
112
113
114 static inline size_t
115 vdev_mirror_map_size(int children)
116 {
117         return (offsetof(mirror_map_t, mm_child[children]) +
118             sizeof(int) * children);
119 }
120
121 static inline mirror_map_t *
122 vdev_mirror_map_alloc(int children, boolean_t replacing, boolean_t root)
123 {
124         mirror_map_t *mm;
125
126         mm = kmem_zalloc(vdev_mirror_map_size(children), KM_SLEEP);
127         mm->mm_children = children;
128         mm->mm_replacing = replacing;
129         mm->mm_root = root;
130         mm->mm_preferred = (int *)((uintptr_t)mm + 
131             offsetof(mirror_map_t, mm_child[children]));
132
133         return mm;
134 }
135
136 static void
137 vdev_mirror_map_free(zio_t *zio)
138 {
139         mirror_map_t *mm = zio->io_vsd;
140
141         kmem_free(mm, vdev_mirror_map_size(mm->mm_children));
142 }
143
144 static const zio_vsd_ops_t vdev_mirror_vsd_ops = {
145         vdev_mirror_map_free,
146         zio_vsd_default_cksum_report
147 };
148
149 static int
150 vdev_mirror_load(mirror_map_t *mm, vdev_t *vd, uint64_t zio_offset)
151 {
152         uint64_t lastoffset;
153         int load;
154
155         /* All DVAs have equal weight at the root. */
156         if (mm->mm_root)
157                 return (INT_MAX);
158
159         /*
160          * We don't return INT_MAX if the device is resilvering i.e.
161          * vdev_resilver_txg != 0 as when tested performance was slightly
162          * worse overall when resilvering with compared to without.
163          */
164
165         /* Standard load based on pending queue length. */
166         load = vdev_queue_length(vd);
167         lastoffset = vdev_queue_lastoffset(vd);
168
169         if (vd->vdev_rotation_rate == VDEV_RATE_NON_ROTATING) {
170                 /* Non-rotating media. */
171                 if (lastoffset == zio_offset)
172                         return (load + non_rotating_inc);
173
174                 /*
175                  * Apply a seek penalty even for non-rotating devices as
176                  * sequential I/O'a can be aggregated into fewer operations
177                  * on the device, thus avoiding unnecessary per-command
178                  * overhead and boosting performance.
179                  */
180                 return (load + non_rotating_seek_inc);
181         }
182
183         /* Rotating media I/O's which directly follow the last I/O. */
184         if (lastoffset == zio_offset)
185                 return (load + rotating_inc);
186
187         /*
188          * Apply half the seek increment to I/O's within seek offset
189          * of the last I/O queued to this vdev as they should incure less
190          * of a seek increment.
191          */
192         if (ABS(lastoffset - zio_offset) < rotating_seek_offset)
193                 return (load + (rotating_seek_inc / 2));
194
195         /* Apply the full seek increment to all other I/O's. */
196         return (load + rotating_seek_inc);
197 }
198
199
200 static mirror_map_t *
201 vdev_mirror_map_init(zio_t *zio)
202 {
203         mirror_map_t *mm = NULL;
204         mirror_child_t *mc;
205         vdev_t *vd = zio->io_vd;
206         int c;
207
208         if (vd == NULL) {
209                 dva_t *dva = zio->io_bp->blk_dva;
210                 spa_t *spa = zio->io_spa;
211
212                 mm = vdev_mirror_map_alloc(BP_GET_NDVAS(zio->io_bp), B_FALSE,
213                     B_TRUE);
214                 for (c = 0; c < mm->mm_children; c++) {
215                         mc = &mm->mm_child[c];
216                         mc->mc_vd = vdev_lookup_top(spa, DVA_GET_VDEV(&dva[c]));
217                         mc->mc_offset = DVA_GET_OFFSET(&dva[c]);
218                 }
219         } else {
220                 mm = vdev_mirror_map_alloc(vd->vdev_children,
221                     (vd->vdev_ops == &vdev_replacing_ops ||
222                     vd->vdev_ops == &vdev_spare_ops), B_FALSE);
223                 for (c = 0; c < mm->mm_children; c++) {
224                         mc = &mm->mm_child[c];
225                         mc->mc_vd = vd->vdev_child[c];
226                         mc->mc_offset = zio->io_offset;
227                 }
228         }
229
230         zio->io_vsd = mm;
231         zio->io_vsd_ops = &vdev_mirror_vsd_ops;
232         return (mm);
233 }
234
235 static int
236 vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize,
237     uint64_t *logical_ashift, uint64_t *physical_ashift)
238 {
239         int numerrors = 0;
240         int lasterror = 0;
241
242         if (vd->vdev_children == 0) {
243                 vd->vdev_stat.vs_aux = VDEV_AUX_BAD_LABEL;
244                 return (SET_ERROR(EINVAL));
245         }
246
247         vdev_open_children(vd);
248
249         for (int c = 0; c < vd->vdev_children; c++) {
250                 vdev_t *cvd = vd->vdev_child[c];
251
252                 if (cvd->vdev_open_error) {
253                         lasterror = cvd->vdev_open_error;
254                         numerrors++;
255                         continue;
256                 }
257
258                 *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1;
259                 *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1;
260                 *logical_ashift = MAX(*logical_ashift, cvd->vdev_ashift);
261                 *physical_ashift = MAX(*physical_ashift,
262                     cvd->vdev_physical_ashift);
263         }
264
265         if (numerrors == vd->vdev_children) {
266                 vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS;
267                 return (lasterror);
268         }
269
270         return (0);
271 }
272
273 static void
274 vdev_mirror_close(vdev_t *vd)
275 {
276         for (int c = 0; c < vd->vdev_children; c++)
277                 vdev_close(vd->vdev_child[c]);
278 }
279
280 static void
281 vdev_mirror_child_done(zio_t *zio)
282 {
283         mirror_child_t *mc = zio->io_private;
284
285         mc->mc_error = zio->io_error;
286         mc->mc_tried = 1;
287         mc->mc_skipped = 0;
288 }
289
290 static void
291 vdev_mirror_scrub_done(zio_t *zio)
292 {
293         mirror_child_t *mc = zio->io_private;
294
295         if (zio->io_error == 0) {
296                 zio_t *pio;
297                 zio_link_t *zl = NULL;
298
299                 mutex_enter(&zio->io_lock);
300                 while ((pio = zio_walk_parents(zio, &zl)) != NULL) {
301                         mutex_enter(&pio->io_lock);
302                         ASSERT3U(zio->io_size, >=, pio->io_size);
303                         abd_copy(pio->io_abd, zio->io_abd, pio->io_size);
304                         mutex_exit(&pio->io_lock);
305                 }
306                 mutex_exit(&zio->io_lock);
307         }
308         abd_free(zio->io_abd);
309
310         mc->mc_error = zio->io_error;
311         mc->mc_tried = 1;
312         mc->mc_skipped = 0;
313 }
314
315 /*
316  * Check the other, lower-index DVAs to see if they're on the same
317  * vdev as the child we picked.  If they are, use them since they
318  * are likely to have been allocated from the primary metaslab in
319  * use at the time, and hence are more likely to have locality with
320  * single-copy data.
321  */
322 static int
323 vdev_mirror_dva_select(zio_t *zio, int p)
324 {
325         dva_t *dva = zio->io_bp->blk_dva;
326         mirror_map_t *mm = zio->io_vsd;
327         int preferred;
328         int c;
329
330         preferred = mm->mm_preferred[p];
331         for (p-- ; p >= 0; p--) {
332                 c = mm->mm_preferred[p];
333                 if (DVA_GET_VDEV(&dva[c]) == DVA_GET_VDEV(&dva[preferred]))
334                         preferred = c;
335         }
336         return (preferred);
337 }
338
339 static int
340 vdev_mirror_preferred_child_randomize(zio_t *zio)
341 {
342         mirror_map_t *mm = zio->io_vsd;
343         int p;
344
345         if (mm->mm_root) {
346                 p = spa_get_random(mm->mm_preferred_cnt);
347                 return (vdev_mirror_dva_select(zio, p));
348         }
349
350         /*
351          * To ensure we don't always favour the first matching vdev,
352          * which could lead to wear leveling issues on SSD's, we
353          * use the I/O offset as a pseudo random seed into the vdevs
354          * which have the lowest load.
355          */
356         p = (zio->io_offset >> vdev_mirror_shift) % mm->mm_preferred_cnt;
357         return (mm->mm_preferred[p]);
358 }
359
360 /*
361  * Try to find a vdev whose DTL doesn't contain the block we want to read
362  * prefering vdevs based on determined load.
363  *
364  * If we can't, try the read on any vdev we haven't already tried.
365  */
366 static int
367 vdev_mirror_child_select(zio_t *zio)
368 {
369         mirror_map_t *mm = zio->io_vsd;
370         uint64_t txg = zio->io_txg;
371         int c, lowest_load;
372
373         ASSERT(zio->io_bp == NULL || BP_PHYSICAL_BIRTH(zio->io_bp) == txg);
374
375         lowest_load = INT_MAX;
376         mm->mm_preferred_cnt = 0;
377         for (c = 0; c < mm->mm_children; c++) {
378                 mirror_child_t *mc;
379
380                 mc = &mm->mm_child[c];
381                 if (mc->mc_tried || mc->mc_skipped)
382                         continue;
383
384                 if (!vdev_readable(mc->mc_vd)) {
385                         mc->mc_error = SET_ERROR(ENXIO);
386                         mc->mc_tried = 1;       /* don't even try */
387                         mc->mc_skipped = 1;
388                         continue;
389                 }
390
391                 if (vdev_dtl_contains(mc->mc_vd, DTL_MISSING, txg, 1)) {
392                         mc->mc_error = SET_ERROR(ESTALE);
393                         mc->mc_skipped = 1;
394                         mc->mc_speculative = 1;
395                         continue;
396                 }
397
398                 mc->mc_load = vdev_mirror_load(mm, mc->mc_vd, mc->mc_offset);
399                 if (mc->mc_load > lowest_load)
400                         continue;
401
402                 if (mc->mc_load < lowest_load) {
403                         lowest_load = mc->mc_load;
404                         mm->mm_preferred_cnt = 0;
405                 }
406                 mm->mm_preferred[mm->mm_preferred_cnt] = c;
407                 mm->mm_preferred_cnt++;
408         }
409
410         if (mm->mm_preferred_cnt == 1) {
411                 vdev_queue_register_lastoffset(
412                     mm->mm_child[mm->mm_preferred[0]].mc_vd, zio);
413                 return (mm->mm_preferred[0]);
414         }
415
416         if (mm->mm_preferred_cnt > 1) {
417                 int c = vdev_mirror_preferred_child_randomize(zio);
418
419                 vdev_queue_register_lastoffset(mm->mm_child[c].mc_vd, zio);
420                 return (c);
421         }
422
423         /*
424          * Every device is either missing or has this txg in its DTL.
425          * Look for any child we haven't already tried before giving up.
426          */
427         for (c = 0; c < mm->mm_children; c++) {
428                 if (!mm->mm_child[c].mc_tried) {
429                         vdev_queue_register_lastoffset(mm->mm_child[c].mc_vd,
430                             zio);
431                         return (c);
432                 }
433         }
434
435         /*
436          * Every child failed.  There's no place left to look.
437          */
438         return (-1);
439 }
440
441 static void
442 vdev_mirror_io_start(zio_t *zio)
443 {
444         mirror_map_t *mm;
445         mirror_child_t *mc;
446         int c, children;
447
448         mm = vdev_mirror_map_init(zio);
449
450         if (zio->io_type == ZIO_TYPE_READ) {
451                 if ((zio->io_flags & ZIO_FLAG_SCRUB) && !mm->mm_replacing &&
452                     mm->mm_children > 1) {
453                         /*
454                          * For scrubbing reads we need to allocate a read
455                          * buffer for each child and issue reads to all
456                          * children.  If any child succeeds, it will copy its
457                          * data into zio->io_data in vdev_mirror_scrub_done.
458                          */
459                         for (c = 0; c < mm->mm_children; c++) {
460                                 mc = &mm->mm_child[c];
461                                 zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
462                                     mc->mc_vd, mc->mc_offset,
463                                     abd_alloc_sametype(zio->io_abd,
464                                     zio->io_size), zio->io_size,
465                                     zio->io_type, zio->io_priority, 0,
466                                     vdev_mirror_scrub_done, mc));
467                         }
468                         zio_execute(zio);
469                         return;
470                 }
471                 /*
472                  * For normal reads just pick one child.
473                  */
474                 c = vdev_mirror_child_select(zio);
475                 children = (c >= 0);
476         } else {
477                 ASSERT(zio->io_type == ZIO_TYPE_WRITE ||
478                     zio->io_type == ZIO_TYPE_FREE);
479
480                 /*
481                  * Writes and frees go to all children.
482                  */
483                 c = 0;
484                 children = mm->mm_children;
485         }
486
487         while (children--) {
488                 mc = &mm->mm_child[c];
489                 zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
490                     mc->mc_vd, mc->mc_offset, zio->io_abd, zio->io_size,
491                     zio->io_type, zio->io_priority, 0,
492                     vdev_mirror_child_done, mc));
493                 c++;
494         }
495
496         zio_execute(zio);
497 }
498
499 static int
500 vdev_mirror_worst_error(mirror_map_t *mm)
501 {
502         int error[2] = { 0, 0 };
503
504         for (int c = 0; c < mm->mm_children; c++) {
505                 mirror_child_t *mc = &mm->mm_child[c];
506                 int s = mc->mc_speculative;
507                 error[s] = zio_worst_error(error[s], mc->mc_error);
508         }
509
510         return (error[0] ? error[0] : error[1]);
511 }
512
513 static void
514 vdev_mirror_io_done(zio_t *zio)
515 {
516         mirror_map_t *mm = zio->io_vsd;
517         mirror_child_t *mc;
518         int c;
519         int good_copies = 0;
520         int unexpected_errors = 0;
521
522         for (c = 0; c < mm->mm_children; c++) {
523                 mc = &mm->mm_child[c];
524
525                 if (mc->mc_error) {
526                         if (!mc->mc_skipped)
527                                 unexpected_errors++;
528                 } else if (mc->mc_tried) {
529                         good_copies++;
530                 }
531         }
532
533         if (zio->io_type == ZIO_TYPE_WRITE) {
534                 /*
535                  * XXX -- for now, treat partial writes as success.
536                  *
537                  * Now that we support write reallocation, it would be better
538                  * to treat partial failure as real failure unless there are
539                  * no non-degraded top-level vdevs left, and not update DTLs
540                  * if we intend to reallocate.
541                  */
542                 /* XXPOLICY */
543                 if (good_copies != mm->mm_children) {
544                         /*
545                          * Always require at least one good copy.
546                          *
547                          * For ditto blocks (io_vd == NULL), require
548                          * all copies to be good.
549                          *
550                          * XXX -- for replacing vdevs, there's no great answer.
551                          * If the old device is really dead, we may not even
552                          * be able to access it -- so we only want to
553                          * require good writes to the new device.  But if
554                          * the new device turns out to be flaky, we want
555                          * to be able to detach it -- which requires all
556                          * writes to the old device to have succeeded.
557                          */
558                         if (good_copies == 0 || zio->io_vd == NULL)
559                                 zio->io_error = vdev_mirror_worst_error(mm);
560                 }
561                 return;
562         } else if (zio->io_type == ZIO_TYPE_FREE) {
563                 return;
564         }
565
566         ASSERT(zio->io_type == ZIO_TYPE_READ);
567
568         /*
569          * If we don't have a good copy yet, keep trying other children.
570          */
571         /* XXPOLICY */
572         if (good_copies == 0 && (c = vdev_mirror_child_select(zio)) != -1) {
573                 ASSERT(c >= 0 && c < mm->mm_children);
574                 mc = &mm->mm_child[c];
575                 zio_vdev_io_redone(zio);
576                 zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
577                     mc->mc_vd, mc->mc_offset, zio->io_abd, zio->io_size,
578                     ZIO_TYPE_READ, zio->io_priority, 0,
579                     vdev_mirror_child_done, mc));
580                 return;
581         }
582
583         /* XXPOLICY */
584         if (good_copies == 0) {
585                 zio->io_error = vdev_mirror_worst_error(mm);
586                 ASSERT(zio->io_error != 0);
587         }
588
589         if (good_copies && spa_writeable(zio->io_spa) &&
590             (unexpected_errors ||
591             (zio->io_flags & ZIO_FLAG_RESILVER) ||
592             ((zio->io_flags & ZIO_FLAG_SCRUB) && mm->mm_replacing))) {
593                 /*
594                  * Use the good data we have in hand to repair damaged children.
595                  */
596                 for (c = 0; c < mm->mm_children; c++) {
597                         /*
598                          * Don't rewrite known good children.
599                          * Not only is it unnecessary, it could
600                          * actually be harmful: if the system lost
601                          * power while rewriting the only good copy,
602                          * there would be no good copies left!
603                          */
604                         mc = &mm->mm_child[c];
605
606                         if (mc->mc_error == 0) {
607                                 if (mc->mc_tried)
608                                         continue;
609                                 if (!(zio->io_flags & ZIO_FLAG_SCRUB) &&
610                                     !vdev_dtl_contains(mc->mc_vd, DTL_PARTIAL,
611                                     zio->io_txg, 1))
612                                         continue;
613                                 mc->mc_error = SET_ERROR(ESTALE);
614                         }
615
616                         zio_nowait(zio_vdev_child_io(zio, zio->io_bp,
617                             mc->mc_vd, mc->mc_offset,
618                             zio->io_abd, zio->io_size,
619                             ZIO_TYPE_WRITE, ZIO_PRIORITY_ASYNC_WRITE,
620                             ZIO_FLAG_IO_REPAIR | (unexpected_errors ?
621                             ZIO_FLAG_SELF_HEAL : 0), NULL, NULL));
622                 }
623         }
624 }
625
626 static void
627 vdev_mirror_state_change(vdev_t *vd, int faulted, int degraded)
628 {
629         if (faulted == vd->vdev_children)
630                 vdev_set_state(vd, B_FALSE, VDEV_STATE_CANT_OPEN,
631                     VDEV_AUX_NO_REPLICAS);
632         else if (degraded + faulted != 0)
633                 vdev_set_state(vd, B_FALSE, VDEV_STATE_DEGRADED, VDEV_AUX_NONE);
634         else
635                 vdev_set_state(vd, B_FALSE, VDEV_STATE_HEALTHY, VDEV_AUX_NONE);
636 }
637
638 vdev_ops_t vdev_mirror_ops = {
639         vdev_mirror_open,
640         vdev_mirror_close,
641         vdev_default_asize,
642         vdev_mirror_io_start,
643         vdev_mirror_io_done,
644         vdev_mirror_state_change,
645         NULL,
646         NULL,
647         VDEV_TYPE_MIRROR,       /* name of this vdev type */
648         B_FALSE                 /* not a leaf vdev */
649 };
650
651 vdev_ops_t vdev_replacing_ops = {
652         vdev_mirror_open,
653         vdev_mirror_close,
654         vdev_default_asize,
655         vdev_mirror_io_start,
656         vdev_mirror_io_done,
657         vdev_mirror_state_change,
658         NULL,
659         NULL,
660         VDEV_TYPE_REPLACING,    /* name of this vdev type */
661         B_FALSE                 /* not a leaf vdev */
662 };
663
664 vdev_ops_t vdev_spare_ops = {
665         vdev_mirror_open,
666         vdev_mirror_close,
667         vdev_default_asize,
668         vdev_mirror_io_start,
669         vdev_mirror_io_done,
670         vdev_mirror_state_change,
671         NULL,
672         NULL,
673         VDEV_TYPE_SPARE,        /* name of this vdev type */
674         B_FALSE                 /* not a leaf vdev */
675 };