Print this page
10592 misc. metaslab and vdev related ZoL bug fixes
Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Tony Hutter <hutter2@llnl.gov>
Reviewed by: Kody Kantor <kody.kantor@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
+++ new/usr/src/uts/common/fs/zfs/sys/vdev_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2011, 2018 by Delphix. All rights reserved.
24 24 * Copyright (c) 2017, Intel Corporation.
25 25 */
26 26
27 27 #ifndef _SYS_VDEV_IMPL_H
28 28 #define _SYS_VDEV_IMPL_H
29 29
30 30 #include <sys/avl.h>
31 31 #include <sys/bpobj.h>
32 32 #include <sys/dmu.h>
33 33 #include <sys/metaslab.h>
34 34 #include <sys/nvpair.h>
35 35 #include <sys/space_map.h>
36 36 #include <sys/vdev.h>
37 37 #include <sys/dkio.h>
38 38 #include <sys/uberblock_impl.h>
39 39 #include <sys/vdev_indirect_mapping.h>
40 40 #include <sys/vdev_indirect_births.h>
41 41 #include <sys/vdev_removal.h>
42 42
43 43 #ifdef __cplusplus
44 44 extern "C" {
45 45 #endif
46 46
47 47 /*
48 48 * Virtual device descriptors.
49 49 *
50 50 * All storage pool operations go through the virtual device framework,
51 51 * which provides data replication and I/O scheduling.
52 52 */
53 53
54 54 /*
55 55 * Forward declarations that lots of things need.
56 56 */
57 57 typedef struct vdev_queue vdev_queue_t;
58 58 typedef struct vdev_cache vdev_cache_t;
59 59 typedef struct vdev_cache_entry vdev_cache_entry_t;
60 60 struct abd;
61 61
62 62 extern int zfs_vdev_queue_depth_pct;
63 63 extern int zfs_vdev_def_queue_depth;
64 64 extern uint32_t zfs_vdev_async_write_max_active;
65 65
66 66 /*
67 67 * Virtual device operations
68 68 */
69 69 typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size,
70 70 uint64_t *ashift);
71 71 typedef void vdev_close_func_t(vdev_t *vd);
72 72 typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
73 73 typedef void vdev_io_start_func_t(zio_t *zio);
74 74 typedef void vdev_io_done_func_t(zio_t *zio);
75 75 typedef void vdev_state_change_func_t(vdev_t *vd, int, int);
76 76 typedef void vdev_hold_func_t(vdev_t *vd);
77 77 typedef void vdev_rele_func_t(vdev_t *vd);
78 78
79 79 typedef void vdev_remap_cb_t(uint64_t inner_offset, vdev_t *vd,
80 80 uint64_t offset, uint64_t size, void *arg);
81 81 typedef void vdev_remap_func_t(vdev_t *vd, uint64_t offset, uint64_t size,
82 82 vdev_remap_cb_t callback, void *arg);
83 83 /*
84 84 * Given a target vdev, translates the logical range "in" to the physical
85 85 * range "res"
86 86 */
87 87 typedef void vdev_xlation_func_t(vdev_t *cvd, const range_seg_t *in,
88 88 range_seg_t *res);
89 89
90 90 typedef struct vdev_ops {
91 91 vdev_open_func_t *vdev_op_open;
92 92 vdev_close_func_t *vdev_op_close;
93 93 vdev_asize_func_t *vdev_op_asize;
94 94 vdev_io_start_func_t *vdev_op_io_start;
95 95 vdev_io_done_func_t *vdev_op_io_done;
96 96 vdev_state_change_func_t *vdev_op_state_change;
97 97 vdev_hold_func_t *vdev_op_hold;
98 98 vdev_rele_func_t *vdev_op_rele;
99 99 vdev_remap_func_t *vdev_op_remap;
100 100 /*
101 101 * For translating ranges from non-leaf vdevs (e.g. raidz) to leaves.
102 102 * Used when initializing vdevs. Isn't used by leaf ops.
103 103 */
104 104 vdev_xlation_func_t *vdev_op_xlate;
105 105 char vdev_op_type[16];
106 106 boolean_t vdev_op_leaf;
107 107 } vdev_ops_t;
108 108
109 109 /*
110 110 * Virtual device properties
111 111 */
112 112 struct vdev_cache_entry {
113 113 struct abd *ve_abd;
114 114 uint64_t ve_offset;
115 115 uint64_t ve_lastused;
116 116 avl_node_t ve_offset_node;
117 117 avl_node_t ve_lastused_node;
118 118 uint32_t ve_hits;
119 119 uint16_t ve_missed_update;
120 120 zio_t *ve_fill_io;
121 121 };
122 122
123 123 struct vdev_cache {
124 124 avl_tree_t vc_offset_tree;
125 125 avl_tree_t vc_lastused_tree;
126 126 kmutex_t vc_lock;
127 127 };
128 128
129 129 typedef struct vdev_queue_class {
130 130 uint32_t vqc_active;
131 131
132 132 /*
133 133 * Sorted by offset or timestamp, depending on if the queue is
134 134 * LBA-ordered vs FIFO.
135 135 */
136 136 avl_tree_t vqc_queued_tree;
137 137 } vdev_queue_class_t;
138 138
139 139 struct vdev_queue {
140 140 vdev_t *vq_vdev;
141 141 vdev_queue_class_t vq_class[ZIO_PRIORITY_NUM_QUEUEABLE];
142 142 avl_tree_t vq_active_tree;
143 143 avl_tree_t vq_read_offset_tree;
144 144 avl_tree_t vq_write_offset_tree;
145 145 uint64_t vq_last_offset;
146 146 hrtime_t vq_io_complete_ts; /* time last i/o completed */
147 147 kmutex_t vq_lock;
148 148 };
149 149
150 150 typedef enum vdev_alloc_bias {
151 151 VDEV_BIAS_NONE,
152 152 VDEV_BIAS_LOG, /* dedicated to ZIL data (SLOG) */
153 153 VDEV_BIAS_SPECIAL, /* dedicated to ddt, metadata, and small blks */
154 154 VDEV_BIAS_DEDUP /* dedicated to dedup metadata */
155 155 } vdev_alloc_bias_t;
156 156
157 157
158 158 /*
159 159 * On-disk indirect vdev state.
160 160 *
161 161 * An indirect vdev is described exclusively in the MOS config of a pool.
162 162 * The config for an indirect vdev includes several fields, which are
163 163 * accessed in memory by a vdev_indirect_config_t.
164 164 */
165 165 typedef struct vdev_indirect_config {
166 166 /*
167 167 * Object (in MOS) which contains the indirect mapping. This object
168 168 * contains an array of vdev_indirect_mapping_entry_phys_t ordered by
169 169 * vimep_src. The bonus buffer for this object is a
170 170 * vdev_indirect_mapping_phys_t. This object is allocated when a vdev
171 171 * removal is initiated.
172 172 *
173 173 * Note that this object can be empty if none of the data on the vdev
174 174 * has been copied yet.
175 175 */
176 176 uint64_t vic_mapping_object;
177 177
178 178 /*
179 179 * Object (in MOS) which contains the birth times for the mapping
180 180 * entries. This object contains an array of
181 181 * vdev_indirect_birth_entry_phys_t sorted by vibe_offset. The bonus
182 182 * buffer for this object is a vdev_indirect_birth_phys_t. This object
183 183 * is allocated when a vdev removal is initiated.
184 184 *
185 185 * Note that this object can be empty if none of the vdev has yet been
186 186 * copied.
187 187 */
188 188 uint64_t vic_births_object;
189 189
190 190 /*
191 191 * This is the vdev ID which was removed previous to this vdev, or
192 192 * UINT64_MAX if there are no previously removed vdevs.
193 193 */
194 194 uint64_t vic_prev_indirect_vdev;
195 195 } vdev_indirect_config_t;
196 196
197 197 /*
198 198 * Virtual device descriptor
199 199 */
200 200 struct vdev {
201 201 /*
202 202 * Common to all vdev types.
203 203 */
204 204 uint64_t vdev_id; /* child number in vdev parent */
205 205 uint64_t vdev_guid; /* unique ID for this vdev */
206 206 uint64_t vdev_guid_sum; /* self guid + all child guids */
207 207 uint64_t vdev_orig_guid; /* orig. guid prior to remove */
208 208 uint64_t vdev_asize; /* allocatable device capacity */
209 209 uint64_t vdev_min_asize; /* min acceptable asize */
210 210 uint64_t vdev_max_asize; /* max acceptable asize */
211 211 uint64_t vdev_ashift; /* block alignment shift */
212 212 uint64_t vdev_state; /* see VDEV_STATE_* #defines */
213 213 uint64_t vdev_prevstate; /* used when reopening a vdev */
214 214 vdev_ops_t *vdev_ops; /* vdev operations */
215 215 spa_t *vdev_spa; /* spa for this vdev */
216 216 void *vdev_tsd; /* type-specific data */
217 217 vnode_t *vdev_name_vp; /* vnode for pathname */
218 218 vnode_t *vdev_devid_vp; /* vnode for devid */
219 219 vdev_t *vdev_top; /* top-level vdev */
220 220 vdev_t *vdev_parent; /* parent vdev */
221 221 vdev_t **vdev_child; /* array of children */
222 222 uint64_t vdev_children; /* number of children */
223 223 vdev_stat_t vdev_stat; /* virtual device statistics */
224 224 boolean_t vdev_expanding; /* expand the vdev? */
225 225 boolean_t vdev_reopening; /* reopen in progress? */
226 226 int vdev_open_error; /* error on last open */
227 227 kthread_t *vdev_open_thread; /* thread opening children */
228 228 uint64_t vdev_crtxg; /* txg when top-level was added */
229 229
230 230 /*
231 231 * Top-level vdev state.
232 232 */
233 233 uint64_t vdev_ms_array; /* metaslab array object */
234 234 uint64_t vdev_ms_shift; /* metaslab size shift */
235 235 uint64_t vdev_ms_count; /* number of metaslabs */
236 236 metaslab_group_t *vdev_mg; /* metaslab group */
237 237 metaslab_t **vdev_ms; /* metaslab array */
238 238 txg_list_t vdev_ms_list; /* per-txg dirty metaslab lists */
|
↓ open down ↓ |
238 lines elided |
↑ open up ↑ |
239 239 txg_list_t vdev_dtl_list; /* per-txg dirty DTL lists */
240 240 txg_node_t vdev_txg_node; /* per-txg dirty vdev linkage */
241 241 boolean_t vdev_remove_wanted; /* async remove wanted? */
242 242 boolean_t vdev_probe_wanted; /* async probe wanted? */
243 243 list_node_t vdev_config_dirty_node; /* config dirty list */
244 244 list_node_t vdev_state_dirty_node; /* state dirty list */
245 245 uint64_t vdev_deflate_ratio; /* deflation ratio (x512) */
246 246 uint64_t vdev_islog; /* is an intent log device */
247 247 uint64_t vdev_removing; /* device is being removed? */
248 248 boolean_t vdev_ishole; /* is a hole in the namespace */
249 - kmutex_t vdev_queue_lock; /* protects vdev_queue_depth */
250 249 uint64_t vdev_top_zap;
251 250 vdev_alloc_bias_t vdev_alloc_bias; /* metaslab allocation bias */
252 251
253 252 /* pool checkpoint related */
254 253 space_map_t *vdev_checkpoint_sm; /* contains reserved blocks */
255 254
256 255 boolean_t vdev_initialize_exit_wanted;
257 256 vdev_initializing_state_t vdev_initialize_state;
258 257 kthread_t *vdev_initialize_thread;
259 258 /* Protects vdev_initialize_thread and vdev_initialize_state. */
260 259 kmutex_t vdev_initialize_lock;
261 260 kcondvar_t vdev_initialize_cv;
262 261 uint64_t vdev_initialize_offset[TXG_SIZE];
263 262 uint64_t vdev_initialize_last_offset;
264 263 range_tree_t *vdev_initialize_tree; /* valid while initializing */
265 264 uint64_t vdev_initialize_bytes_est;
266 265 uint64_t vdev_initialize_bytes_done;
267 266 time_t vdev_initialize_action_time; /* start and end time */
268 267
269 268 /* for limiting outstanding I/Os */
270 269 kmutex_t vdev_initialize_io_lock;
271 270 kcondvar_t vdev_initialize_io_cv;
272 271 uint64_t vdev_initialize_inflight;
273 272
274 273 /*
275 274 * Values stored in the config for an indirect or removing vdev.
276 275 */
277 276 vdev_indirect_config_t vdev_indirect_config;
278 277
279 278 /*
280 279 * The vdev_indirect_rwlock protects the vdev_indirect_mapping
281 280 * pointer from changing on indirect vdevs (when it is condensed).
282 281 * Note that removing (not yet indirect) vdevs have different
283 282 * access patterns (the mapping is not accessed from open context,
284 283 * e.g. from zio_read) and locking strategy (e.g. svr_lock).
285 284 */
286 285 krwlock_t vdev_indirect_rwlock;
287 286 vdev_indirect_mapping_t *vdev_indirect_mapping;
288 287 vdev_indirect_births_t *vdev_indirect_births;
289 288
290 289 /*
291 290 * In memory data structures used to manage the obsolete sm, for
292 291 * indirect or removing vdevs.
293 292 *
294 293 * The vdev_obsolete_segments is the in-core record of the segments
295 294 * that are no longer referenced anywhere in the pool (due to
296 295 * being freed or remapped and not referenced by any snapshots).
297 296 * During a sync, segments are added to vdev_obsolete_segments
298 297 * via vdev_indirect_mark_obsolete(); at the end of each sync
|
↓ open down ↓ |
39 lines elided |
↑ open up ↑ |
299 298 * pass, this is appended to vdev_obsolete_sm via
300 299 * vdev_indirect_sync_obsolete(). The vdev_obsolete_lock
301 300 * protects against concurrent modifications of vdev_obsolete_segments
302 301 * from multiple zio threads.
303 302 */
304 303 kmutex_t vdev_obsolete_lock;
305 304 range_tree_t *vdev_obsolete_segments;
306 305 space_map_t *vdev_obsolete_sm;
307 306
308 307 /*
309 - * The queue depth parameters determine how many async writes are
310 - * still pending (i.e. allocated but not yet issued to disk) per
311 - * top-level (vdev_async_write_queue_depth) and the maximum allowed
312 - * (vdev_max_async_write_queue_depth). These values only apply to
313 - * top-level vdevs.
314 - */
315 - uint64_t vdev_async_write_queue_depth;
316 - uint64_t vdev_max_async_write_queue_depth;
317 -
318 - /*
319 308 * Leaf vdev state.
320 309 */
321 310 range_tree_t *vdev_dtl[DTL_TYPES]; /* dirty time logs */
322 311 space_map_t *vdev_dtl_sm; /* dirty time log space map */
323 312 txg_node_t vdev_dtl_node; /* per-txg dirty DTL linkage */
324 313 uint64_t vdev_dtl_object; /* DTL object */
325 314 uint64_t vdev_psize; /* physical device capacity */
326 315 uint64_t vdev_wholedisk; /* true if this is a whole disk */
327 316 uint64_t vdev_offline; /* persistent offline state */
328 317 uint64_t vdev_faulted; /* persistent faulted state */
329 318 uint64_t vdev_degraded; /* persistent degraded state */
330 319 uint64_t vdev_removed; /* persistent removed state */
331 320 uint64_t vdev_resilver_txg; /* persistent resilvering state */
332 321 uint64_t vdev_nparity; /* number of parity devices for raidz */
333 322 char *vdev_path; /* vdev path (if any) */
334 323 char *vdev_devid; /* vdev devid (if any) */
335 324 char *vdev_physpath; /* vdev device path (if any) */
336 325 char *vdev_fru; /* physical FRU location */
337 326 uint64_t vdev_not_present; /* not present during import */
338 327 uint64_t vdev_unspare; /* unspare when resilvering done */
339 328 boolean_t vdev_nowritecache; /* true if flushwritecache failed */
340 329 boolean_t vdev_checkremove; /* temporary online test */
341 330 boolean_t vdev_forcefault; /* force online fault */
342 331 boolean_t vdev_splitting; /* split or repair in progress */
343 332 boolean_t vdev_delayed_close; /* delayed device close? */
344 333 boolean_t vdev_tmpoffline; /* device taken offline temporarily? */
345 334 boolean_t vdev_detached; /* device detached? */
346 335 boolean_t vdev_cant_read; /* vdev is failing all reads */
347 336 boolean_t vdev_cant_write; /* vdev is failing all writes */
348 337 boolean_t vdev_isspare; /* was a hot spare */
349 338 boolean_t vdev_isl2cache; /* was a l2cache device */
350 339 vdev_queue_t vdev_queue; /* I/O deadline schedule queue */
351 340 vdev_cache_t vdev_cache; /* physical block cache */
352 341 spa_aux_vdev_t *vdev_aux; /* for l2cache and spares vdevs */
353 342 zio_t *vdev_probe_zio; /* root of current probe */
354 343 vdev_aux_t vdev_label_aux; /* on-disk aux state */
355 344 uint64_t vdev_leaf_zap;
356 345 hrtime_t vdev_mmp_pending; /* 0 if write finished */
357 346 uint64_t vdev_mmp_kstat_id; /* to find kstat entry */
358 347 list_node_t vdev_leaf_node; /* leaf vdev list */
359 348
360 349 /*
361 350 * For DTrace to work in userland (libzpool) context, these fields must
362 351 * remain at the end of the structure. DTrace will use the kernel's
363 352 * CTF definition for 'struct vdev', and since the size of a kmutex_t is
364 353 * larger in userland, the offsets for the rest of the fields would be
365 354 * incorrect.
366 355 */
367 356 kmutex_t vdev_dtl_lock; /* vdev_dtl_{map,resilver} */
368 357 kmutex_t vdev_stat_lock; /* vdev_stat */
369 358 kmutex_t vdev_probe_lock; /* protects vdev_probe_zio */
370 359 };
371 360
372 361 #define VDEV_RAIDZ_MAXPARITY 3
373 362
374 363 #define VDEV_PAD_SIZE (8 << 10)
375 364 /* 2 padding areas (vl_pad1 and vl_pad2) to skip */
376 365 #define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2
377 366 #define VDEV_PHYS_SIZE (112 << 10)
378 367 #define VDEV_UBERBLOCK_RING (128 << 10)
379 368
380 369 /*
381 370 * MMP blocks occupy the last MMP_BLOCKS_PER_LABEL slots in the uberblock
382 371 * ring when MMP is enabled.
383 372 */
384 373 #define MMP_BLOCKS_PER_LABEL 1
385 374
386 375 /* The largest uberblock we support is 8k. */
387 376 #define MAX_UBERBLOCK_SHIFT (13)
388 377 #define VDEV_UBERBLOCK_SHIFT(vd) \
389 378 MIN(MAX((vd)->vdev_top->vdev_ashift, UBERBLOCK_SHIFT), \
390 379 MAX_UBERBLOCK_SHIFT)
391 380 #define VDEV_UBERBLOCK_COUNT(vd) \
392 381 (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(vd))
393 382 #define VDEV_UBERBLOCK_OFFSET(vd, n) \
394 383 offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(vd)])
395 384 #define VDEV_UBERBLOCK_SIZE(vd) (1ULL << VDEV_UBERBLOCK_SHIFT(vd))
396 385
397 386 typedef struct vdev_phys {
398 387 char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_eck_t)];
399 388 zio_eck_t vp_zbt;
400 389 } vdev_phys_t;
401 390
402 391 typedef struct vdev_label {
403 392 char vl_pad1[VDEV_PAD_SIZE]; /* 8K */
404 393 char vl_pad2[VDEV_PAD_SIZE]; /* 8K */
405 394 vdev_phys_t vl_vdev_phys; /* 112K */
406 395 char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */
407 396 } vdev_label_t; /* 256K total */
408 397
409 398 /*
410 399 * vdev_dirty() flags
411 400 */
412 401 #define VDD_METASLAB 0x01
413 402 #define VDD_DTL 0x02
414 403
415 404 /* Offset of embedded boot loader region on each label */
416 405 #define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
417 406 /*
418 407 * Size of embedded boot loader region on each label.
419 408 * The total size of the first two labels plus the boot area is 4MB.
420 409 */
421 410 #define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
422 411
423 412 /*
424 413 * Size of label regions at the start and end of each leaf device.
425 414 */
426 415 #define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE)
427 416 #define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t))
428 417 #define VDEV_LABELS 4
429 418 #define VDEV_BEST_LABEL VDEV_LABELS
430 419
431 420 #define VDEV_ALLOC_LOAD 0
432 421 #define VDEV_ALLOC_ADD 1
433 422 #define VDEV_ALLOC_SPARE 2
434 423 #define VDEV_ALLOC_L2CACHE 3
435 424 #define VDEV_ALLOC_ROOTPOOL 4
436 425 #define VDEV_ALLOC_SPLIT 5
437 426 #define VDEV_ALLOC_ATTACH 6
438 427
439 428 /*
440 429 * Allocate or free a vdev
441 430 */
442 431 extern vdev_t *vdev_alloc_common(spa_t *spa, uint_t id, uint64_t guid,
443 432 vdev_ops_t *ops);
444 433 extern int vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *config,
445 434 vdev_t *parent, uint_t id, int alloctype);
446 435 extern void vdev_free(vdev_t *vd);
447 436
448 437 /*
449 438 * Add or remove children and parents
450 439 */
451 440 extern void vdev_add_child(vdev_t *pvd, vdev_t *cvd);
452 441 extern void vdev_remove_child(vdev_t *pvd, vdev_t *cvd);
453 442 extern void vdev_compact_children(vdev_t *pvd);
454 443 extern vdev_t *vdev_add_parent(vdev_t *cvd, vdev_ops_t *ops);
455 444 extern void vdev_remove_parent(vdev_t *cvd);
456 445
457 446 /*
458 447 * vdev sync load and sync
459 448 */
460 449 extern boolean_t vdev_log_state_valid(vdev_t *vd);
461 450 extern int vdev_load(vdev_t *vd);
462 451 extern int vdev_dtl_load(vdev_t *vd);
463 452 extern void vdev_sync(vdev_t *vd, uint64_t txg);
464 453 extern void vdev_sync_done(vdev_t *vd, uint64_t txg);
465 454 extern void vdev_dirty(vdev_t *vd, int flags, void *arg, uint64_t txg);
466 455 extern void vdev_dirty_leaves(vdev_t *vd, int flags, uint64_t txg);
467 456
468 457 /*
469 458 * Available vdev types.
470 459 */
471 460 extern vdev_ops_t vdev_root_ops;
472 461 extern vdev_ops_t vdev_mirror_ops;
473 462 extern vdev_ops_t vdev_replacing_ops;
474 463 extern vdev_ops_t vdev_raidz_ops;
475 464 extern vdev_ops_t vdev_disk_ops;
476 465 extern vdev_ops_t vdev_file_ops;
477 466 extern vdev_ops_t vdev_missing_ops;
478 467 extern vdev_ops_t vdev_hole_ops;
479 468 extern vdev_ops_t vdev_spare_ops;
480 469 extern vdev_ops_t vdev_indirect_ops;
481 470
482 471 /*
483 472 * Common size functions
484 473 */
485 474 extern void vdev_default_xlate(vdev_t *vd, const range_seg_t *in,
486 475 range_seg_t *out);
487 476 extern uint64_t vdev_default_asize(vdev_t *vd, uint64_t psize);
488 477 extern uint64_t vdev_get_min_asize(vdev_t *vd);
489 478 extern void vdev_set_min_asize(vdev_t *vd);
490 479
491 480 /*
492 481 * Global variables
493 482 */
494 483 extern int vdev_standard_sm_blksz;
495 484 /* zdb uses this tunable, so it must be declared here to make lint happy. */
496 485 extern int zfs_vdev_cache_size;
497 486
498 487 /*
499 488 * Functions from vdev_indirect.c
500 489 */
501 490 extern void vdev_indirect_sync_obsolete(vdev_t *vd, dmu_tx_t *tx);
502 491 extern boolean_t vdev_indirect_should_condense(vdev_t *vd);
503 492 extern void spa_condense_indirect_start_sync(vdev_t *vd, dmu_tx_t *tx);
504 493 extern int vdev_obsolete_sm_object(vdev_t *vd);
505 494 extern boolean_t vdev_obsolete_counts_are_precise(vdev_t *vd);
506 495
507 496 /*
508 497 * Other miscellaneous functions
509 498 */
510 499 int vdev_checkpoint_sm_object(vdev_t *vd);
511 500
512 501 /*
513 502 * The vdev_buf_t is used to translate between zio_t and buf_t, and back again.
514 503 */
515 504 typedef struct vdev_buf {
516 505 buf_t vb_buf; /* buffer that describes the io */
517 506 zio_t *vb_io; /* pointer back to the original zio_t */
518 507 } vdev_buf_t;
519 508
520 509 #ifdef __cplusplus
521 510 }
522 511 #endif
523 512
524 513 #endif /* _SYS_VDEV_IMPL_H */
|
↓ open down ↓ |
196 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX