185 boolean_t vdev_checkremove; /* temporary online test */
186 boolean_t vdev_forcefault; /* force online fault */
187 boolean_t vdev_splitting; /* split or repair in progress */
188 boolean_t vdev_delayed_close; /* delayed device close? */
189 uint8_t vdev_tmpoffline; /* device taken offline temporarily? */
190 uint8_t vdev_detached; /* device detached? */
191 uint8_t vdev_cant_read; /* vdev is failing all reads */
192 uint8_t vdev_cant_write; /* vdev is failing all writes */
193 uint64_t vdev_isspare; /* was a hot spare */
194 uint64_t vdev_isl2cache; /* was a l2cache device */
195 vdev_queue_t vdev_queue; /* I/O deadline schedule queue */
196 vdev_cache_t vdev_cache; /* physical block cache */
197 spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */
198 zio_t *vdev_probe_zio; /* root of current probe */
199 vdev_aux_t vdev_label_aux; /* on-disk aux state */
200
201 /*
202 * For DTrace to work in userland (libzpool) context, these fields must
203 * remain at the end of the structure. DTrace will use the kernel's
204 * CTF definition for 'struct vdev', and since the size of a kmutex_t is
205 * larger in userland, the offsets for the rest fields would be
206 * incorrect.
207 */
208 kmutex_t vdev_dtl_lock; /* vdev_dtl_{map,resilver} */
209 kmutex_t vdev_stat_lock; /* vdev_stat */
210 kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
211 };
212
213 #define VDEV_RAIDZ_MAXPARITY 3
214
215 #define VDEV_PAD_SIZE (8 << 10)
216 /* 2 padding areas (vl_pad1 and vl_pad2) to skip */
217 #define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
218 #define VDEV_PHYS_SIZE (112 << 10)
219 #define VDEV_UBERBLOCK_RING (128 << 10)
220
221 #define VDEV_UBERBLOCK_SHIFT(vd) \
222 MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT)
223 #define VDEV_UBERBLOCK_COUNT(vd) \
224 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
225 #define VDEV_UBERBLOCK_OFFSET(vd, n) \
240
241 /*
242 * vdev_dirty() flags
243 */
244 #define VDD_METASLAB 0x01
245 #define VDD_DTL 0x02
246
247 /*
248 * Size and offset of embedded boot loader region on each label.
249 * The total size of the first two labels plus the boot area is 4MB.
250 */
251 #define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
252 #define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
253
254 /*
255 * Size of label regions at the start and end of each leaf device.
256 */
257 #define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE)
258 #define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t))
259 #define VDEV_LABELS 4
260
261 #define VDEV_ALLOC_LOAD 0
262 #define VDEV_ALLOC_ADD 1
263 #define VDEV_ALLOC_SPARE 2
264 #define VDEV_ALLOC_L2CACHE 3
265 #define VDEV_ALLOC_ROOTPOOL 4
266 #define VDEV_ALLOC_SPLIT 5
267 #define VDEV_ALLOC_ATTACH 6
268
269 /*
270 * Allocate or free a vdev
271 */
272 extern vdev_t *vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid,
273 vdev_ops_t *ops);
274 extern int vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *config,
275 vdev_t *parent, uint_t id, int alloctype);
276 extern void vdev_free(vdev_t *vd);
277
278 /*
279 * Add or remove children and parents
|
185 boolean_t vdev_checkremove; /* temporary online test */
186 boolean_t vdev_forcefault; /* force online fault */
187 boolean_t vdev_splitting; /* split or repair in progress */
188 boolean_t vdev_delayed_close; /* delayed device close? */
189 uint8_t vdev_tmpoffline; /* device taken offline temporarily? */
190 uint8_t vdev_detached; /* device detached? */
191 uint8_t vdev_cant_read; /* vdev is failing all reads */
192 uint8_t vdev_cant_write; /* vdev is failing all writes */
193 uint64_t vdev_isspare; /* was a hot spare */
194 uint64_t vdev_isl2cache; /* was a l2cache device */
195 vdev_queue_t vdev_queue; /* I/O deadline schedule queue */
196 vdev_cache_t vdev_cache; /* physical block cache */
197 spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */
198 zio_t *vdev_probe_zio; /* root of current probe */
199 vdev_aux_t vdev_label_aux; /* on-disk aux state */
200
201 /*
202 * For DTrace to work in userland (libzpool) context, these fields must
203 * remain at the end of the structure. DTrace will use the kernel's
204 * CTF definition for 'struct vdev', and since the size of a kmutex_t is
205 * larger in userland, the offsets for the rest of the fields would be
206 * incorrect.
207 */
208 kmutex_t vdev_dtl_lock; /* vdev_dtl_{map,resilver} */
209 kmutex_t vdev_stat_lock; /* vdev_stat */
210 kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
211 };
212
213 #define VDEV_RAIDZ_MAXPARITY 3
214
215 #define VDEV_PAD_SIZE (8 << 10)
216 /* 2 padding areas (vl_pad1 and vl_pad2) to skip */
217 #define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
218 #define VDEV_PHYS_SIZE (112 << 10)
219 #define VDEV_UBERBLOCK_RING (128 << 10)
220
221 #define VDEV_UBERBLOCK_SHIFT(vd) \
222 MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT)
223 #define VDEV_UBERBLOCK_COUNT(vd) \
224 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
225 #define VDEV_UBERBLOCK_OFFSET(vd, n) \
240
241 /*
242 * vdev_dirty() flags
243 */
244 #define VDD_METASLAB 0x01
245 #define VDD_DTL 0x02
246
247 /*
248 * Size and offset of embedded boot loader region on each label.
249 * The total size of the first two labels plus the boot area is 4MB.
250 */
251 #define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
252 #define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
253
254 /*
255 * Size of label regions at the start and end of each leaf device.
256 */
257 #define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE)
258 #define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t))
259 #define VDEV_LABELS 4
260 #define VDEV_BEST_LABEL VDEV_LABELS
261
262 #define VDEV_ALLOC_LOAD 0
263 #define VDEV_ALLOC_ADD 1
264 #define VDEV_ALLOC_SPARE 2
265 #define VDEV_ALLOC_L2CACHE 3
266 #define VDEV_ALLOC_ROOTPOOL 4
267 #define VDEV_ALLOC_SPLIT 5
268 #define VDEV_ALLOC_ATTACH 6
269
270 /*
271 * Allocate or free a vdev
272 */
273 extern vdev_t *vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid,
274 vdev_ops_t *ops);
275 extern int vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *config,
276 vdev_t *parent, uint_t id, int alloctype);
277 extern void vdev_free(vdev_t *vd);
278
279 /*
280 * Add or remove children and parents
|