8023 Panic destroying a metaslab deferred range tree
[unleashed.git] / usr / src / uts / common / fs / zfs / vdev_missing.c
blob228757334234d241f980058397438d3a80716dcf
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
31 * The 'missing' vdev is a special vdev type used only during import. It
32 * signifies a placeholder in the root vdev for some vdev that we know is
33 * missing. We pass it down to the kernel to allow the rest of the
34 * configuration to parsed and an attempt made to open all available devices.
35 * Because its GUID is always 0, we know that the guid sum will mismatch and we
36 * won't be able to open the pool anyway.
39 #include <sys/zfs_context.h>
40 #include <sys/spa.h>
41 #include <sys/vdev_impl.h>
42 #include <sys/fs/zfs.h>
43 #include <sys/zio.h>
45 /* ARGSUSED */
46 static int
47 vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
48 uint64_t *ashift)
51 * Really this should just fail. But then the root vdev will be in the
52 * faulted state with VDEV_AUX_NO_REPLICAS, when what we really want is
53 * VDEV_AUX_BAD_GUID_SUM. So we pretend to succeed, knowing that we
54 * will fail the GUID sum check before ever trying to open the pool.
56 *psize = 0;
57 *max_psize = 0;
58 *ashift = 0;
59 return (0);
62 /* ARGSUSED */
63 static void
64 vdev_missing_close(vdev_t *vd)
68 /* ARGSUSED */
69 static void
70 vdev_missing_io_start(zio_t *zio)
72 zio->io_error = SET_ERROR(ENOTSUP);
73 zio_execute(zio);
76 /* ARGSUSED */
77 static void
78 vdev_missing_io_done(zio_t *zio)
82 vdev_ops_t vdev_missing_ops = {
83 vdev_missing_open,
84 vdev_missing_close,
85 vdev_default_asize,
86 vdev_missing_io_start,
87 vdev_missing_io_done,
88 NULL,
89 NULL,
90 NULL,
91 VDEV_TYPE_MISSING, /* name of this vdev type */
92 B_TRUE /* leaf vdev */
95 vdev_ops_t vdev_hole_ops = {
96 vdev_missing_open,
97 vdev_missing_close,
98 vdev_default_asize,
99 vdev_missing_io_start,
100 vdev_missing_io_done,
101 NULL,
102 NULL,
103 NULL,
104 VDEV_TYPE_HOLE, /* name of this vdev type */
105 B_TRUE /* leaf vdev */