152 ZPOOL_PROP_SIZE,
153 ZPOOL_PROP_CAPACITY,
154 ZPOOL_PROP_ALTROOT,
155 ZPOOL_PROP_HEALTH,
156 ZPOOL_PROP_GUID,
157 ZPOOL_PROP_VERSION,
158 ZPOOL_PROP_BOOTFS,
159 ZPOOL_PROP_DELEGATION,
160 ZPOOL_PROP_AUTOREPLACE,
161 ZPOOL_PROP_CACHEFILE,
162 ZPOOL_PROP_FAILUREMODE,
163 ZPOOL_PROP_LISTSNAPS,
164 ZPOOL_PROP_AUTOEXPAND,
165 ZPOOL_PROP_DEDUPDITTO,
166 ZPOOL_PROP_DEDUPRATIO,
167 ZPOOL_PROP_FREE,
168 ZPOOL_PROP_ALLOCATED,
169 ZPOOL_PROP_READONLY,
170 ZPOOL_PROP_COMMENT,
171 ZPOOL_PROP_EXPANDSZ,
172 ZPOOL_NUM_PROPS
173 } zpool_prop_t;
174
175 /* Small enough to not hog a whole line of printout in zpool(1M). */
176 #define ZPROP_MAX_COMMENT 32
177
178 #define ZPROP_CONT -2
179 #define ZPROP_INVAL -1
180
181 #define ZPROP_VALUE "value"
182 #define ZPROP_SOURCE "source"
183
184 typedef enum {
185 ZPROP_SRC_NONE = 0x1,
186 ZPROP_SRC_DEFAULT = 0x2,
187 ZPROP_SRC_TEMPORARY = 0x4,
188 ZPROP_SRC_LOCAL = 0x8,
189 ZPROP_SRC_INHERITED = 0x10,
190 ZPROP_SRC_RECEIVED = 0x20
191 } zprop_source_t;
226 boolean_t zfs_prop_inheritable(zfs_prop_t);
227 boolean_t zfs_prop_setonce(zfs_prop_t);
228 const char *zfs_prop_to_name(zfs_prop_t);
229 zfs_prop_t zfs_name_to_prop(const char *);
230 boolean_t zfs_prop_user(const char *);
231 boolean_t zfs_prop_userquota(const char *);
232 boolean_t zfs_prop_written(const char *);
233 int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
234 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
235 uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
236 boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
237
238 /*
239 * Pool property functions shared between libzfs and kernel.
240 */
241 zpool_prop_t zpool_name_to_prop(const char *);
242 const char *zpool_prop_to_name(zpool_prop_t);
243 const char *zpool_prop_default_string(zpool_prop_t);
244 uint64_t zpool_prop_default_numeric(zpool_prop_t);
245 boolean_t zpool_prop_readonly(zpool_prop_t);
246 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
247 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
248 uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
249
250 /*
251 * Definitions for the Delegation.
252 */
253 typedef enum {
254 ZFS_DELEG_WHO_UNKNOWN = 0,
255 ZFS_DELEG_USER = 'u',
256 ZFS_DELEG_USER_SETS = 'U',
257 ZFS_DELEG_GROUP = 'g',
258 ZFS_DELEG_GROUP_SETS = 'G',
259 ZFS_DELEG_EVERYONE = 'e',
260 ZFS_DELEG_EVERYONE_SETS = 'E',
261 ZFS_DELEG_CREATE = 'c',
262 ZFS_DELEG_CREATE_SETS = 'C',
263 ZFS_DELEG_NAMED_SET = 's',
264 ZFS_DELEG_NAMED_SET_SETS = 'S'
265 } zfs_deleg_who_type_t;
333 #define SPA_VERSION_9 9ULL
334 #define SPA_VERSION_10 10ULL
335 #define SPA_VERSION_11 11ULL
336 #define SPA_VERSION_12 12ULL
337 #define SPA_VERSION_13 13ULL
338 #define SPA_VERSION_14 14ULL
339 #define SPA_VERSION_15 15ULL
340 #define SPA_VERSION_16 16ULL
341 #define SPA_VERSION_17 17ULL
342 #define SPA_VERSION_18 18ULL
343 #define SPA_VERSION_19 19ULL
344 #define SPA_VERSION_20 20ULL
345 #define SPA_VERSION_21 21ULL
346 #define SPA_VERSION_22 22ULL
347 #define SPA_VERSION_23 23ULL
348 #define SPA_VERSION_24 24ULL
349 #define SPA_VERSION_25 25ULL
350 #define SPA_VERSION_26 26ULL
351 #define SPA_VERSION_27 27ULL
352 #define SPA_VERSION_28 28ULL
353
354 /*
355 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
356 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
357 * and do the appropriate changes. Also bump the version number in
358 * usr/src/grub/capability.
359 */
360 #define SPA_VERSION SPA_VERSION_28
361 #define SPA_VERSION_STRING "28"
362
363 /*
364 * Symbolic names for the changes that caused a SPA_VERSION switch.
365 * Used in the code when checking for presence or absence of a feature.
366 * Feel free to define multiple symbolic names for each version if there
367 * were multiple changes to on-disk structures during that version.
368 *
369 * NOTE: When checking the current SPA_VERSION in your code, be sure
370 * to use spa_version() since it reports the version of the
371 * last synced uberblock. Checking the in-flight version can
372 * be dangerous in some cases.
373 */
374 #define SPA_VERSION_INITIAL SPA_VERSION_1
375 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
376 #define SPA_VERSION_SPARES SPA_VERSION_3
377 #define SPA_VERSION_RAIDZ2 SPA_VERSION_3
378 #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3
379 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
380 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
381 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
392 #define SPA_VERSION_ORIGIN SPA_VERSION_11
393 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
394 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
395 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
396 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
397 #define SPA_VERSION_USERSPACE SPA_VERSION_15
398 #define SPA_VERSION_STMF_PROP SPA_VERSION_16
399 #define SPA_VERSION_RAIDZ3 SPA_VERSION_17
400 #define SPA_VERSION_USERREFS SPA_VERSION_18
401 #define SPA_VERSION_HOLES SPA_VERSION_19
402 #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20
403 #define SPA_VERSION_DEDUP SPA_VERSION_21
404 #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22
405 #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23
406 #define SPA_VERSION_SA SPA_VERSION_24
407 #define SPA_VERSION_SCAN SPA_VERSION_25
408 #define SPA_VERSION_DIR_CLONES SPA_VERSION_26
409 #define SPA_VERSION_DEADLISTS SPA_VERSION_26
410 #define SPA_VERSION_FAST_SNAP SPA_VERSION_27
411 #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28
412
413 /*
414 * ZPL version - rev'd whenever an incompatible on-disk format change
415 * occurs. This is independent of SPA/DMU/ZAP versioning. You must
416 * also update the version_table[] and help message in zfs_prop.c.
417 *
418 * When changing, be sure to teach GRUB how to read the new format!
419 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
420 */
421 #define ZPL_VERSION_1 1ULL
422 #define ZPL_VERSION_2 2ULL
423 #define ZPL_VERSION_3 3ULL
424 #define ZPL_VERSION_4 4ULL
425 #define ZPL_VERSION_5 5ULL
426 #define ZPL_VERSION ZPL_VERSION_5
427 #define ZPL_VERSION_STRING "5"
428
429 #define ZPL_VERSION_INITIAL ZPL_VERSION_1
430 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
431 #define ZPL_VERSION_FUID ZPL_VERSION_3
432 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
489 #define ZPOOL_CONFIG_IS_LOG "is_log"
490 #define ZPOOL_CONFIG_L2CACHE "l2cache"
491 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
492 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
493 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
494 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
495 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
496 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
497 #define ZPOOL_CONFIG_SPLIT "splitcfg"
498 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
499 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
500 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
501 #define ZPOOL_CONFIG_REMOVING "removing"
502 #define ZPOOL_CONFIG_RESILVERING "resilvering"
503 #define ZPOOL_CONFIG_COMMENT "comment"
504 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
505 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
506 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
507 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
508 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
509 /*
510 * The persistent vdev state is stored as separate values rather than a single
511 * 'vdev_state' entry. This is because a device can be in multiple states, such
512 * as offline and degraded.
513 */
514 #define ZPOOL_CONFIG_OFFLINE "offline"
515 #define ZPOOL_CONFIG_FAULTED "faulted"
516 #define ZPOOL_CONFIG_DEGRADED "degraded"
517 #define ZPOOL_CONFIG_REMOVED "removed"
518 #define ZPOOL_CONFIG_FRU "fru"
519 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
520
521 /* Rewind policy parameters */
522 #define ZPOOL_REWIND_POLICY "rewind-policy"
523 #define ZPOOL_REWIND_REQUEST "rewind-request"
524 #define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg"
525 #define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh"
526 #define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh"
527
528 /* Rewind data discovered */
567 VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
568 VDEV_STATE_HEALTHY /* Presumed good */
569 } vdev_state_t;
570
571 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
572
573 /*
574 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
575 * of the vdev stats structure uses these constants to distinguish why.
576 */
577 typedef enum vdev_aux {
578 VDEV_AUX_NONE, /* no error */
579 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
580 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
581 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
582 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
583 VDEV_AUX_TOO_SMALL, /* vdev size is too small */
584 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
585 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
586 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
587 VDEV_AUX_SPARED, /* hot spare used in another pool */
588 VDEV_AUX_ERR_EXCEEDED, /* too many errors */
589 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
590 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */
591 VDEV_AUX_EXTERNAL, /* external diagnosis */
592 VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */
593 } vdev_aux_t;
594
595 /*
596 * pool state. The following states are written to disk as part of the normal
597 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
598 * states are software abstractions used at various levels to communicate
599 * pool state.
600 */
601 typedef enum pool_state {
602 POOL_STATE_ACTIVE = 0, /* In active use */
603 POOL_STATE_EXPORTED, /* Explicitly exported */
604 POOL_STATE_DESTROYED, /* Explicitly destroyed */
605 POOL_STATE_SPARE, /* Reserved for hot spare use */
606 POOL_STATE_L2CACHE, /* Level 2 ARC device */
|
152 ZPOOL_PROP_SIZE,
153 ZPOOL_PROP_CAPACITY,
154 ZPOOL_PROP_ALTROOT,
155 ZPOOL_PROP_HEALTH,
156 ZPOOL_PROP_GUID,
157 ZPOOL_PROP_VERSION,
158 ZPOOL_PROP_BOOTFS,
159 ZPOOL_PROP_DELEGATION,
160 ZPOOL_PROP_AUTOREPLACE,
161 ZPOOL_PROP_CACHEFILE,
162 ZPOOL_PROP_FAILUREMODE,
163 ZPOOL_PROP_LISTSNAPS,
164 ZPOOL_PROP_AUTOEXPAND,
165 ZPOOL_PROP_DEDUPDITTO,
166 ZPOOL_PROP_DEDUPRATIO,
167 ZPOOL_PROP_FREE,
168 ZPOOL_PROP_ALLOCATED,
169 ZPOOL_PROP_READONLY,
170 ZPOOL_PROP_COMMENT,
171 ZPOOL_PROP_EXPANDSZ,
172 ZPOOL_PROP_FREEING,
173 ZPOOL_NUM_PROPS
174 } zpool_prop_t;
175
176 /* Small enough to not hog a whole line of printout in zpool(1M). */
177 #define ZPROP_MAX_COMMENT 32
178
179 #define ZPROP_CONT -2
180 #define ZPROP_INVAL -1
181
182 #define ZPROP_VALUE "value"
183 #define ZPROP_SOURCE "source"
184
185 typedef enum {
186 ZPROP_SRC_NONE = 0x1,
187 ZPROP_SRC_DEFAULT = 0x2,
188 ZPROP_SRC_TEMPORARY = 0x4,
189 ZPROP_SRC_LOCAL = 0x8,
190 ZPROP_SRC_INHERITED = 0x10,
191 ZPROP_SRC_RECEIVED = 0x20
192 } zprop_source_t;
227 boolean_t zfs_prop_inheritable(zfs_prop_t);
228 boolean_t zfs_prop_setonce(zfs_prop_t);
229 const char *zfs_prop_to_name(zfs_prop_t);
230 zfs_prop_t zfs_name_to_prop(const char *);
231 boolean_t zfs_prop_user(const char *);
232 boolean_t zfs_prop_userquota(const char *);
233 boolean_t zfs_prop_written(const char *);
234 int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
235 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
236 uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
237 boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
238
239 /*
240 * Pool property functions shared between libzfs and kernel.
241 */
242 zpool_prop_t zpool_name_to_prop(const char *);
243 const char *zpool_prop_to_name(zpool_prop_t);
244 const char *zpool_prop_default_string(zpool_prop_t);
245 uint64_t zpool_prop_default_numeric(zpool_prop_t);
246 boolean_t zpool_prop_readonly(zpool_prop_t);
247 boolean_t zpool_prop_feature(const char *);
248 boolean_t zpool_prop_unsupported(const char *name);
249 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
250 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
251 uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
252
253 /*
254 * Definitions for the Delegation.
255 */
256 typedef enum {
257 ZFS_DELEG_WHO_UNKNOWN = 0,
258 ZFS_DELEG_USER = 'u',
259 ZFS_DELEG_USER_SETS = 'U',
260 ZFS_DELEG_GROUP = 'g',
261 ZFS_DELEG_GROUP_SETS = 'G',
262 ZFS_DELEG_EVERYONE = 'e',
263 ZFS_DELEG_EVERYONE_SETS = 'E',
264 ZFS_DELEG_CREATE = 'c',
265 ZFS_DELEG_CREATE_SETS = 'C',
266 ZFS_DELEG_NAMED_SET = 's',
267 ZFS_DELEG_NAMED_SET_SETS = 'S'
268 } zfs_deleg_who_type_t;
336 #define SPA_VERSION_9 9ULL
337 #define SPA_VERSION_10 10ULL
338 #define SPA_VERSION_11 11ULL
339 #define SPA_VERSION_12 12ULL
340 #define SPA_VERSION_13 13ULL
341 #define SPA_VERSION_14 14ULL
342 #define SPA_VERSION_15 15ULL
343 #define SPA_VERSION_16 16ULL
344 #define SPA_VERSION_17 17ULL
345 #define SPA_VERSION_18 18ULL
346 #define SPA_VERSION_19 19ULL
347 #define SPA_VERSION_20 20ULL
348 #define SPA_VERSION_21 21ULL
349 #define SPA_VERSION_22 22ULL
350 #define SPA_VERSION_23 23ULL
351 #define SPA_VERSION_24 24ULL
352 #define SPA_VERSION_25 25ULL
353 #define SPA_VERSION_26 26ULL
354 #define SPA_VERSION_27 27ULL
355 #define SPA_VERSION_28 28ULL
356 #define SPA_VERSION_5000 5000ULL
357
358 /*
359 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
360 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
361 * and do the appropriate changes. Also bump the version number in
362 * usr/src/grub/capability.
363 */
364 #define SPA_VERSION SPA_VERSION_5000
365 #define SPA_VERSION_STRING "5000"
366
367 /*
368 * Symbolic names for the changes that caused a SPA_VERSION switch.
369 * Used in the code when checking for presence or absence of a feature.
370 * Feel free to define multiple symbolic names for each version if there
371 * were multiple changes to on-disk structures during that version.
372 *
373 * NOTE: When checking the current SPA_VERSION in your code, be sure
374 * to use spa_version() since it reports the version of the
375 * last synced uberblock. Checking the in-flight version can
376 * be dangerous in some cases.
377 */
378 #define SPA_VERSION_INITIAL SPA_VERSION_1
379 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
380 #define SPA_VERSION_SPARES SPA_VERSION_3
381 #define SPA_VERSION_RAIDZ2 SPA_VERSION_3
382 #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3
383 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
384 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
385 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
396 #define SPA_VERSION_ORIGIN SPA_VERSION_11
397 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
398 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
399 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
400 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
401 #define SPA_VERSION_USERSPACE SPA_VERSION_15
402 #define SPA_VERSION_STMF_PROP SPA_VERSION_16
403 #define SPA_VERSION_RAIDZ3 SPA_VERSION_17
404 #define SPA_VERSION_USERREFS SPA_VERSION_18
405 #define SPA_VERSION_HOLES SPA_VERSION_19
406 #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20
407 #define SPA_VERSION_DEDUP SPA_VERSION_21
408 #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22
409 #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23
410 #define SPA_VERSION_SA SPA_VERSION_24
411 #define SPA_VERSION_SCAN SPA_VERSION_25
412 #define SPA_VERSION_DIR_CLONES SPA_VERSION_26
413 #define SPA_VERSION_DEADLISTS SPA_VERSION_26
414 #define SPA_VERSION_FAST_SNAP SPA_VERSION_27
415 #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28
416 #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28
417 #define SPA_VERSION_FEATURES SPA_VERSION_5000
418
419 #define SPA_VERSION_IS_SUPPORTED(v) \
420 (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
421 ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
422
423 /*
424 * ZPL version - rev'd whenever an incompatible on-disk format change
425 * occurs. This is independent of SPA/DMU/ZAP versioning. You must
426 * also update the version_table[] and help message in zfs_prop.c.
427 *
428 * When changing, be sure to teach GRUB how to read the new format!
429 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
430 */
431 #define ZPL_VERSION_1 1ULL
432 #define ZPL_VERSION_2 2ULL
433 #define ZPL_VERSION_3 3ULL
434 #define ZPL_VERSION_4 4ULL
435 #define ZPL_VERSION_5 5ULL
436 #define ZPL_VERSION ZPL_VERSION_5
437 #define ZPL_VERSION_STRING "5"
438
439 #define ZPL_VERSION_INITIAL ZPL_VERSION_1
440 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
441 #define ZPL_VERSION_FUID ZPL_VERSION_3
442 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
499 #define ZPOOL_CONFIG_IS_LOG "is_log"
500 #define ZPOOL_CONFIG_L2CACHE "l2cache"
501 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
502 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
503 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
504 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
505 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
506 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
507 #define ZPOOL_CONFIG_SPLIT "splitcfg"
508 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
509 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
510 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
511 #define ZPOOL_CONFIG_REMOVING "removing"
512 #define ZPOOL_CONFIG_RESILVERING "resilvering"
513 #define ZPOOL_CONFIG_COMMENT "comment"
514 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
515 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
516 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
517 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
518 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
519 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
520 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
521 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
522 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
523 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
524 /*
525 * The persistent vdev state is stored as separate values rather than a single
526 * 'vdev_state' entry. This is because a device can be in multiple states, such
527 * as offline and degraded.
528 */
529 #define ZPOOL_CONFIG_OFFLINE "offline"
530 #define ZPOOL_CONFIG_FAULTED "faulted"
531 #define ZPOOL_CONFIG_DEGRADED "degraded"
532 #define ZPOOL_CONFIG_REMOVED "removed"
533 #define ZPOOL_CONFIG_FRU "fru"
534 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
535
536 /* Rewind policy parameters */
537 #define ZPOOL_REWIND_POLICY "rewind-policy"
538 #define ZPOOL_REWIND_REQUEST "rewind-request"
539 #define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg"
540 #define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh"
541 #define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh"
542
543 /* Rewind data discovered */
582 VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
583 VDEV_STATE_HEALTHY /* Presumed good */
584 } vdev_state_t;
585
586 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
587
588 /*
589 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
590 * of the vdev stats structure uses these constants to distinguish why.
591 */
592 typedef enum vdev_aux {
593 VDEV_AUX_NONE, /* no error */
594 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
595 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
596 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
597 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
598 VDEV_AUX_TOO_SMALL, /* vdev size is too small */
599 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
600 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
601 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
602 VDEV_AUX_UNSUP_FEAT, /* unsupported features */
603 VDEV_AUX_SPARED, /* hot spare used in another pool */
604 VDEV_AUX_ERR_EXCEEDED, /* too many errors */
605 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
606 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */
607 VDEV_AUX_EXTERNAL, /* external diagnosis */
608 VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */
609 } vdev_aux_t;
610
611 /*
612 * pool state. The following states are written to disk as part of the normal
613 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
614 * states are software abstractions used at various levels to communicate
615 * pool state.
616 */
617 typedef enum pool_state {
618 POOL_STATE_ACTIVE = 0, /* In active use */
619 POOL_STATE_EXPORTED, /* Explicitly exported */
620 POOL_STATE_DESTROYED, /* Explicitly destroyed */
621 POOL_STATE_SPARE, /* Reserved for hot spare use */
622 POOL_STATE_L2CACHE, /* Level 2 ARC device */
|