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