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.
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.
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]
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright (c) 2013, 2017 Joyent, Inc. All rights reserved.
27 * Copyright (c) 2014 Integros [integros.com]
28 * Copyright (c) 2017 Datto Inc.
31 /* Portions Copyright 2010 Robert Milkowski */
37 #include <sys/zio_priority.h>
44 * Types and constants shared between userland and the kernel.
48 * Each dataset can be one of the following types. These constants can be
49 * combined into masks that can be passed to various functions.
52 ZFS_TYPE_FILESYSTEM
= (1 << 0),
53 ZFS_TYPE_SNAPSHOT
= (1 << 1),
54 ZFS_TYPE_VOLUME
= (1 << 2),
55 ZFS_TYPE_POOL
= (1 << 3),
56 ZFS_TYPE_BOOKMARK
= (1 << 4)
60 * NB: lzc_dataset_type should be updated whenever a new objset type is added,
61 * if it represents a real type of a dataset that can be created from userland.
63 typedef enum dmu_objset_type
{
68 DMU_OST_OTHER
, /* For testing only! */
69 DMU_OST_ANY
, /* Be careful! */
73 #define ZFS_TYPE_DATASET \
74 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
77 * All of these include the terminating NUL byte.
79 #define ZAP_MAXNAMELEN 256
80 #define ZAP_MAXVALUELEN (1024 * 8)
81 #define ZAP_OLDMAXVALUELEN 1024
82 #define ZFS_MAX_DATASET_NAME_LEN 256
85 * Dataset properties are identified by these constants and must be added to
86 * the end of this list to ensure that external consumers are not affected
87 * by the change. If you make any changes to this list, be sure to update
88 * the property table in module/zcommon/zfs_prop.c.
98 ZFS_PROP_COMPRESSRATIO
,
102 ZFS_PROP_RESERVATION
,
104 ZFS_PROP_VOLBLOCKSIZE
,
109 ZFS_PROP_COMPRESSION
,
117 ZFS_PROP_PRIVATE
, /* not exposed to user, temporary */
120 ZFS_PROP_NAME
, /* not exposed to the user */
122 ZFS_PROP_ISCSIOPTIONS
, /* not exposed to the user */
124 ZFS_PROP_NUMCLONES
, /* not exposed to the user */
134 ZFS_PROP_REFRESERVATION
,
136 ZFS_PROP_PRIMARYCACHE
,
137 ZFS_PROP_SECONDARYCACHE
,
141 ZFS_PROP_USEDREFRESERV
,
142 ZFS_PROP_USERACCOUNTING
, /* not exposed to the user */
143 ZFS_PROP_STMF_SHAREINFO
, /* not exposed to the user */
144 ZFS_PROP_DEFER_DESTROY
,
147 ZFS_PROP_UNIQUE
, /* not exposed to the user */
148 ZFS_PROP_OBJSETID
, /* not exposed to the user */
156 ZFS_PROP_LOGICALUSED
,
157 ZFS_PROP_LOGICALREFERENCED
,
158 ZFS_PROP_INCONSISTENT
, /* not exposed to the user */
160 ZFS_PROP_FILESYSTEM_LIMIT
,
161 ZFS_PROP_SNAPSHOT_LIMIT
,
162 ZFS_PROP_FILESYSTEM_COUNT
,
163 ZFS_PROP_SNAPSHOT_COUNT
,
166 ZFS_PROP_SELINUX_CONTEXT
,
167 ZFS_PROP_SELINUX_FSCONTEXT
,
168 ZFS_PROP_SELINUX_DEFCONTEXT
,
169 ZFS_PROP_SELINUX_ROOTCONTEXT
,
171 ZFS_PROP_REDUNDANT_METADATA
,
174 ZFS_PROP_RECEIVE_RESUME_TOKEN
,
176 ZFS_PROP_KEYLOCATION
,
178 ZFS_PROP_PBKDF2_SALT
,
179 ZFS_PROP_PBKDF2_ITERS
,
180 ZFS_PROP_ENCRYPTION_ROOT
,
191 ZFS_PROP_USEROBJUSED
,
192 ZFS_PROP_USEROBJQUOTA
,
193 ZFS_PROP_GROUPOBJUSED
,
194 ZFS_PROP_GROUPOBJQUOTA
,
195 ZFS_NUM_USERQUOTA_PROPS
196 } zfs_userquota_prop_t
;
198 extern const char *zfs_userquota_prop_prefixes
[ZFS_NUM_USERQUOTA_PROPS
];
201 * Pool properties are identified by these constants and must be added to the
202 * end of this list to ensure that external consumers are not affected
203 * by the change. If you make any changes to this list, be sure to update
204 * the property table in module/zcommon/zpool_prop.c.
207 ZPOOL_PROP_INVAL
= -1,
216 ZPOOL_PROP_DELEGATION
,
217 ZPOOL_PROP_AUTOREPLACE
,
218 ZPOOL_PROP_CACHEFILE
,
219 ZPOOL_PROP_FAILUREMODE
,
220 ZPOOL_PROP_LISTSNAPS
,
221 ZPOOL_PROP_AUTOEXPAND
,
222 ZPOOL_PROP_DEDUPDITTO
,
223 ZPOOL_PROP_DEDUPRATIO
,
225 ZPOOL_PROP_ALLOCATED
,
231 ZPOOL_PROP_FRAGMENTATION
,
233 ZPOOL_PROP_MAXBLOCKSIZE
,
235 ZPOOL_PROP_MAXDNODESIZE
,
236 ZPOOL_PROP_MULTIHOST
,
240 /* Small enough to not hog a whole line of printout in zpool(1M). */
241 #define ZPROP_MAX_COMMENT 32
243 #define ZPROP_VALUE "value"
244 #define ZPROP_SOURCE "source"
247 ZPROP_SRC_NONE
= 0x1,
248 ZPROP_SRC_DEFAULT
= 0x2,
249 ZPROP_SRC_TEMPORARY
= 0x4,
250 ZPROP_SRC_LOCAL
= 0x8,
251 ZPROP_SRC_INHERITED
= 0x10,
252 ZPROP_SRC_RECEIVED
= 0x20
255 #define ZPROP_SRC_ALL 0x3f
257 #define ZPROP_SOURCE_VAL_RECVD "$recvd"
258 #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS"
261 * Dataset flag implemented as a special entry in the props zap object
262 * indicating that the dataset has received properties on or after
263 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
264 * just as it did in earlier versions, and thereafter, local properties are
267 #define ZPROP_HAS_RECVD "$hasrecvd"
270 ZPROP_ERR_NOCLEAR
= 0x1, /* failure to clear existing props */
271 ZPROP_ERR_NORESTORE
= 0x2 /* failure to restore props on error */
274 typedef int (*zprop_func
)(int, void *);
277 * Properties to be set on the root file system of a new pool
278 * are stuffed into their own nvlist, which is then included in
279 * the properties nvlist with the pool properties.
281 #define ZPOOL_ROOTFS_PROPS "root-props-nvl"
284 * Length of 'written@' and 'written#'
286 #define ZFS_WRITTEN_PROP_PREFIX_LEN 8
289 * Dataset property functions shared between libzfs and kernel.
291 const char *zfs_prop_default_string(zfs_prop_t
);
292 uint64_t zfs_prop_default_numeric(zfs_prop_t
);
293 boolean_t
zfs_prop_readonly(zfs_prop_t
);
294 boolean_t
zfs_prop_visible(zfs_prop_t prop
);
295 boolean_t
zfs_prop_inheritable(zfs_prop_t
);
296 boolean_t
zfs_prop_setonce(zfs_prop_t
);
297 boolean_t
zfs_prop_encryption_key_param(zfs_prop_t
);
298 boolean_t
zfs_prop_valid_keylocation(const char *, boolean_t
);
299 const char *zfs_prop_to_name(zfs_prop_t
);
300 zfs_prop_t
zfs_name_to_prop(const char *);
301 boolean_t
zfs_prop_user(const char *);
302 boolean_t
zfs_prop_userquota(const char *);
303 boolean_t
zfs_prop_written(const char *);
304 int zfs_prop_index_to_string(zfs_prop_t
, uint64_t, const char **);
305 int zfs_prop_string_to_index(zfs_prop_t
, const char *, uint64_t *);
306 uint64_t zfs_prop_random_value(zfs_prop_t
, uint64_t seed
);
307 boolean_t
zfs_prop_valid_for_type(int, zfs_type_t
, boolean_t
);
310 * Pool property functions shared between libzfs and kernel.
312 zpool_prop_t
zpool_name_to_prop(const char *);
313 const char *zpool_prop_to_name(zpool_prop_t
);
314 const char *zpool_prop_default_string(zpool_prop_t
);
315 uint64_t zpool_prop_default_numeric(zpool_prop_t
);
316 boolean_t
zpool_prop_readonly(zpool_prop_t
);
317 boolean_t
zpool_prop_feature(const char *);
318 boolean_t
zpool_prop_unsupported(const char *);
319 int zpool_prop_index_to_string(zpool_prop_t
, uint64_t, const char **);
320 int zpool_prop_string_to_index(zpool_prop_t
, const char *, uint64_t *);
321 uint64_t zpool_prop_random_value(zpool_prop_t
, uint64_t seed
);
324 * Definitions for the Delegation.
327 ZFS_DELEG_WHO_UNKNOWN
= 0,
328 ZFS_DELEG_USER
= 'u',
329 ZFS_DELEG_USER_SETS
= 'U',
330 ZFS_DELEG_GROUP
= 'g',
331 ZFS_DELEG_GROUP_SETS
= 'G',
332 ZFS_DELEG_EVERYONE
= 'e',
333 ZFS_DELEG_EVERYONE_SETS
= 'E',
334 ZFS_DELEG_CREATE
= 'c',
335 ZFS_DELEG_CREATE_SETS
= 'C',
336 ZFS_DELEG_NAMED_SET
= 's',
337 ZFS_DELEG_NAMED_SET_SETS
= 'S'
338 } zfs_deleg_who_type_t
;
342 ZFS_DELEG_PERM_LOCAL
= 1,
343 ZFS_DELEG_PERM_DESCENDENT
= 2,
344 ZFS_DELEG_PERM_LOCALDESCENDENT
= 3,
345 ZFS_DELEG_PERM_CREATE
= 4
346 } zfs_deleg_inherit_t
;
348 #define ZFS_DELEG_PERM_UID "uid"
349 #define ZFS_DELEG_PERM_GID "gid"
350 #define ZFS_DELEG_PERM_GROUPS "groups"
352 #define ZFS_MLSLABEL_DEFAULT "none"
354 #define ZFS_SMB_ACL_SRC "src"
355 #define ZFS_SMB_ACL_TARGET "target"
358 ZFS_CANMOUNT_OFF
= 0,
360 ZFS_CANMOUNT_NOAUTO
= 2
361 } zfs_canmount_type_t
;
364 ZFS_LOGBIAS_LATENCY
= 0,
365 ZFS_LOGBIAS_THROUGHPUT
= 1
368 typedef enum zfs_share_op
{
375 typedef enum zfs_smb_acl_op
{
382 typedef enum zfs_cache_type
{
384 ZFS_CACHE_METADATA
= 1,
389 ZFS_SYNC_STANDARD
= 0,
391 ZFS_SYNC_DISABLED
= 2
401 ZFS_DNSIZE_LEGACY
= 0,
403 ZFS_DNSIZE_1K
= 1024,
404 ZFS_DNSIZE_2K
= 2048,
405 ZFS_DNSIZE_4K
= 4096,
406 ZFS_DNSIZE_8K
= 8192,
407 ZFS_DNSIZE_16K
= 16384
411 ZFS_REDUNDANT_METADATA_ALL
,
412 ZFS_REDUNDANT_METADATA_MOST
413 } zfs_redundant_metadata_type_t
;
416 ZFS_VOLMODE_DEFAULT
= 0,
417 ZFS_VOLMODE_GEOM
= 1,
422 typedef enum zfs_keystatus
{
423 ZFS_KEYSTATUS_NONE
= 0,
424 ZFS_KEYSTATUS_UNAVAILABLE
,
425 ZFS_KEYSTATUS_AVAILABLE
,
428 typedef enum zfs_keyformat
{
429 ZFS_KEYFORMAT_NONE
= 0,
432 ZFS_KEYFORMAT_PASSPHRASE
,
433 ZFS_KEYFORMAT_FORMATS
436 typedef enum zfs_key_location
{
437 ZFS_KEYLOCATION_NONE
= 0,
438 ZFS_KEYLOCATION_PROMPT
,
440 ZFS_KEYLOCATION_LOCATIONS
443 #define DEFAULT_PBKDF2_ITERATIONS 350000
444 #define MIN_PBKDF2_ITERATIONS 100000
447 * On-disk version number.
449 #define SPA_VERSION_1 1ULL
450 #define SPA_VERSION_2 2ULL
451 #define SPA_VERSION_3 3ULL
452 #define SPA_VERSION_4 4ULL
453 #define SPA_VERSION_5 5ULL
454 #define SPA_VERSION_6 6ULL
455 #define SPA_VERSION_7 7ULL
456 #define SPA_VERSION_8 8ULL
457 #define SPA_VERSION_9 9ULL
458 #define SPA_VERSION_10 10ULL
459 #define SPA_VERSION_11 11ULL
460 #define SPA_VERSION_12 12ULL
461 #define SPA_VERSION_13 13ULL
462 #define SPA_VERSION_14 14ULL
463 #define SPA_VERSION_15 15ULL
464 #define SPA_VERSION_16 16ULL
465 #define SPA_VERSION_17 17ULL
466 #define SPA_VERSION_18 18ULL
467 #define SPA_VERSION_19 19ULL
468 #define SPA_VERSION_20 20ULL
469 #define SPA_VERSION_21 21ULL
470 #define SPA_VERSION_22 22ULL
471 #define SPA_VERSION_23 23ULL
472 #define SPA_VERSION_24 24ULL
473 #define SPA_VERSION_25 25ULL
474 #define SPA_VERSION_26 26ULL
475 #define SPA_VERSION_27 27ULL
476 #define SPA_VERSION_28 28ULL
477 #define SPA_VERSION_5000 5000ULL
480 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
481 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
482 * and do the appropriate changes. Also bump the version number in
483 * usr/src/grub/capability.
485 #define SPA_VERSION SPA_VERSION_5000
486 #define SPA_VERSION_STRING "5000"
489 * Symbolic names for the changes that caused a SPA_VERSION switch.
490 * Used in the code when checking for presence or absence of a feature.
491 * Feel free to define multiple symbolic names for each version if there
492 * were multiple changes to on-disk structures during that version.
494 * NOTE: When checking the current SPA_VERSION in your code, be sure
495 * to use spa_version() since it reports the version of the
496 * last synced uberblock. Checking the in-flight version can
497 * be dangerous in some cases.
499 #define SPA_VERSION_INITIAL SPA_VERSION_1
500 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
501 #define SPA_VERSION_SPARES SPA_VERSION_3
502 #define SPA_VERSION_RAIDZ2 SPA_VERSION_3
503 #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3
504 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
505 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
506 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
507 #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
508 #define SPA_VERSION_BOOTFS SPA_VERSION_6
509 #define SPA_VERSION_SLOGS SPA_VERSION_7
510 #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8
511 #define SPA_VERSION_FUID SPA_VERSION_9
512 #define SPA_VERSION_REFRESERVATION SPA_VERSION_9
513 #define SPA_VERSION_REFQUOTA SPA_VERSION_9
514 #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9
515 #define SPA_VERSION_L2CACHE SPA_VERSION_10
516 #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11
517 #define SPA_VERSION_ORIGIN SPA_VERSION_11
518 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
519 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
520 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
521 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
522 #define SPA_VERSION_USERSPACE SPA_VERSION_15
523 #define SPA_VERSION_STMF_PROP SPA_VERSION_16
524 #define SPA_VERSION_RAIDZ3 SPA_VERSION_17
525 #define SPA_VERSION_USERREFS SPA_VERSION_18
526 #define SPA_VERSION_HOLES SPA_VERSION_19
527 #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20
528 #define SPA_VERSION_DEDUP SPA_VERSION_21
529 #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22
530 #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23
531 #define SPA_VERSION_SA SPA_VERSION_24
532 #define SPA_VERSION_SCAN SPA_VERSION_25
533 #define SPA_VERSION_DIR_CLONES SPA_VERSION_26
534 #define SPA_VERSION_DEADLISTS SPA_VERSION_26
535 #define SPA_VERSION_FAST_SNAP SPA_VERSION_27
536 #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28
537 #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28
538 #define SPA_VERSION_FEATURES SPA_VERSION_5000
540 #define SPA_VERSION_IS_SUPPORTED(v) \
541 (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
542 ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
545 * ZPL version - rev'd whenever an incompatible on-disk format change
546 * occurs. This is independent of SPA/DMU/ZAP versioning. You must
547 * also update the version_table[] and help message in zfs_prop.c.
549 * When changing, be sure to teach GRUB how to read the new format!
550 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
552 #define ZPL_VERSION_1 1ULL
553 #define ZPL_VERSION_2 2ULL
554 #define ZPL_VERSION_3 3ULL
555 #define ZPL_VERSION_4 4ULL
556 #define ZPL_VERSION_5 5ULL
557 #define ZPL_VERSION ZPL_VERSION_5
558 #define ZPL_VERSION_STRING "5"
560 #define ZPL_VERSION_INITIAL ZPL_VERSION_1
561 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
562 #define ZPL_VERSION_FUID ZPL_VERSION_3
563 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
564 #define ZPL_VERSION_SYSATTR ZPL_VERSION_3
565 #define ZPL_VERSION_USERSPACE ZPL_VERSION_4
566 #define ZPL_VERSION_SA ZPL_VERSION_5
568 /* Rewind request information */
569 #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */
570 #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */
571 #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */
572 #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */
573 #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */
574 #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */
575 #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */
577 typedef struct zpool_rewind_policy
{
578 uint32_t zrp_request
; /* rewind behavior requested */
579 uint64_t zrp_maxmeta
; /* max acceptable meta-data errors */
580 uint64_t zrp_maxdata
; /* max acceptable data errors */
581 uint64_t zrp_txg
; /* specific txg to load */
582 } zpool_rewind_policy_t
;
585 * The following are configuration names used in the nvlist describing a pool's
588 #define ZPOOL_CONFIG_VERSION "version"
589 #define ZPOOL_CONFIG_POOL_NAME "name"
590 #define ZPOOL_CONFIG_POOL_STATE "state"
591 #define ZPOOL_CONFIG_POOL_TXG "txg"
592 #define ZPOOL_CONFIG_POOL_GUID "pool_guid"
593 #define ZPOOL_CONFIG_CREATE_TXG "create_txg"
594 #define ZPOOL_CONFIG_TOP_GUID "top_guid"
595 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
596 #define ZPOOL_CONFIG_TYPE "type"
597 #define ZPOOL_CONFIG_CHILDREN "children"
598 #define ZPOOL_CONFIG_ID "id"
599 #define ZPOOL_CONFIG_GUID "guid"
600 #define ZPOOL_CONFIG_PATH "path"
601 #define ZPOOL_CONFIG_DEVID "devid"
602 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
603 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
604 #define ZPOOL_CONFIG_ASHIFT "ashift"
605 #define ZPOOL_CONFIG_ASIZE "asize"
606 #define ZPOOL_CONFIG_DTL "DTL"
607 #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */
608 #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
610 /* container nvlist of extended stats */
611 #define ZPOOL_CONFIG_VDEV_STATS_EX "vdev_stats_ex"
613 /* Active queue read/write stats */
614 #define ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE "vdev_sync_r_active_queue"
615 #define ZPOOL_CONFIG_VDEV_SYNC_W_ACTIVE_QUEUE "vdev_sync_w_active_queue"
616 #define ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE "vdev_async_r_active_queue"
617 #define ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE "vdev_async_w_active_queue"
618 #define ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE "vdev_async_scrub_active_queue"
621 #define ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE "vdev_sync_r_pend_queue"
622 #define ZPOOL_CONFIG_VDEV_SYNC_W_PEND_QUEUE "vdev_sync_w_pend_queue"
623 #define ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE "vdev_async_r_pend_queue"
624 #define ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE "vdev_async_w_pend_queue"
625 #define ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE "vdev_async_scrub_pend_queue"
627 /* Latency read/write histogram stats */
628 #define ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO "vdev_tot_r_lat_histo"
629 #define ZPOOL_CONFIG_VDEV_TOT_W_LAT_HISTO "vdev_tot_w_lat_histo"
630 #define ZPOOL_CONFIG_VDEV_DISK_R_LAT_HISTO "vdev_disk_r_lat_histo"
631 #define ZPOOL_CONFIG_VDEV_DISK_W_LAT_HISTO "vdev_disk_w_lat_histo"
632 #define ZPOOL_CONFIG_VDEV_SYNC_R_LAT_HISTO "vdev_sync_r_lat_histo"
633 #define ZPOOL_CONFIG_VDEV_SYNC_W_LAT_HISTO "vdev_sync_w_lat_histo"
634 #define ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO "vdev_async_r_lat_histo"
635 #define ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO "vdev_async_w_lat_histo"
636 #define ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO "vdev_scrub_histo"
638 /* Request size histograms */
639 #define ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO "vdev_sync_ind_r_histo"
640 #define ZPOOL_CONFIG_VDEV_SYNC_IND_W_HISTO "vdev_sync_ind_w_histo"
641 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO "vdev_async_ind_r_histo"
642 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO "vdev_async_ind_w_histo"
643 #define ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO "vdev_ind_scrub_histo"
644 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO "vdev_sync_agg_r_histo"
645 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO "vdev_sync_agg_w_histo"
646 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO "vdev_async_agg_r_histo"
647 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO "vdev_async_agg_w_histo"
648 #define ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO "vdev_agg_scrub_histo"
650 /* vdev enclosure sysfs path */
651 #define ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH "vdev_enc_sysfs_path"
653 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
654 #define ZPOOL_CONFIG_ERRCOUNT "error_count"
655 #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
656 #define ZPOOL_CONFIG_SPARES "spares"
657 #define ZPOOL_CONFIG_IS_SPARE "is_spare"
658 #define ZPOOL_CONFIG_NPARITY "nparity"
659 #define ZPOOL_CONFIG_HOSTID "hostid"
660 #define ZPOOL_CONFIG_HOSTNAME "hostname"
661 #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time"
662 #define ZPOOL_CONFIG_UNSPARE "unspare"
663 #define ZPOOL_CONFIG_PHYS_PATH "phys_path"
664 #define ZPOOL_CONFIG_IS_LOG "is_log"
665 #define ZPOOL_CONFIG_L2CACHE "l2cache"
666 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
667 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
668 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
669 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
670 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
671 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
672 #define ZPOOL_CONFIG_SPLIT "splitcfg"
673 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
674 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
675 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
676 #define ZPOOL_CONFIG_REMOVING "removing"
677 #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
678 #define ZPOOL_CONFIG_COMMENT "comment"
679 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
680 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
681 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
682 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
683 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
684 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
685 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
686 #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */
687 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
688 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
689 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
690 #define ZPOOL_CONFIG_ERRATA "errata" /* not stored on disk */
691 #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top"
692 #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf"
693 #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps"
694 #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */
695 #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */
696 #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */
697 #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */
700 * The persistent vdev state is stored as separate values rather than a single
701 * 'vdev_state' entry. This is because a device can be in multiple states, such
702 * as offline and degraded.
704 #define ZPOOL_CONFIG_OFFLINE "offline"
705 #define ZPOOL_CONFIG_FAULTED "faulted"
706 #define ZPOOL_CONFIG_DEGRADED "degraded"
707 #define ZPOOL_CONFIG_REMOVED "removed"
708 #define ZPOOL_CONFIG_FRU "fru"
709 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
711 /* Rewind policy parameters */
712 #define ZPOOL_REWIND_POLICY "rewind-policy"
713 #define ZPOOL_REWIND_REQUEST "rewind-request"
714 #define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg"
715 #define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh"
716 #define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh"
718 /* Rewind data discovered */
719 #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts"
720 #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors"
721 #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind"
723 #define VDEV_TYPE_ROOT "root"
724 #define VDEV_TYPE_MIRROR "mirror"
725 #define VDEV_TYPE_REPLACING "replacing"
726 #define VDEV_TYPE_RAIDZ "raidz"
727 #define VDEV_TYPE_DISK "disk"
728 #define VDEV_TYPE_FILE "file"
729 #define VDEV_TYPE_MISSING "missing"
730 #define VDEV_TYPE_HOLE "hole"
731 #define VDEV_TYPE_SPARE "spare"
732 #define VDEV_TYPE_LOG "log"
733 #define VDEV_TYPE_L2CACHE "l2cache"
736 * This is needed in userland to report the minimum necessary device size.
738 #define SPA_MINDEVSIZE (64ULL << 20)
741 * Set if the fragmentation has not yet been calculated. This can happen
742 * because the space maps have not been upgraded or the histogram feature
745 #define ZFS_FRAG_INVALID UINT64_MAX
748 * The location of the pool configuration repository, shared between kernel and
751 #define ZPOOL_CACHE "/etc/zfs/zpool.cache"
754 * vdev states are ordered from least to most healthy.
755 * A vdev that's CANT_OPEN or below is considered unusable.
757 typedef enum vdev_state
{
758 VDEV_STATE_UNKNOWN
= 0, /* Uninitialized vdev */
759 VDEV_STATE_CLOSED
, /* Not currently open */
760 VDEV_STATE_OFFLINE
, /* Not allowed to open */
761 VDEV_STATE_REMOVED
, /* Explicitly removed from system */
762 VDEV_STATE_CANT_OPEN
, /* Tried to open, but failed */
763 VDEV_STATE_FAULTED
, /* External request to fault device */
764 VDEV_STATE_DEGRADED
, /* Replicated vdev with unhealthy kids */
765 VDEV_STATE_HEALTHY
/* Presumed good */
768 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
771 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
772 * of the vdev stats structure uses these constants to distinguish why.
774 typedef enum vdev_aux
{
775 VDEV_AUX_NONE
, /* no error */
776 VDEV_AUX_OPEN_FAILED
, /* ldi_open_*() or vn_open() failed */
777 VDEV_AUX_CORRUPT_DATA
, /* bad label or disk contents */
778 VDEV_AUX_NO_REPLICAS
, /* insufficient number of replicas */
779 VDEV_AUX_BAD_GUID_SUM
, /* vdev guid sum doesn't match */
780 VDEV_AUX_TOO_SMALL
, /* vdev size is too small */
781 VDEV_AUX_BAD_LABEL
, /* the label is OK but invalid */
782 VDEV_AUX_VERSION_NEWER
, /* on-disk version is too new */
783 VDEV_AUX_VERSION_OLDER
, /* on-disk version is too old */
784 VDEV_AUX_UNSUP_FEAT
, /* unsupported features */
785 VDEV_AUX_SPARED
, /* hot spare used in another pool */
786 VDEV_AUX_ERR_EXCEEDED
, /* too many errors */
787 VDEV_AUX_IO_FAILURE
, /* experienced I/O failure */
788 VDEV_AUX_BAD_LOG
, /* cannot read log chain(s) */
789 VDEV_AUX_EXTERNAL
, /* external diagnosis or forced fault */
790 VDEV_AUX_SPLIT_POOL
, /* vdev was split off into another pool */
791 VDEV_AUX_BAD_ASHIFT
, /* vdev ashift is invalid */
792 VDEV_AUX_EXTERNAL_PERSIST
, /* persistent forced fault */
793 VDEV_AUX_ACTIVE
, /* vdev active on a different host */
797 * pool state. The following states are written to disk as part of the normal
798 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
799 * states are software abstractions used at various levels to communicate
802 typedef enum pool_state
{
803 POOL_STATE_ACTIVE
= 0, /* In active use */
804 POOL_STATE_EXPORTED
, /* Explicitly exported */
805 POOL_STATE_DESTROYED
, /* Explicitly destroyed */
806 POOL_STATE_SPARE
, /* Reserved for hot spare use */
807 POOL_STATE_L2CACHE
, /* Level 2 ARC device */
808 POOL_STATE_UNINITIALIZED
, /* Internal spa_t state */
809 POOL_STATE_UNAVAIL
, /* Internal libzfs state */
810 POOL_STATE_POTENTIALLY_ACTIVE
/* Internal libzfs state */
814 * mmp state. The following states provide additional detail describing
815 * why a pool couldn't be safely imported.
817 typedef enum mmp_state
{
818 MMP_STATE_ACTIVE
= 0, /* In active use */
819 MMP_STATE_INACTIVE
, /* Inactive and safe to import */
820 MMP_STATE_NO_HOSTID
/* System hostid is not set */
826 typedef enum pool_scan_func
{
834 * Used to control scrub pause and resume.
836 typedef enum pool_scrub_cmd
{
837 POOL_SCRUB_NORMAL
= 0,
844 * ZIO types. Needed to interpret vdev statistics below.
846 typedef enum zio_type
{
857 * Pool statistics. Note: all fields should be 64-bit because this
858 * is passed between kernel and userland as an nvlist uint64 array.
860 typedef struct pool_scan_stat
{
861 /* values stored on disk */
862 uint64_t pss_func
; /* pool_scan_func_t */
863 uint64_t pss_state
; /* dsl_scan_state_t */
864 uint64_t pss_start_time
; /* scan start time */
865 uint64_t pss_end_time
; /* scan end time */
866 uint64_t pss_to_examine
; /* total bytes to scan */
867 uint64_t pss_examined
; /* total bytes located by scanner */
868 uint64_t pss_to_process
; /* total bytes to process */
869 uint64_t pss_processed
; /* total processed bytes */
870 uint64_t pss_errors
; /* scan errors */
872 /* values not stored on disk */
873 uint64_t pss_pass_exam
; /* examined bytes per scan pass */
874 uint64_t pss_pass_start
; /* start time of a scan pass */
875 uint64_t pss_pass_scrub_pause
; /* pause time of a scurb pass */
876 /* cumulative time scrub spent paused, needed for rate calculation */
877 uint64_t pss_pass_scrub_spent_paused
;
878 uint64_t pss_pass_issued
; /* issued bytes per scan pass */
879 uint64_t pss_issued
; /* total bytes checked by scanner */
882 typedef enum dsl_scan_state
{
891 * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER. The ordering
892 * of this enum must be maintained to ensure the errata identifiers map to
893 * the correct documentation. New errata may only be appended to the list
894 * and must contain corresponding documentation at the above link.
896 typedef enum zpool_errata
{
898 ZPOOL_ERRATA_ZOL_2094_SCRUB
,
899 ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY
,
900 ZPOOL_ERRATA_ZOL_6845_ENCRYPTION
,
904 * Vdev statistics. Note: all fields should be 64-bit because this
905 * is passed between kernel and userland as an nvlist uint64 array.
907 typedef struct vdev_stat
{
908 hrtime_t vs_timestamp
; /* time since vdev load */
909 uint64_t vs_state
; /* vdev state */
910 uint64_t vs_aux
; /* see vdev_aux_t */
911 uint64_t vs_alloc
; /* space allocated */
912 uint64_t vs_space
; /* total capacity */
913 uint64_t vs_dspace
; /* deflated capacity */
914 uint64_t vs_rsize
; /* replaceable dev size */
915 uint64_t vs_esize
; /* expandable dev size */
916 uint64_t vs_ops
[ZIO_TYPES
]; /* operation count */
917 uint64_t vs_bytes
[ZIO_TYPES
]; /* bytes read/written */
918 uint64_t vs_read_errors
; /* read errors */
919 uint64_t vs_write_errors
; /* write errors */
920 uint64_t vs_checksum_errors
; /* checksum errors */
921 uint64_t vs_self_healed
; /* self-healed bytes */
922 uint64_t vs_scan_removing
; /* removing? */
923 uint64_t vs_scan_processed
; /* scan processed bytes */
924 uint64_t vs_fragmentation
; /* device fragmentation */
931 * These are stats which aren't included in the original iostat output. For
932 * convenience, they are grouped together in vdev_stat_ex, although each stat
933 * is individually exported as an nvlist.
935 typedef struct vdev_stat_ex
{
936 /* Number of ZIOs issued to disk and waiting to finish */
937 uint64_t vsx_active_queue
[ZIO_PRIORITY_NUM_QUEUEABLE
];
939 /* Number of ZIOs pending to be issued to disk */
940 uint64_t vsx_pend_queue
[ZIO_PRIORITY_NUM_QUEUEABLE
];
943 * Below are the histograms for various latencies. Buckets are in
944 * units of nanoseconds.
948 * 2^37 nanoseconds = 134s. Timeouts will probably start kicking in
951 #define VDEV_L_HISTO_BUCKETS 37 /* Latency histo buckets */
952 #define VDEV_RQ_HISTO_BUCKETS 25 /* Request size histo buckets */
955 /* Amount of time in ZIO queue (ns) */
956 uint64_t vsx_queue_histo
[ZIO_PRIORITY_NUM_QUEUEABLE
]
957 [VDEV_L_HISTO_BUCKETS
];
959 /* Total ZIO latency (ns). Includes queuing and disk access time */
960 uint64_t vsx_total_histo
[ZIO_TYPES
][VDEV_L_HISTO_BUCKETS
];
962 /* Amount of time to read/write the disk (ns) */
963 uint64_t vsx_disk_histo
[ZIO_TYPES
][VDEV_L_HISTO_BUCKETS
];
965 /* "lookup the bucket for a value" histogram macros */
966 #define HISTO(val, buckets) (val != 0 ? MIN(highbit64(val) - 1, \
968 #define L_HISTO(a) HISTO(a, VDEV_L_HISTO_BUCKETS)
969 #define RQ_HISTO(a) HISTO(a, VDEV_RQ_HISTO_BUCKETS)
971 /* Physical IO histogram */
972 uint64_t vsx_ind_histo
[ZIO_PRIORITY_NUM_QUEUEABLE
]
973 [VDEV_RQ_HISTO_BUCKETS
];
975 /* Delegated (aggregated) physical IO histogram */
976 uint64_t vsx_agg_histo
[ZIO_PRIORITY_NUM_QUEUEABLE
]
977 [VDEV_RQ_HISTO_BUCKETS
];
982 * DDT statistics. Note: all fields should be 64-bit because this
983 * is passed between kernel and userland as an nvlist uint64 array.
985 typedef struct ddt_object
{
986 uint64_t ddo_count
; /* number of elements in ddt */
987 uint64_t ddo_dspace
; /* size of ddt on disk */
988 uint64_t ddo_mspace
; /* size of ddt in-core */
991 typedef struct ddt_stat
{
992 uint64_t dds_blocks
; /* blocks */
993 uint64_t dds_lsize
; /* logical size */
994 uint64_t dds_psize
; /* physical size */
995 uint64_t dds_dsize
; /* deflated allocated size */
996 uint64_t dds_ref_blocks
; /* referenced blocks */
997 uint64_t dds_ref_lsize
; /* referenced lsize * refcnt */
998 uint64_t dds_ref_psize
; /* referenced psize * refcnt */
999 uint64_t dds_ref_dsize
; /* referenced dsize * refcnt */
1002 typedef struct ddt_histogram
{
1003 ddt_stat_t ddh_stat
[64]; /* power-of-two histogram buckets */
1006 #define ZVOL_DRIVER "zvol"
1007 #define ZFS_DRIVER "zfs"
1008 #define ZFS_DEV "/dev/zfs"
1009 #define ZFS_SHARETAB "/etc/dfs/sharetab"
1011 #define ZFS_SUPER_MAGIC 0x2fc12fc1
1013 /* general zvol path */
1014 #define ZVOL_DIR "/dev"
1016 #define ZVOL_MAJOR 230
1017 #define ZVOL_MINOR_BITS 4
1018 #define ZVOL_MINOR_MASK ((1U << ZVOL_MINOR_BITS) - 1)
1019 #define ZVOL_MINORS (1 << 4)
1020 #define ZVOL_DEV_NAME "zd"
1022 #define ZVOL_PROP_NAME "name"
1023 #define ZVOL_DEFAULT_BLOCKSIZE 8192
1026 * /dev/zfs ioctl numbers.
1028 typedef enum zfs_ioc
{
1030 * Illumos - 71/128 numbers reserved.
1032 ZFS_IOC_FIRST
= ('Z' << 8),
1033 ZFS_IOC
= ZFS_IOC_FIRST
,
1034 ZFS_IOC_POOL_CREATE
= ZFS_IOC_FIRST
,
1035 ZFS_IOC_POOL_DESTROY
,
1036 ZFS_IOC_POOL_IMPORT
,
1037 ZFS_IOC_POOL_EXPORT
,
1038 ZFS_IOC_POOL_CONFIGS
,
1040 ZFS_IOC_POOL_TRYIMPORT
,
1042 ZFS_IOC_POOL_FREEZE
,
1043 ZFS_IOC_POOL_UPGRADE
,
1044 ZFS_IOC_POOL_GET_HISTORY
,
1046 ZFS_IOC_VDEV_REMOVE
,
1047 ZFS_IOC_VDEV_SET_STATE
,
1048 ZFS_IOC_VDEV_ATTACH
,
1049 ZFS_IOC_VDEV_DETACH
,
1050 ZFS_IOC_VDEV_SETPATH
,
1051 ZFS_IOC_VDEV_SETFRU
,
1052 ZFS_IOC_OBJSET_STATS
,
1053 ZFS_IOC_OBJSET_ZPLPROPS
,
1054 ZFS_IOC_DATASET_LIST_NEXT
,
1055 ZFS_IOC_SNAPSHOT_LIST_NEXT
,
1063 ZFS_IOC_INJECT_FAULT
,
1064 ZFS_IOC_CLEAR_FAULT
,
1065 ZFS_IOC_INJECT_LIST_NEXT
,
1070 ZFS_IOC_DSOBJ_TO_DSNAME
,
1071 ZFS_IOC_OBJ_TO_PATH
,
1072 ZFS_IOC_POOL_SET_PROPS
,
1073 ZFS_IOC_POOL_GET_PROPS
,
1077 ZFS_IOC_INHERIT_PROP
,
1079 ZFS_IOC_USERSPACE_ONE
,
1080 ZFS_IOC_USERSPACE_MANY
,
1081 ZFS_IOC_USERSPACE_UPGRADE
,
1085 ZFS_IOC_OBJSET_RECVD_PROPS
,
1089 ZFS_IOC_TMP_SNAPSHOT
,
1090 ZFS_IOC_OBJ_TO_STATS
,
1091 ZFS_IOC_SPACE_WRITTEN
,
1092 ZFS_IOC_SPACE_SNAPS
,
1093 ZFS_IOC_DESTROY_SNAPS
,
1094 ZFS_IOC_POOL_REGUID
,
1095 ZFS_IOC_POOL_REOPEN
,
1096 ZFS_IOC_SEND_PROGRESS
,
1097 ZFS_IOC_LOG_HISTORY
,
1102 ZFS_IOC_GET_BOOKMARKS
,
1103 ZFS_IOC_DESTROY_BOOKMARKS
,
1104 ZFS_IOC_CHANNEL_PROGRAM
,
1112 * Linux - 3/64 numbers reserved.
1114 ZFS_IOC_LINUX
= ('Z' << 8) + 0x80,
1115 ZFS_IOC_EVENTS_NEXT
,
1116 ZFS_IOC_EVENTS_CLEAR
,
1117 ZFS_IOC_EVENTS_SEEK
,
1120 * FreeBSD - 1/64 numbers reserved.
1122 ZFS_IOC_FREEBSD
= ('Z' << 8) + 0xC0,
1128 * zvol ioctl to get dataset name
1130 #define BLKZNAME _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN])
1133 * Internal SPA load state. Used by FMA diagnosis engine.
1136 SPA_LOAD_NONE
, /* no load in progress */
1137 SPA_LOAD_OPEN
, /* normal open */
1138 SPA_LOAD_IMPORT
, /* import in progress */
1139 SPA_LOAD_TRYIMPORT
, /* tryimport in progress */
1140 SPA_LOAD_RECOVER
, /* recovery requested */
1141 SPA_LOAD_ERROR
, /* load failed */
1142 SPA_LOAD_CREATE
/* creation in progress */
1146 * Bookmark name values.
1148 #define ZPOOL_ERR_LIST "error list"
1149 #define ZPOOL_ERR_DATASET "dataset"
1150 #define ZPOOL_ERR_OBJECT "object"
1152 #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1)
1155 * The following are names used in the nvlist describing
1156 * the pool's history log.
1158 #define ZPOOL_HIST_RECORD "history record"
1159 #define ZPOOL_HIST_TIME "history time"
1160 #define ZPOOL_HIST_CMD "history command"
1161 #define ZPOOL_HIST_WHO "history who"
1162 #define ZPOOL_HIST_ZONE "history zone"
1163 #define ZPOOL_HIST_HOST "history hostname"
1164 #define ZPOOL_HIST_TXG "history txg"
1165 #define ZPOOL_HIST_INT_EVENT "history internal event"
1166 #define ZPOOL_HIST_INT_STR "history internal str"
1167 #define ZPOOL_HIST_INT_NAME "internal_name"
1168 #define ZPOOL_HIST_IOCTL "ioctl"
1169 #define ZPOOL_HIST_INPUT_NVL "in_nvl"
1170 #define ZPOOL_HIST_OUTPUT_NVL "out_nvl"
1171 #define ZPOOL_HIST_DSNAME "dsname"
1172 #define ZPOOL_HIST_DSID "dsid"
1173 #define ZPOOL_HIST_ERRNO "errno"
1176 * Special nvlist name that will not have its args recorded in the pool's
1179 #define ZPOOL_HIDDEN_ARGS "hidden_args"
1182 * Flags for ZFS_IOC_VDEV_SET_STATE
1184 #define ZFS_ONLINE_CHECKREMOVE 0x1
1185 #define ZFS_ONLINE_UNSPARE 0x2
1186 #define ZFS_ONLINE_FORCEFAULT 0x4
1187 #define ZFS_ONLINE_EXPAND 0x8
1188 #define ZFS_OFFLINE_TEMPORARY 0x1
1191 * Flags for ZFS_IOC_POOL_IMPORT
1193 #define ZFS_IMPORT_NORMAL 0x0
1194 #define ZFS_IMPORT_VERBATIM 0x1
1195 #define ZFS_IMPORT_ANY_HOST 0x2
1196 #define ZFS_IMPORT_MISSING_LOG 0x4
1197 #define ZFS_IMPORT_ONLY 0x8
1198 #define ZFS_IMPORT_TEMP_NAME 0x10
1199 #define ZFS_IMPORT_SKIP_MMP 0x20
1200 #define ZFS_IMPORT_LOAD_KEYS 0x40
1203 * Channel program argument/return nvlist keys and defaults.
1205 #define ZCP_ARG_PROGRAM "program"
1206 #define ZCP_ARG_ARGLIST "arg"
1207 #define ZCP_ARG_SYNC "sync"
1208 #define ZCP_ARG_INSTRLIMIT "instrlimit"
1209 #define ZCP_ARG_MEMLIMIT "memlimit"
1211 #define ZCP_ARG_CLIARGV "argv"
1213 #define ZCP_RET_ERROR "error"
1214 #define ZCP_RET_RETURN "return"
1216 #define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000)
1217 #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT)
1218 #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024)
1219 #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT)
1222 * Sysevent payload members. ZFS will generate the following sysevents with the
1225 * ESC_ZFS_RESILVER_START
1226 * ESC_ZFS_RESILVER_END
1227 * ESC_ZFS_POOL_DESTROY
1228 * ESC_ZFS_POOL_REGUID
1230 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1231 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1233 * ESC_ZFS_VDEV_REMOVE
1234 * ESC_ZFS_VDEV_CLEAR
1235 * ESC_ZFS_VDEV_CHECK
1237 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1238 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1239 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
1240 * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
1242 * ESC_ZFS_HISTORY_EVENT
1244 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1245 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1246 * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional)
1247 * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional)
1248 * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional)
1249 * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional)
1250 * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional)
1251 * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional)
1252 * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional)
1253 * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional)
1254 * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional)
1255 * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional)
1256 * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional)
1257 * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional)
1259 * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1260 * history log nvlist. The keynames will be free of any spaces or other
1261 * characters that could be potentially unexpected to consumers of the
1264 #define ZFS_EV_POOL_NAME "pool_name"
1265 #define ZFS_EV_POOL_GUID "pool_guid"
1266 #define ZFS_EV_VDEV_PATH "vdev_path"
1267 #define ZFS_EV_VDEV_GUID "vdev_guid"
1268 #define ZFS_EV_HIST_TIME "history_time"
1269 #define ZFS_EV_HIST_CMD "history_command"
1270 #define ZFS_EV_HIST_WHO "history_who"
1271 #define ZFS_EV_HIST_ZONE "history_zone"
1272 #define ZFS_EV_HIST_HOST "history_hostname"
1273 #define ZFS_EV_HIST_TXG "history_txg"
1274 #define ZFS_EV_HIST_INT_EVENT "history_internal_event"
1275 #define ZFS_EV_HIST_INT_STR "history_internal_str"
1276 #define ZFS_EV_HIST_INT_NAME "history_internal_name"
1277 #define ZFS_EV_HIST_IOCTL "history_ioctl"
1278 #define ZFS_EV_HIST_DSNAME "history_dsname"
1279 #define ZFS_EV_HIST_DSID "history_dsid"
1285 #endif /* _SYS_FS_ZFS_H */