Deleted Added
full compact
vdev_impl.h (185029) vdev_impl.h (209962)
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

--- 5 unchanged lines hidden (view full) ---

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/*
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

--- 5 unchanged lines hidden (view full) ---

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 2008 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _SYS_VDEV_IMPL_H
27#define _SYS_VDEV_IMPL_H
28
29#include <sys/avl.h>
30#include <sys/dmu.h>

--- 87 unchanged lines hidden (view full) ---

118 uint64_t vdev_prevstate; /* used when reopening a vdev */
119 vdev_ops_t *vdev_ops; /* vdev operations */
120 spa_t *vdev_spa; /* spa for this vdev */
121 void *vdev_tsd; /* type-specific data */
122 vdev_t *vdev_top; /* top-level vdev */
123 vdev_t *vdev_parent; /* parent vdev */
124 vdev_t **vdev_child; /* array of children */
125 uint64_t vdev_children; /* number of children */
23 * Use is subject to license terms.
24 */
25
26#ifndef _SYS_VDEV_IMPL_H
27#define _SYS_VDEV_IMPL_H
28
29#include <sys/avl.h>
30#include <sys/dmu.h>

--- 87 unchanged lines hidden (view full) ---

118 uint64_t vdev_prevstate; /* used when reopening a vdev */
119 vdev_ops_t *vdev_ops; /* vdev operations */
120 spa_t *vdev_spa; /* spa for this vdev */
121 void *vdev_tsd; /* type-specific data */
122 vdev_t *vdev_top; /* top-level vdev */
123 vdev_t *vdev_parent; /* parent vdev */
124 vdev_t **vdev_child; /* array of children */
125 uint64_t vdev_children; /* number of children */
126 space_map_t vdev_dtl_map; /* dirty time log in-core state */
127 space_map_t vdev_dtl_scrub; /* DTL for scrub repair writes */
126 space_map_t vdev_dtl[DTL_TYPES]; /* in-core dirty time logs */
128 vdev_stat_t vdev_stat; /* virtual device statistics */
129
130 /*
131 * Top-level vdev state.
132 */
133 uint64_t vdev_ms_array; /* metaslab array object */
134 uint64_t vdev_ms_shift; /* metaslab size shift */
135 uint64_t vdev_ms_count; /* number of metaslabs */

--- 8 unchanged lines hidden (view full) ---

144 list_node_t vdev_state_dirty_node; /* state dirty list */
145 uint64_t vdev_deflate_ratio; /* deflation ratio (x512) */
146 uint64_t vdev_islog; /* is an intent log device */
147
148 /*
149 * Leaf vdev state.
150 */
151 uint64_t vdev_psize; /* physical device capacity */
127 vdev_stat_t vdev_stat; /* virtual device statistics */
128
129 /*
130 * Top-level vdev state.
131 */
132 uint64_t vdev_ms_array; /* metaslab array object */
133 uint64_t vdev_ms_shift; /* metaslab size shift */
134 uint64_t vdev_ms_count; /* number of metaslabs */

--- 8 unchanged lines hidden (view full) ---

143 list_node_t vdev_state_dirty_node; /* state dirty list */
144 uint64_t vdev_deflate_ratio; /* deflation ratio (x512) */
145 uint64_t vdev_islog; /* is an intent log device */
146
147 /*
148 * Leaf vdev state.
149 */
150 uint64_t vdev_psize; /* physical device capacity */
152 space_map_obj_t vdev_dtl; /* dirty time log on-disk state */
151 space_map_obj_t vdev_dtl_smo; /* dirty time log space map obj */
153 txg_node_t vdev_dtl_node; /* per-txg dirty DTL linkage */
154 uint64_t vdev_wholedisk; /* true if this is a whole disk */
155 uint64_t vdev_offline; /* persistent offline state */
156 uint64_t vdev_faulted; /* persistent faulted state */
157 uint64_t vdev_degraded; /* persistent degraded state */
158 uint64_t vdev_removed; /* persistent removed state */
159 uint64_t vdev_nparity; /* number of parity devices for raidz */
160 char *vdev_path; /* vdev path (if any) */
161 char *vdev_devid; /* vdev devid (if any) */
162 char *vdev_physpath; /* vdev device path (if any) */
152 txg_node_t vdev_dtl_node; /* per-txg dirty DTL linkage */
153 uint64_t vdev_wholedisk; /* true if this is a whole disk */
154 uint64_t vdev_offline; /* persistent offline state */
155 uint64_t vdev_faulted; /* persistent faulted state */
156 uint64_t vdev_degraded; /* persistent degraded state */
157 uint64_t vdev_removed; /* persistent removed state */
158 uint64_t vdev_nparity; /* number of parity devices for raidz */
159 char *vdev_path; /* vdev path (if any) */
160 char *vdev_devid; /* vdev devid (if any) */
161 char *vdev_physpath; /* vdev device path (if any) */
162 char *vdev_fru; /* physical FRU location */
163 uint64_t vdev_not_present; /* not present during import */
164 uint64_t vdev_unspare; /* unspare when resilvering done */
165 hrtime_t vdev_last_try; /* last reopen time */
166 boolean_t vdev_nowritecache; /* true if flushwritecache failed */
167 boolean_t vdev_checkremove; /* temporary online test */
168 boolean_t vdev_forcefault; /* force online fault */
169 uint8_t vdev_tmpoffline; /* device taken offline temporarily? */
170 uint8_t vdev_detached; /* device detached? */

--- 13 unchanged lines hidden (view full) ---

184 * larger in userland, the offsets for the rest fields would be
185 * incorrect.
186 */
187 kmutex_t vdev_dtl_lock; /* vdev_dtl_{map,resilver} */
188 kmutex_t vdev_stat_lock; /* vdev_stat */
189 kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
190};
191
163 uint64_t vdev_not_present; /* not present during import */
164 uint64_t vdev_unspare; /* unspare when resilvering done */
165 hrtime_t vdev_last_try; /* last reopen time */
166 boolean_t vdev_nowritecache; /* true if flushwritecache failed */
167 boolean_t vdev_checkremove; /* temporary online test */
168 boolean_t vdev_forcefault; /* force online fault */
169 uint8_t vdev_tmpoffline; /* device taken offline temporarily? */
170 uint8_t vdev_detached; /* device detached? */

--- 13 unchanged lines hidden (view full) ---

184 * larger in userland, the offsets for the rest fields would be
185 * incorrect.
186 */
187 kmutex_t vdev_dtl_lock; /* vdev_dtl_{map,resilver} */
188 kmutex_t vdev_stat_lock; /* vdev_stat */
189 kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
190};
191
192#define VDEV_SKIP_SIZE (8 << 10)
193#define VDEV_BOOT_HEADER_SIZE (8 << 10)
192#define VDEV_PAD_SIZE (8 << 10)
193/* 2 padding areas (vl_pad1 and vl_pad2) to skip */
194#define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
194#define VDEV_PHYS_SIZE (112 << 10)
195#define VDEV_UBERBLOCK_RING (128 << 10)
196
197#define VDEV_UBERBLOCK_SHIFT(vd) \
198 MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT)
199#define VDEV_UBERBLOCK_COUNT(vd) \
200 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
201#define VDEV_UBERBLOCK_OFFSET(vd, n) \
202 offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(vd)])
203#define VDEV_UBERBLOCK_SIZE(vd) (1ULL << VDEV_UBERBLOCK_SHIFT(vd))
204
195#define VDEV_PHYS_SIZE (112 << 10)
196#define VDEV_UBERBLOCK_RING (128 << 10)
197
198#define VDEV_UBERBLOCK_SHIFT(vd) \
199 MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT)
200#define VDEV_UBERBLOCK_COUNT(vd) \
201 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
202#define VDEV_UBERBLOCK_OFFSET(vd, n) \
203 offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(vd)])
204#define VDEV_UBERBLOCK_SIZE(vd) (1ULL << VDEV_UBERBLOCK_SHIFT(vd))
205
205/* ZFS boot block */
206#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL
207#define VDEV_BOOT_VERSION 1 /* version number */
208
209typedef struct vdev_boot_header {
210 uint64_t vb_magic; /* VDEV_BOOT_MAGIC */
211 uint64_t vb_version; /* VDEV_BOOT_VERSION */
212 uint64_t vb_offset; /* start offset (bytes) */
213 uint64_t vb_size; /* size (bytes) */
214 char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)];
215} vdev_boot_header_t;
216
217typedef struct vdev_phys {
218 char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)];
219 zio_block_tail_t vp_zbt;
220} vdev_phys_t;
221
222typedef struct vdev_label {
206typedef struct vdev_phys {
207 char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)];
208 zio_block_tail_t vp_zbt;
209} vdev_phys_t;
210
211typedef struct vdev_label {
223 char vl_pad[VDEV_SKIP_SIZE]; /* 8K */
224 vdev_boot_header_t vl_boot_header; /* 8K */
212 char vl_pad1[VDEV_PAD_SIZE]; /* 8K */
213 char vl_pad2[VDEV_PAD_SIZE]; /* 8K */
225 vdev_phys_t vl_vdev_phys; /* 112K */
226 char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
227} vdev_label_t; /* 256K total */
228
229/*
230 * vdev_dirty() flags
231 */
232#define VDD_METASLAB 0x01

--- 77 unchanged lines hidden ---
214 vdev_phys_t vl_vdev_phys; /* 112K */
215 char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
216} vdev_label_t; /* 256K total */
217
218/*
219 * vdev_dirty() flags
220 */
221#define VDD_METASLAB 0x01

--- 77 unchanged lines hidden ---