1789Sahrens /* 2789Sahrens * CDDL HEADER START 3789Sahrens * 4789Sahrens * The contents of this file are subject to the terms of the 5*5329Sgw25295 * Common Development and Distribution License (the "License"). 6*5329Sgw25295 * You may not use this file except in compliance with the License. 7789Sahrens * 8789Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9789Sahrens * or http://www.opensolaris.org/os/licensing. 10789Sahrens * See the License for the specific language governing permissions 11789Sahrens * and limitations under the License. 12789Sahrens * 13789Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14789Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15789Sahrens * If applicable, add the following below this CDDL HEADER, with the 16789Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17789Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18789Sahrens * 19789Sahrens * CDDL HEADER END 20789Sahrens */ 21789Sahrens /* 22*5329Sgw25295 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23789Sahrens * Use is subject to license terms. 24789Sahrens */ 25789Sahrens 26789Sahrens #pragma ident "%Z%%M% %I% %E% SMI" 27789Sahrens 28789Sahrens /* 29789Sahrens * The 'missing' vdev is a special vdev type used only during import. It 30789Sahrens * signifies a placeholder in the root vdev for some vdev that we know is 31789Sahrens * missing. We pass it down to the kernel to allow the rest of the 32789Sahrens * configuration to parsed and an attempt made to open all available devices. 33789Sahrens * Because its GUID is always 0, we know that the guid sum will mismatch and we 34789Sahrens * won't be able to open the pool anyway. 35789Sahrens */ 36789Sahrens 37789Sahrens #include <sys/zfs_context.h> 38789Sahrens #include <sys/spa.h> 39789Sahrens #include <sys/vdev_impl.h> 40789Sahrens #include <sys/fs/zfs.h> 41789Sahrens #include <sys/zio.h> 42789Sahrens 43789Sahrens /* ARGSUSED */ 44789Sahrens static int 45789Sahrens vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) 46789Sahrens { 47789Sahrens /* 48789Sahrens * Really this should just fail. But then the root vdev will be in the 49789Sahrens * faulted state with VDEV_AUX_NO_REPLICAS, when what we really want is 50789Sahrens * VDEV_AUX_BAD_GUID_SUM. So we pretend to succeed, knowing that we 51789Sahrens * will fail the GUID sum check before ever trying to open the pool. 52789Sahrens */ 53789Sahrens *psize = SPA_MINDEVSIZE; 54789Sahrens *ashift = SPA_MINBLOCKSHIFT; 55789Sahrens return (0); 56789Sahrens } 57789Sahrens 58789Sahrens /* ARGSUSED */ 59789Sahrens static void 60789Sahrens vdev_missing_close(vdev_t *vd) 61789Sahrens { 62789Sahrens } 63789Sahrens 64789Sahrens /* ARGSUSED */ 65789Sahrens static void 66789Sahrens vdev_missing_io_start(zio_t *zio) 67789Sahrens { 68789Sahrens zio->io_error = ENOTSUP; 69789Sahrens zio_next_stage_async(zio); 70789Sahrens } 71789Sahrens 72789Sahrens /* ARGSUSED */ 73789Sahrens static void 74789Sahrens vdev_missing_io_done(zio_t *zio) 75789Sahrens { 76789Sahrens zio_next_stage(zio); 77789Sahrens } 78789Sahrens 79*5329Sgw25295 /* ARGSUSED */ 80*5329Sgw25295 static int 81*5329Sgw25295 vdev_missing_probe(vdev_t *vd) 82*5329Sgw25295 { 83*5329Sgw25295 return (0); 84*5329Sgw25295 } 85*5329Sgw25295 86789Sahrens vdev_ops_t vdev_missing_ops = { 87789Sahrens vdev_missing_open, 88789Sahrens vdev_missing_close, 89*5329Sgw25295 vdev_missing_probe, 90789Sahrens vdev_default_asize, 91789Sahrens vdev_missing_io_start, 92789Sahrens vdev_missing_io_done, 93789Sahrens NULL, 94789Sahrens VDEV_TYPE_MISSING, /* name of this vdev type */ 95789Sahrens B_TRUE /* leaf vdev */ 96789Sahrens }; 97