FreeBSD ZFS
The Zettabyte File System

vdev_missing.c

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
00023  * Use is subject to license terms.
00024  */
00025 
00026 /*
00027  * Copyright (c) 2012 by Delphix. All rights reserved.
00028  */
00029 
00042 #include <sys/zfs_context.h>
00043 #include <sys/spa.h>
00044 #include <sys/vdev_impl.h>
00045 #include <sys/fs/zfs.h>
00046 #include <sys/zio.h>
00047 
00048 /* ARGSUSED */
00049 static int
00050 vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
00051     uint64_t *ashift)
00052 {
00053         /*
00054          * Really this should just fail.  But then the root vdev will be in the
00055          * faulted state with VDEV_AUX_NO_REPLICAS, when what we really want is
00056          * VDEV_AUX_BAD_GUID_SUM.  So we pretend to succeed, knowing that we
00057          * will fail the GUID sum check before ever trying to open the pool.
00058          */
00059         *psize = 0;
00060         *max_psize = 0;
00061         *ashift = 0;
00062         return (0);
00063 }
00064 
00065 /* ARGSUSED */
00066 static void
00067 vdev_missing_close(vdev_t *vd)
00068 {
00069 }
00070 
00071 /* ARGSUSED */
00072 static int
00073 vdev_missing_io_start(zio_t *zio)
00074 {
00075         zio->io_error = ENOTSUP;
00076         return (ZIO_PIPELINE_CONTINUE);
00077 }
00078 
00079 /* ARGSUSED */
00080 static void
00081 vdev_missing_io_done(zio_t *zio)
00082 {
00083 }
00084 
00085 vdev_ops_t vdev_missing_ops = {
00086         vdev_missing_open,
00087         vdev_missing_close,
00088         vdev_default_asize,
00089         vdev_missing_io_start,
00090         vdev_missing_io_done,
00091         NULL,
00092         NULL,
00093         NULL,
00094         VDEV_TYPE_MISSING,      /* name of this vdev type */
00095         B_TRUE                  /* leaf vdev */
00096 };
00097 
00098 vdev_ops_t vdev_hole_ops = {
00099         vdev_missing_open,
00100         vdev_missing_close,
00101         vdev_default_asize,
00102         vdev_missing_io_start,
00103         vdev_missing_io_done,
00104         NULL,
00105         NULL,
00106         NULL,
00107         VDEV_TYPE_HOLE,         /* name of this vdev type */
00108         B_TRUE                  /* leaf vdev */
00109 };
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines