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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 */
25
26 #ifndef _SYS_VDEV_H
27 #define _SYS_VDEV_H
28
29 #include <sys/spa.h>
30 #include <sys/zio.h>
31 #include <sys/dmu.h>
32 #include <sys/space_map.h>
33 #include <sys/fs/zfs.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 typedef enum vdev_dtl_type {
40 DTL_MISSING, /* 0% replication: no copies of the data */
124
125 extern void vdev_state_dirty(vdev_t *vd);
126 extern void vdev_state_clean(vdev_t *vd);
127
128 typedef enum vdev_config_flag {
129 VDEV_CONFIG_SPARE = 1 << 0,
130 VDEV_CONFIG_L2CACHE = 1 << 1,
131 VDEV_CONFIG_REMOVING = 1 << 2
132 } vdev_config_flag_t;
133
134 extern void vdev_top_config_generate(spa_t *spa, nvlist_t *config);
135 extern nvlist_t *vdev_config_generate(spa_t *spa, vdev_t *vd,
136 boolean_t getstats, vdev_config_flag_t flags);
137
138 /*
139 * Label routines
140 */
141 struct uberblock;
142 extern uint64_t vdev_label_offset(uint64_t psize, int l, uint64_t offset);
143 extern int vdev_label_number(uint64_t psise, uint64_t offset);
144 extern nvlist_t *vdev_label_read_config(vdev_t *vd);
145 extern void vdev_uberblock_load(zio_t *zio, vdev_t *vd, struct uberblock *ub);
146
147 typedef enum {
148 VDEV_LABEL_CREATE, /* create/add a new device */
149 VDEV_LABEL_REPLACE, /* replace an existing device */
150 VDEV_LABEL_SPARE, /* add a new hot spare */
151 VDEV_LABEL_REMOVE, /* remove an existing device */
152 VDEV_LABEL_L2CACHE, /* add an L2ARC cache device */
153 VDEV_LABEL_SPLIT /* generating new label for split-off dev */
154 } vdev_labeltype_t;
155
156 extern int vdev_label_init(vdev_t *vd, uint64_t txg, vdev_labeltype_t reason);
157
158 #ifdef __cplusplus
159 }
160 #endif
161
162 #endif /* _SYS_VDEV_H */
|
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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
25 */
26
27 #ifndef _SYS_VDEV_H
28 #define _SYS_VDEV_H
29
30 #include <sys/spa.h>
31 #include <sys/zio.h>
32 #include <sys/dmu.h>
33 #include <sys/space_map.h>
34 #include <sys/fs/zfs.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 typedef enum vdev_dtl_type {
41 DTL_MISSING, /* 0% replication: no copies of the data */
125
126 extern void vdev_state_dirty(vdev_t *vd);
127 extern void vdev_state_clean(vdev_t *vd);
128
129 typedef enum vdev_config_flag {
130 VDEV_CONFIG_SPARE = 1 << 0,
131 VDEV_CONFIG_L2CACHE = 1 << 1,
132 VDEV_CONFIG_REMOVING = 1 << 2
133 } vdev_config_flag_t;
134
135 extern void vdev_top_config_generate(spa_t *spa, nvlist_t *config);
136 extern nvlist_t *vdev_config_generate(spa_t *spa, vdev_t *vd,
137 boolean_t getstats, vdev_config_flag_t flags);
138
139 /*
140 * Label routines
141 */
142 struct uberblock;
143 extern uint64_t vdev_label_offset(uint64_t psize, int l, uint64_t offset);
144 extern int vdev_label_number(uint64_t psise, uint64_t offset);
145 extern nvlist_t *vdev_label_read_config(vdev_t *vd, int label);
146 extern void vdev_uberblock_load(vdev_t *, struct uberblock *, nvlist_t **);
147
148 typedef enum {
149 VDEV_LABEL_CREATE, /* create/add a new device */
150 VDEV_LABEL_REPLACE, /* replace an existing device */
151 VDEV_LABEL_SPARE, /* add a new hot spare */
152 VDEV_LABEL_REMOVE, /* remove an existing device */
153 VDEV_LABEL_L2CACHE, /* add an L2ARC cache device */
154 VDEV_LABEL_SPLIT /* generating new label for split-off dev */
155 } vdev_labeltype_t;
156
157 extern int vdev_label_init(vdev_t *vd, uint64_t txg, vdev_labeltype_t reason);
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif /* _SYS_VDEV_H */
|