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, 2018 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.
29 * Copyright (c) 2017, Intel Corporation.
32 /* Portions Copyright 2010 Robert Milkowski */
38 #include <sys/zio_priority.h>
45 * Types and constants shared between userland and the kernel.
49 * Each dataset can be one of the following types. These constants can be
50 * combined into masks that can be passed to various functions.
53 ZFS_TYPE_FILESYSTEM
= (1 << 0),
54 ZFS_TYPE_SNAPSHOT
= (1 << 1),
55 ZFS_TYPE_VOLUME
= (1 << 2),
56 ZFS_TYPE_POOL
= (1 << 3),
57 ZFS_TYPE_BOOKMARK
= (1 << 4)
61 * NB: lzc_dataset_type should be updated whenever a new objset type is added,
62 * if it represents a real type of a dataset that can be created from userland.
64 typedef enum dmu_objset_type
{
69 DMU_OST_OTHER
, /* For testing only! */
70 DMU_OST_ANY
, /* Be careful! */
74 #define ZFS_TYPE_DATASET \
75 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
78 * All of these include the terminating NUL byte.
80 #define ZAP_MAXNAMELEN 256
81 #define ZAP_MAXVALUELEN (1024 * 8)
82 #define ZAP_OLDMAXVALUELEN 1024
83 #define ZFS_MAX_DATASET_NAME_LEN 256
86 * Dataset properties are identified by these constants and must be added to
87 * the end of this list to ensure that external consumers are not affected
88 * by the change. If you make any changes to this list, be sure to update
89 * the property table in module/zcommon/zfs_prop.c.
99 ZFS_PROP_COMPRESSRATIO
,
103 ZFS_PROP_RESERVATION
,
105 ZFS_PROP_VOLBLOCKSIZE
,
110 ZFS_PROP_COMPRESSION
,
118 ZFS_PROP_PRIVATE
, /* not exposed to user, temporary */
121 ZFS_PROP_NAME
, /* not exposed to the user */
123 ZFS_PROP_ISCSIOPTIONS
, /* not exposed to the user */
125 ZFS_PROP_NUMCLONES
, /* not exposed to the user */
135 ZFS_PROP_REFRESERVATION
,
137 ZFS_PROP_PRIMARYCACHE
,
138 ZFS_PROP_SECONDARYCACHE
,
142 ZFS_PROP_USEDREFRESERV
,
143 ZFS_PROP_USERACCOUNTING
, /* not exposed to the user */
144 ZFS_PROP_STMF_SHAREINFO
, /* not exposed to the user */
145 ZFS_PROP_DEFER_DESTROY
,
148 ZFS_PROP_UNIQUE
, /* not exposed to the user */
157 ZFS_PROP_LOGICALUSED
,
158 ZFS_PROP_LOGICALREFERENCED
,
159 ZFS_PROP_INCONSISTENT
, /* not exposed to the user */
161 ZFS_PROP_FILESYSTEM_LIMIT
,
162 ZFS_PROP_SNAPSHOT_LIMIT
,
163 ZFS_PROP_FILESYSTEM_COUNT
,
164 ZFS_PROP_SNAPSHOT_COUNT
,
167 ZFS_PROP_SELINUX_CONTEXT
,
168 ZFS_PROP_SELINUX_FSCONTEXT
,
169 ZFS_PROP_SELINUX_DEFCONTEXT
,
170 ZFS_PROP_SELINUX_ROOTCONTEXT
,
172 ZFS_PROP_REDUNDANT_METADATA
,
175 ZFS_PROP_RECEIVE_RESUME_TOKEN
,
177 ZFS_PROP_KEYLOCATION
,
179 ZFS_PROP_PBKDF2_SALT
,
180 ZFS_PROP_PBKDF2_ITERS
,
181 ZFS_PROP_ENCRYPTION_ROOT
,
184 ZFS_PROP_REMAPTXG
, /* not exposed to the user */
185 ZFS_PROP_SPECIAL_SMALL_BLOCKS
,
194 ZFS_PROP_USEROBJUSED
,
195 ZFS_PROP_USEROBJQUOTA
,
196 ZFS_PROP_GROUPOBJUSED
,
197 ZFS_PROP_GROUPOBJQUOTA
,
198 ZFS_PROP_PROJECTUSED
,
199 ZFS_PROP_PROJECTQUOTA
,
200 ZFS_PROP_PROJECTOBJUSED
,
201 ZFS_PROP_PROJECTOBJQUOTA
,
202 ZFS_NUM_USERQUOTA_PROPS
203 } zfs_userquota_prop_t
;
205 extern const char *zfs_userquota_prop_prefixes
[ZFS_NUM_USERQUOTA_PROPS
];
208 * Pool properties are identified by these constants and must be added to the
209 * end of this list to ensure that external consumers are not affected
210 * by the change. If you make any changes to this list, be sure to update
211 * the property table in module/zcommon/zpool_prop.c.
214 ZPOOL_PROP_INVAL
= -1,
223 ZPOOL_PROP_DELEGATION
,
224 ZPOOL_PROP_AUTOREPLACE
,
225 ZPOOL_PROP_CACHEFILE
,
226 ZPOOL_PROP_FAILUREMODE
,
227 ZPOOL_PROP_LISTSNAPS
,
228 ZPOOL_PROP_AUTOEXPAND
,
229 ZPOOL_PROP_DEDUPDITTO
,
230 ZPOOL_PROP_DEDUPRATIO
,
232 ZPOOL_PROP_ALLOCATED
,
238 ZPOOL_PROP_FRAGMENTATION
,
240 ZPOOL_PROP_MAXBLOCKSIZE
,
242 ZPOOL_PROP_MAXDNODESIZE
,
243 ZPOOL_PROP_MULTIHOST
,
244 ZPOOL_PROP_CHECKPOINT
,
245 ZPOOL_PROP_LOAD_GUID
,
249 /* Small enough to not hog a whole line of printout in zpool(1M). */
250 #define ZPROP_MAX_COMMENT 32
252 #define ZPROP_VALUE "value"
253 #define ZPROP_SOURCE "source"
256 ZPROP_SRC_NONE
= 0x1,
257 ZPROP_SRC_DEFAULT
= 0x2,
258 ZPROP_SRC_TEMPORARY
= 0x4,
259 ZPROP_SRC_LOCAL
= 0x8,
260 ZPROP_SRC_INHERITED
= 0x10,
261 ZPROP_SRC_RECEIVED
= 0x20
264 #define ZPROP_SRC_ALL 0x3f
266 #define ZPROP_SOURCE_VAL_RECVD "$recvd"
267 #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS"
270 * Dataset flag implemented as a special entry in the props zap object
271 * indicating that the dataset has received properties on or after
272 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
273 * just as it did in earlier versions, and thereafter, local properties are
276 #define ZPROP_HAS_RECVD "$hasrecvd"
279 ZPROP_ERR_NOCLEAR
= 0x1, /* failure to clear existing props */
280 ZPROP_ERR_NORESTORE
= 0x2 /* failure to restore props on error */
283 typedef int (*zprop_func
)(int, void *);
286 * Properties to be set on the root file system of a new pool
287 * are stuffed into their own nvlist, which is then included in
288 * the properties nvlist with the pool properties.
290 #define ZPOOL_ROOTFS_PROPS "root-props-nvl"
293 * Length of 'written@' and 'written#'
295 #define ZFS_WRITTEN_PROP_PREFIX_LEN 8
298 * Dataset property functions shared between libzfs and kernel.
300 const char *zfs_prop_default_string(zfs_prop_t
);
301 uint64_t zfs_prop_default_numeric(zfs_prop_t
);
302 boolean_t
zfs_prop_readonly(zfs_prop_t
);
303 boolean_t
zfs_prop_visible(zfs_prop_t prop
);
304 boolean_t
zfs_prop_inheritable(zfs_prop_t
);
305 boolean_t
zfs_prop_setonce(zfs_prop_t
);
306 boolean_t
zfs_prop_encryption_key_param(zfs_prop_t
);
307 boolean_t
zfs_prop_valid_keylocation(const char *, boolean_t
);
308 const char *zfs_prop_to_name(zfs_prop_t
);
309 zfs_prop_t
zfs_name_to_prop(const char *);
310 boolean_t
zfs_prop_user(const char *);
311 boolean_t
zfs_prop_userquota(const char *);
312 boolean_t
zfs_prop_written(const char *);
313 int zfs_prop_index_to_string(zfs_prop_t
, uint64_t, const char **);
314 int zfs_prop_string_to_index(zfs_prop_t
, const char *, uint64_t *);
315 uint64_t zfs_prop_random_value(zfs_prop_t
, uint64_t seed
);
316 boolean_t
zfs_prop_valid_for_type(int, zfs_type_t
, boolean_t
);
319 * Pool property functions shared between libzfs and kernel.
321 zpool_prop_t
zpool_name_to_prop(const char *);
322 const char *zpool_prop_to_name(zpool_prop_t
);
323 const char *zpool_prop_default_string(zpool_prop_t
);
324 uint64_t zpool_prop_default_numeric(zpool_prop_t
);
325 boolean_t
zpool_prop_readonly(zpool_prop_t
);
326 boolean_t
zpool_prop_setonce(zpool_prop_t
);
327 boolean_t
zpool_prop_feature(const char *);
328 boolean_t
zpool_prop_unsupported(const char *);
329 int zpool_prop_index_to_string(zpool_prop_t
, uint64_t, const char **);
330 int zpool_prop_string_to_index(zpool_prop_t
, const char *, uint64_t *);
331 uint64_t zpool_prop_random_value(zpool_prop_t
, uint64_t seed
);
334 * Definitions for the Delegation.
337 ZFS_DELEG_WHO_UNKNOWN
= 0,
338 ZFS_DELEG_USER
= 'u',
339 ZFS_DELEG_USER_SETS
= 'U',
340 ZFS_DELEG_GROUP
= 'g',
341 ZFS_DELEG_GROUP_SETS
= 'G',
342 ZFS_DELEG_EVERYONE
= 'e',
343 ZFS_DELEG_EVERYONE_SETS
= 'E',
344 ZFS_DELEG_CREATE
= 'c',
345 ZFS_DELEG_CREATE_SETS
= 'C',
346 ZFS_DELEG_NAMED_SET
= 's',
347 ZFS_DELEG_NAMED_SET_SETS
= 'S'
348 } zfs_deleg_who_type_t
;
352 ZFS_DELEG_PERM_LOCAL
= 1,
353 ZFS_DELEG_PERM_DESCENDENT
= 2,
354 ZFS_DELEG_PERM_LOCALDESCENDENT
= 3,
355 ZFS_DELEG_PERM_CREATE
= 4
356 } zfs_deleg_inherit_t
;
358 #define ZFS_DELEG_PERM_UID "uid"
359 #define ZFS_DELEG_PERM_GID "gid"
360 #define ZFS_DELEG_PERM_GROUPS "groups"
362 #define ZFS_MLSLABEL_DEFAULT "none"
364 #define ZFS_SMB_ACL_SRC "src"
365 #define ZFS_SMB_ACL_TARGET "target"
368 ZFS_CANMOUNT_OFF
= 0,
370 ZFS_CANMOUNT_NOAUTO
= 2
371 } zfs_canmount_type_t
;
374 ZFS_LOGBIAS_LATENCY
= 0,
375 ZFS_LOGBIAS_THROUGHPUT
= 1
378 typedef enum zfs_share_op
{
385 typedef enum zfs_smb_acl_op
{
392 typedef enum zfs_cache_type
{
394 ZFS_CACHE_METADATA
= 1,
399 ZFS_SYNC_STANDARD
= 0,
401 ZFS_SYNC_DISABLED
= 2
411 ZFS_DNSIZE_LEGACY
= 0,
413 ZFS_DNSIZE_1K
= 1024,
414 ZFS_DNSIZE_2K
= 2048,
415 ZFS_DNSIZE_4K
= 4096,
416 ZFS_DNSIZE_8K
= 8192,
417 ZFS_DNSIZE_16K
= 16384
421 ZFS_REDUNDANT_METADATA_ALL
,
422 ZFS_REDUNDANT_METADATA_MOST
423 } zfs_redundant_metadata_type_t
;
426 ZFS_VOLMODE_DEFAULT
= 0,
427 ZFS_VOLMODE_GEOM
= 1,
432 typedef enum zfs_keystatus
{
433 ZFS_KEYSTATUS_NONE
= 0,
434 ZFS_KEYSTATUS_UNAVAILABLE
,
435 ZFS_KEYSTATUS_AVAILABLE
,
438 typedef enum zfs_keyformat
{
439 ZFS_KEYFORMAT_NONE
= 0,
442 ZFS_KEYFORMAT_PASSPHRASE
,
443 ZFS_KEYFORMAT_FORMATS
446 typedef enum zfs_key_location
{
447 ZFS_KEYLOCATION_NONE
= 0,
448 ZFS_KEYLOCATION_PROMPT
,
450 ZFS_KEYLOCATION_LOCATIONS
453 #define DEFAULT_PBKDF2_ITERATIONS 350000
454 #define MIN_PBKDF2_ITERATIONS 100000
457 * On-disk version number.
459 #define SPA_VERSION_1 1ULL
460 #define SPA_VERSION_2 2ULL
461 #define SPA_VERSION_3 3ULL
462 #define SPA_VERSION_4 4ULL
463 #define SPA_VERSION_5 5ULL
464 #define SPA_VERSION_6 6ULL
465 #define SPA_VERSION_7 7ULL
466 #define SPA_VERSION_8 8ULL
467 #define SPA_VERSION_9 9ULL
468 #define SPA_VERSION_10 10ULL
469 #define SPA_VERSION_11 11ULL
470 #define SPA_VERSION_12 12ULL
471 #define SPA_VERSION_13 13ULL
472 #define SPA_VERSION_14 14ULL
473 #define SPA_VERSION_15 15ULL
474 #define SPA_VERSION_16 16ULL
475 #define SPA_VERSION_17 17ULL
476 #define SPA_VERSION_18 18ULL
477 #define SPA_VERSION_19 19ULL
478 #define SPA_VERSION_20 20ULL
479 #define SPA_VERSION_21 21ULL
480 #define SPA_VERSION_22 22ULL
481 #define SPA_VERSION_23 23ULL
482 #define SPA_VERSION_24 24ULL
483 #define SPA_VERSION_25 25ULL
484 #define SPA_VERSION_26 26ULL
485 #define SPA_VERSION_27 27ULL
486 #define SPA_VERSION_28 28ULL
487 #define SPA_VERSION_5000 5000ULL
490 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
491 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
492 * and do the appropriate changes. Also bump the version number in
493 * usr/src/grub/capability.
495 #define SPA_VERSION SPA_VERSION_5000
496 #define SPA_VERSION_STRING "5000"
499 * Symbolic names for the changes that caused a SPA_VERSION switch.
500 * Used in the code when checking for presence or absence of a feature.
501 * Feel free to define multiple symbolic names for each version if there
502 * were multiple changes to on-disk structures during that version.
504 * NOTE: When checking the current SPA_VERSION in your code, be sure
505 * to use spa_version() since it reports the version of the
506 * last synced uberblock. Checking the in-flight version can
507 * be dangerous in some cases.
509 #define SPA_VERSION_INITIAL SPA_VERSION_1
510 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
511 #define SPA_VERSION_SPARES SPA_VERSION_3
512 #define SPA_VERSION_RAIDZ2 SPA_VERSION_3
513 #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3
514 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
515 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
516 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
517 #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
518 #define SPA_VERSION_BOOTFS SPA_VERSION_6
519 #define SPA_VERSION_SLOGS SPA_VERSION_7
520 #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8
521 #define SPA_VERSION_FUID SPA_VERSION_9
522 #define SPA_VERSION_REFRESERVATION SPA_VERSION_9
523 #define SPA_VERSION_REFQUOTA SPA_VERSION_9
524 #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9
525 #define SPA_VERSION_L2CACHE SPA_VERSION_10
526 #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11
527 #define SPA_VERSION_ORIGIN SPA_VERSION_11
528 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
529 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
530 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
531 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
532 #define SPA_VERSION_USERSPACE SPA_VERSION_15
533 #define SPA_VERSION_STMF_PROP SPA_VERSION_16
534 #define SPA_VERSION_RAIDZ3 SPA_VERSION_17
535 #define SPA_VERSION_USERREFS SPA_VERSION_18
536 #define SPA_VERSION_HOLES SPA_VERSION_19
537 #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20
538 #define SPA_VERSION_DEDUP SPA_VERSION_21
539 #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22
540 #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23
541 #define SPA_VERSION_SA SPA_VERSION_24
542 #define SPA_VERSION_SCAN SPA_VERSION_25
543 #define SPA_VERSION_DIR_CLONES SPA_VERSION_26
544 #define SPA_VERSION_DEADLISTS SPA_VERSION_26
545 #define SPA_VERSION_FAST_SNAP SPA_VERSION_27
546 #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28
547 #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28
548 #define SPA_VERSION_FEATURES SPA_VERSION_5000
550 #define SPA_VERSION_IS_SUPPORTED(v) \
551 (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
552 ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
555 * ZPL version - rev'd whenever an incompatible on-disk format change
556 * occurs. This is independent of SPA/DMU/ZAP versioning. You must
557 * also update the version_table[] and help message in zfs_prop.c.
559 * When changing, be sure to teach GRUB how to read the new format!
560 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
562 #define ZPL_VERSION_1 1ULL
563 #define ZPL_VERSION_2 2ULL
564 #define ZPL_VERSION_3 3ULL
565 #define ZPL_VERSION_4 4ULL
566 #define ZPL_VERSION_5 5ULL
567 #define ZPL_VERSION ZPL_VERSION_5
568 #define ZPL_VERSION_STRING "5"
570 #define ZPL_VERSION_INITIAL ZPL_VERSION_1
571 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
572 #define ZPL_VERSION_FUID ZPL_VERSION_3
573 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
574 #define ZPL_VERSION_SYSATTR ZPL_VERSION_3
575 #define ZPL_VERSION_USERSPACE ZPL_VERSION_4
576 #define ZPL_VERSION_SA ZPL_VERSION_5
578 /* Rewind policy information */
579 #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */
580 #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */
581 #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */
582 #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */
583 #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */
584 #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */
585 #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */
587 typedef struct zpool_load_policy
{
588 uint32_t zlp_rewind
; /* rewind policy requested */
589 uint64_t zlp_maxmeta
; /* max acceptable meta-data errors */
590 uint64_t zlp_maxdata
; /* max acceptable data errors */
591 uint64_t zlp_txg
; /* specific txg to load */
592 } zpool_load_policy_t
;
595 * The following are configuration names used in the nvlist describing a pool's
596 * configuration. New on-disk names should be prefixed with "<reverse-DNS>:"
597 * (e.g. "org.open-zfs:") to avoid conflicting names being developed
600 #define ZPOOL_CONFIG_VERSION "version"
601 #define ZPOOL_CONFIG_POOL_NAME "name"
602 #define ZPOOL_CONFIG_POOL_STATE "state"
603 #define ZPOOL_CONFIG_POOL_TXG "txg"
604 #define ZPOOL_CONFIG_POOL_GUID "pool_guid"
605 #define ZPOOL_CONFIG_CREATE_TXG "create_txg"
606 #define ZPOOL_CONFIG_TOP_GUID "top_guid"
607 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
608 #define ZPOOL_CONFIG_TYPE "type"
609 #define ZPOOL_CONFIG_CHILDREN "children"
610 #define ZPOOL_CONFIG_ID "id"
611 #define ZPOOL_CONFIG_GUID "guid"
612 #define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object"
613 #define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births"
614 #define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev"
615 #define ZPOOL_CONFIG_PATH "path"
616 #define ZPOOL_CONFIG_DEVID "devid"
617 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
618 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
619 #define ZPOOL_CONFIG_ASHIFT "ashift"
620 #define ZPOOL_CONFIG_ASIZE "asize"
621 #define ZPOOL_CONFIG_DTL "DTL"
622 #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */
623 #define ZPOOL_CONFIG_REMOVAL_STATS "removal_stats" /* not stored on disk */
624 #define ZPOOL_CONFIG_CHECKPOINT_STATS "checkpoint_stats" /* not on disk */
625 #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
626 #define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */
628 /* container nvlist of extended stats */
629 #define ZPOOL_CONFIG_VDEV_STATS_EX "vdev_stats_ex"
631 /* Active queue read/write stats */
632 #define ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE "vdev_sync_r_active_queue"
633 #define ZPOOL_CONFIG_VDEV_SYNC_W_ACTIVE_QUEUE "vdev_sync_w_active_queue"
634 #define ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE "vdev_async_r_active_queue"
635 #define ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE "vdev_async_w_active_queue"
636 #define ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE "vdev_async_scrub_active_queue"
639 #define ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE "vdev_sync_r_pend_queue"
640 #define ZPOOL_CONFIG_VDEV_SYNC_W_PEND_QUEUE "vdev_sync_w_pend_queue"
641 #define ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE "vdev_async_r_pend_queue"
642 #define ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE "vdev_async_w_pend_queue"
643 #define ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE "vdev_async_scrub_pend_queue"
645 /* Latency read/write histogram stats */
646 #define ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO "vdev_tot_r_lat_histo"
647 #define ZPOOL_CONFIG_VDEV_TOT_W_LAT_HISTO "vdev_tot_w_lat_histo"
648 #define ZPOOL_CONFIG_VDEV_DISK_R_LAT_HISTO "vdev_disk_r_lat_histo"
649 #define ZPOOL_CONFIG_VDEV_DISK_W_LAT_HISTO "vdev_disk_w_lat_histo"
650 #define ZPOOL_CONFIG_VDEV_SYNC_R_LAT_HISTO "vdev_sync_r_lat_histo"
651 #define ZPOOL_CONFIG_VDEV_SYNC_W_LAT_HISTO "vdev_sync_w_lat_histo"
652 #define ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO "vdev_async_r_lat_histo"
653 #define ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO "vdev_async_w_lat_histo"
654 #define ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO "vdev_scrub_histo"
656 /* Request size histograms */
657 #define ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO "vdev_sync_ind_r_histo"
658 #define ZPOOL_CONFIG_VDEV_SYNC_IND_W_HISTO "vdev_sync_ind_w_histo"
659 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO "vdev_async_ind_r_histo"
660 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO "vdev_async_ind_w_histo"
661 #define ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO "vdev_ind_scrub_histo"
662 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO "vdev_sync_agg_r_histo"
663 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO "vdev_sync_agg_w_histo"
664 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO "vdev_async_agg_r_histo"
665 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO "vdev_async_agg_w_histo"
666 #define ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO "vdev_agg_scrub_histo"
668 /* vdev enclosure sysfs path */
669 #define ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH "vdev_enc_sysfs_path"
671 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
672 #define ZPOOL_CONFIG_ERRCOUNT "error_count"
673 #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
674 #define ZPOOL_CONFIG_SPARES "spares"
675 #define ZPOOL_CONFIG_IS_SPARE "is_spare"
676 #define ZPOOL_CONFIG_NPARITY "nparity"
677 #define ZPOOL_CONFIG_HOSTID "hostid"
678 #define ZPOOL_CONFIG_HOSTNAME "hostname"
679 #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time"
680 #define ZPOOL_CONFIG_UNSPARE "unspare"
681 #define ZPOOL_CONFIG_PHYS_PATH "phys_path"
682 #define ZPOOL_CONFIG_IS_LOG "is_log"
683 #define ZPOOL_CONFIG_L2CACHE "l2cache"
684 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
685 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
686 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
687 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
688 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
689 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
690 #define ZPOOL_CONFIG_SPLIT "splitcfg"
691 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
692 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
693 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
694 #define ZPOOL_CONFIG_REMOVING "removing"
695 #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
696 #define ZPOOL_CONFIG_COMMENT "comment"
697 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
698 #define ZPOOL_CONFIG_SUSPENDED_REASON "suspended_reason" /* not stored */
699 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
700 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
701 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
702 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
703 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
704 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
705 #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */
706 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
707 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
708 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
709 #define ZPOOL_CONFIG_ERRATA "errata" /* not stored on disk */
710 #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top"
711 #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf"
712 #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps"
713 #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */
714 #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */
715 #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */
716 #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */
717 #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */
718 #define ZPOOL_CONFIG_ALLOCATION_BIAS "alloc_bias" /* not stored on disk */
721 * The persistent vdev state is stored as separate values rather than a single
722 * 'vdev_state' entry. This is because a device can be in multiple states, such
723 * as offline and degraded.
725 #define ZPOOL_CONFIG_OFFLINE "offline"
726 #define ZPOOL_CONFIG_FAULTED "faulted"
727 #define ZPOOL_CONFIG_DEGRADED "degraded"
728 #define ZPOOL_CONFIG_REMOVED "removed"
729 #define ZPOOL_CONFIG_FRU "fru"
730 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
732 /* Pool load policy parameters */
733 #define ZPOOL_LOAD_POLICY "load-policy"
734 #define ZPOOL_LOAD_REWIND_POLICY "load-rewind-policy"
735 #define ZPOOL_LOAD_REQUEST_TXG "load-request-txg"
736 #define ZPOOL_LOAD_META_THRESH "load-meta-thresh"
737 #define ZPOOL_LOAD_DATA_THRESH "load-data-thresh"
739 /* Rewind data discovered */
740 #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts"
741 #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors"
742 #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind"
744 #define VDEV_TYPE_ROOT "root"
745 #define VDEV_TYPE_MIRROR "mirror"
746 #define VDEV_TYPE_REPLACING "replacing"
747 #define VDEV_TYPE_RAIDZ "raidz"
748 #define VDEV_TYPE_DISK "disk"
749 #define VDEV_TYPE_FILE "file"
750 #define VDEV_TYPE_MISSING "missing"
751 #define VDEV_TYPE_HOLE "hole"
752 #define VDEV_TYPE_SPARE "spare"
753 #define VDEV_TYPE_LOG "log"
754 #define VDEV_TYPE_L2CACHE "l2cache"
755 #define VDEV_TYPE_INDIRECT "indirect"
757 /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
758 #define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
759 "com.delphix:indirect_obsolete_sm"
760 #define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
761 "com.delphix:obsolete_counts_are_precise"
762 #define VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \
763 "com.delphix:pool_checkpoint_sm"
765 #define VDEV_TOP_ZAP_ALLOCATION_BIAS \
766 "org.zfsonlinux:allocation_bias"
768 /* vdev metaslab allocation bias */
769 #define VDEV_ALLOC_BIAS_LOG "log"
770 #define VDEV_ALLOC_BIAS_SPECIAL "special"
771 #define VDEV_ALLOC_BIAS_DEDUP "dedup"
774 * This is needed in userland to report the minimum necessary device size.
776 #define SPA_MINDEVSIZE (64ULL << 20)
779 * Set if the fragmentation has not yet been calculated. This can happen
780 * because the space maps have not been upgraded or the histogram feature
783 #define ZFS_FRAG_INVALID UINT64_MAX
786 * The location of the pool configuration repository, shared between kernel and
789 #define ZPOOL_CACHE "/etc/zfs/zpool.cache"
792 * vdev states are ordered from least to most healthy.
793 * A vdev that's CANT_OPEN or below is considered unusable.
795 typedef enum vdev_state
{
796 VDEV_STATE_UNKNOWN
= 0, /* Uninitialized vdev */
797 VDEV_STATE_CLOSED
, /* Not currently open */
798 VDEV_STATE_OFFLINE
, /* Not allowed to open */
799 VDEV_STATE_REMOVED
, /* Explicitly removed from system */
800 VDEV_STATE_CANT_OPEN
, /* Tried to open, but failed */
801 VDEV_STATE_FAULTED
, /* External request to fault device */
802 VDEV_STATE_DEGRADED
, /* Replicated vdev with unhealthy kids */
803 VDEV_STATE_HEALTHY
/* Presumed good */
806 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
809 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
810 * of the vdev stats structure uses these constants to distinguish why.
812 typedef enum vdev_aux
{
813 VDEV_AUX_NONE
, /* no error */
814 VDEV_AUX_OPEN_FAILED
, /* ldi_open_*() or vn_open() failed */
815 VDEV_AUX_CORRUPT_DATA
, /* bad label or disk contents */
816 VDEV_AUX_NO_REPLICAS
, /* insufficient number of replicas */
817 VDEV_AUX_BAD_GUID_SUM
, /* vdev guid sum doesn't match */
818 VDEV_AUX_TOO_SMALL
, /* vdev size is too small */
819 VDEV_AUX_BAD_LABEL
, /* the label is OK but invalid */
820 VDEV_AUX_VERSION_NEWER
, /* on-disk version is too new */
821 VDEV_AUX_VERSION_OLDER
, /* on-disk version is too old */
822 VDEV_AUX_UNSUP_FEAT
, /* unsupported features */
823 VDEV_AUX_SPARED
, /* hot spare used in another pool */
824 VDEV_AUX_ERR_EXCEEDED
, /* too many errors */
825 VDEV_AUX_IO_FAILURE
, /* experienced I/O failure */
826 VDEV_AUX_BAD_LOG
, /* cannot read log chain(s) */
827 VDEV_AUX_EXTERNAL
, /* external diagnosis or forced fault */
828 VDEV_AUX_SPLIT_POOL
, /* vdev was split off into another pool */
829 VDEV_AUX_BAD_ASHIFT
, /* vdev ashift is invalid */
830 VDEV_AUX_EXTERNAL_PERSIST
, /* persistent forced fault */
831 VDEV_AUX_ACTIVE
, /* vdev active on a different host */
832 VDEV_AUX_CHILDREN_OFFLINE
, /* all children are offline */
836 * pool state. The following states are written to disk as part of the normal
837 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
838 * states are software abstractions used at various levels to communicate
841 typedef enum pool_state
{
842 POOL_STATE_ACTIVE
= 0, /* In active use */
843 POOL_STATE_EXPORTED
, /* Explicitly exported */
844 POOL_STATE_DESTROYED
, /* Explicitly destroyed */
845 POOL_STATE_SPARE
, /* Reserved for hot spare use */
846 POOL_STATE_L2CACHE
, /* Level 2 ARC device */
847 POOL_STATE_UNINITIALIZED
, /* Internal spa_t state */
848 POOL_STATE_UNAVAIL
, /* Internal libzfs state */
849 POOL_STATE_POTENTIALLY_ACTIVE
/* Internal libzfs state */
853 * mmp state. The following states provide additional detail describing
854 * why a pool couldn't be safely imported.
856 typedef enum mmp_state
{
857 MMP_STATE_ACTIVE
= 0, /* In active use */
858 MMP_STATE_INACTIVE
, /* Inactive and safe to import */
859 MMP_STATE_NO_HOSTID
/* System hostid is not set */
865 typedef enum pool_scan_func
{
873 * Used to control scrub pause and resume.
875 typedef enum pool_scrub_cmd
{
876 POOL_SCRUB_NORMAL
= 0,
883 CS_CHECKPOINT_EXISTS
,
884 CS_CHECKPOINT_DISCARDING
,
886 } checkpoint_state_t
;
888 typedef struct pool_checkpoint_stat
{
889 uint64_t pcs_state
; /* checkpoint_state_t */
890 uint64_t pcs_start_time
; /* time checkpoint/discard started */
891 uint64_t pcs_space
; /* checkpointed space */
892 } pool_checkpoint_stat_t
;
895 * ZIO types. Needed to interpret vdev statistics below.
897 typedef enum zio_type
{
908 * Pool statistics. Note: all fields should be 64-bit because this
909 * is passed between kernel and userland as an nvlist uint64 array.
911 typedef struct pool_scan_stat
{
912 /* values stored on disk */
913 uint64_t pss_func
; /* pool_scan_func_t */
914 uint64_t pss_state
; /* dsl_scan_state_t */
915 uint64_t pss_start_time
; /* scan start time */
916 uint64_t pss_end_time
; /* scan end time */
917 uint64_t pss_to_examine
; /* total bytes to scan */
918 uint64_t pss_examined
; /* total bytes located by scanner */
919 uint64_t pss_to_process
; /* total bytes to process */
920 uint64_t pss_processed
; /* total processed bytes */
921 uint64_t pss_errors
; /* scan errors */
923 /* values not stored on disk */
924 uint64_t pss_pass_exam
; /* examined bytes per scan pass */
925 uint64_t pss_pass_start
; /* start time of a scan pass */
926 uint64_t pss_pass_scrub_pause
; /* pause time of a scurb pass */
927 /* cumulative time scrub spent paused, needed for rate calculation */
928 uint64_t pss_pass_scrub_spent_paused
;
929 uint64_t pss_pass_issued
; /* issued bytes per scan pass */
930 uint64_t pss_issued
; /* total bytes checked by scanner */
933 typedef struct pool_removal_stat
{
934 uint64_t prs_state
; /* dsl_scan_state_t */
935 uint64_t prs_removing_vdev
;
936 uint64_t prs_start_time
;
937 uint64_t prs_end_time
;
938 uint64_t prs_to_copy
; /* bytes that need to be copied */
939 uint64_t prs_copied
; /* bytes copied so far */
941 * bytes of memory used for indirect mappings.
942 * This includes all removed vdevs.
944 uint64_t prs_mapping_memory
;
945 } pool_removal_stat_t
;
947 typedef enum dsl_scan_state
{
956 * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER. The ordering
957 * of this enum must be maintained to ensure the errata identifiers map to
958 * the correct documentation. New errata may only be appended to the list
959 * and must contain corresponding documentation at the above link.
961 typedef enum zpool_errata
{
963 ZPOOL_ERRATA_ZOL_2094_SCRUB
,
964 ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY
,
965 ZPOOL_ERRATA_ZOL_6845_ENCRYPTION
,
969 * Vdev statistics. Note: all fields should be 64-bit because this
970 * is passed between kernel and userland as an nvlist uint64 array.
972 typedef struct vdev_stat
{
973 hrtime_t vs_timestamp
; /* time since vdev load */
974 uint64_t vs_state
; /* vdev state */
975 uint64_t vs_aux
; /* see vdev_aux_t */
976 uint64_t vs_alloc
; /* space allocated */
977 uint64_t vs_space
; /* total capacity */
978 uint64_t vs_dspace
; /* deflated capacity */
979 uint64_t vs_rsize
; /* replaceable dev size */
980 uint64_t vs_esize
; /* expandable dev size */
981 uint64_t vs_ops
[ZIO_TYPES
]; /* operation count */
982 uint64_t vs_bytes
[ZIO_TYPES
]; /* bytes read/written */
983 uint64_t vs_read_errors
; /* read errors */
984 uint64_t vs_write_errors
; /* write errors */
985 uint64_t vs_checksum_errors
; /* checksum errors */
986 uint64_t vs_self_healed
; /* self-healed bytes */
987 uint64_t vs_scan_removing
; /* removing? */
988 uint64_t vs_scan_processed
; /* scan processed bytes */
989 uint64_t vs_fragmentation
; /* device fragmentation */
990 uint64_t vs_checkpoint_space
; /* checkpoint-consumed space */
996 * These are stats which aren't included in the original iostat output. For
997 * convenience, they are grouped together in vdev_stat_ex, although each stat
998 * is individually exported as an nvlist.
1000 typedef struct vdev_stat_ex
{
1001 /* Number of ZIOs issued to disk and waiting to finish */
1002 uint64_t vsx_active_queue
[ZIO_PRIORITY_NUM_QUEUEABLE
];
1004 /* Number of ZIOs pending to be issued to disk */
1005 uint64_t vsx_pend_queue
[ZIO_PRIORITY_NUM_QUEUEABLE
];
1008 * Below are the histograms for various latencies. Buckets are in
1009 * units of nanoseconds.
1013 * 2^37 nanoseconds = 134s. Timeouts will probably start kicking in
1016 #define VDEV_L_HISTO_BUCKETS 37 /* Latency histo buckets */
1017 #define VDEV_RQ_HISTO_BUCKETS 25 /* Request size histo buckets */
1020 /* Amount of time in ZIO queue (ns) */
1021 uint64_t vsx_queue_histo
[ZIO_PRIORITY_NUM_QUEUEABLE
]
1022 [VDEV_L_HISTO_BUCKETS
];
1024 /* Total ZIO latency (ns). Includes queuing and disk access time */
1025 uint64_t vsx_total_histo
[ZIO_TYPES
][VDEV_L_HISTO_BUCKETS
];
1027 /* Amount of time to read/write the disk (ns) */
1028 uint64_t vsx_disk_histo
[ZIO_TYPES
][VDEV_L_HISTO_BUCKETS
];
1030 /* "lookup the bucket for a value" histogram macros */
1031 #define HISTO(val, buckets) (val != 0 ? MIN(highbit64(val) - 1, \
1033 #define L_HISTO(a) HISTO(a, VDEV_L_HISTO_BUCKETS)
1034 #define RQ_HISTO(a) HISTO(a, VDEV_RQ_HISTO_BUCKETS)
1036 /* Physical IO histogram */
1037 uint64_t vsx_ind_histo
[ZIO_PRIORITY_NUM_QUEUEABLE
]
1038 [VDEV_RQ_HISTO_BUCKETS
];
1040 /* Delegated (aggregated) physical IO histogram */
1041 uint64_t vsx_agg_histo
[ZIO_PRIORITY_NUM_QUEUEABLE
]
1042 [VDEV_RQ_HISTO_BUCKETS
];
1047 * DDT statistics. Note: all fields should be 64-bit because this
1048 * is passed between kernel and userland as an nvlist uint64 array.
1050 typedef struct ddt_object
{
1051 uint64_t ddo_count
; /* number of elements in ddt */
1052 uint64_t ddo_dspace
; /* size of ddt on disk */
1053 uint64_t ddo_mspace
; /* size of ddt in-core */
1056 typedef struct ddt_stat
{
1057 uint64_t dds_blocks
; /* blocks */
1058 uint64_t dds_lsize
; /* logical size */
1059 uint64_t dds_psize
; /* physical size */
1060 uint64_t dds_dsize
; /* deflated allocated size */
1061 uint64_t dds_ref_blocks
; /* referenced blocks */
1062 uint64_t dds_ref_lsize
; /* referenced lsize * refcnt */
1063 uint64_t dds_ref_psize
; /* referenced psize * refcnt */
1064 uint64_t dds_ref_dsize
; /* referenced dsize * refcnt */
1067 typedef struct ddt_histogram
{
1068 ddt_stat_t ddh_stat
[64]; /* power-of-two histogram buckets */
1071 #define ZVOL_DRIVER "zvol"
1072 #define ZFS_DRIVER "zfs"
1073 #define ZFS_DEV "/dev/zfs"
1074 #define ZFS_SHARETAB "/etc/dfs/sharetab"
1076 #define ZFS_SUPER_MAGIC 0x2fc12fc1
1078 /* general zvol path */
1079 #define ZVOL_DIR "/dev"
1081 #define ZVOL_MAJOR 230
1082 #define ZVOL_MINOR_BITS 4
1083 #define ZVOL_MINOR_MASK ((1U << ZVOL_MINOR_BITS) - 1)
1084 #define ZVOL_MINORS (1 << 4)
1085 #define ZVOL_DEV_NAME "zd"
1087 #define ZVOL_PROP_NAME "name"
1088 #define ZVOL_DEFAULT_BLOCKSIZE 8192
1091 * /dev/zfs ioctl numbers.
1093 * These numbers cannot change over time. New ioctl numbers must be appended.
1095 typedef enum zfs_ioc
{
1097 * Illumos - 71/128 numbers reserved.
1099 ZFS_IOC_FIRST
= ('Z' << 8),
1100 ZFS_IOC
= ZFS_IOC_FIRST
,
1101 ZFS_IOC_POOL_CREATE
= ZFS_IOC_FIRST
, /* 0x5a00 */
1102 ZFS_IOC_POOL_DESTROY
, /* 0x5a01 */
1103 ZFS_IOC_POOL_IMPORT
, /* 0x5a02 */
1104 ZFS_IOC_POOL_EXPORT
, /* 0x5a03 */
1105 ZFS_IOC_POOL_CONFIGS
, /* 0x5a04 */
1106 ZFS_IOC_POOL_STATS
, /* 0x5a05 */
1107 ZFS_IOC_POOL_TRYIMPORT
, /* 0x5a06 */
1108 ZFS_IOC_POOL_SCAN
, /* 0x5a07 */
1109 ZFS_IOC_POOL_FREEZE
, /* 0x5a08 */
1110 ZFS_IOC_POOL_UPGRADE
, /* 0x5a09 */
1111 ZFS_IOC_POOL_GET_HISTORY
, /* 0x5a0a */
1112 ZFS_IOC_VDEV_ADD
, /* 0x5a0b */
1113 ZFS_IOC_VDEV_REMOVE
, /* 0x5a0c */
1114 ZFS_IOC_VDEV_SET_STATE
, /* 0x5a0d */
1115 ZFS_IOC_VDEV_ATTACH
, /* 0x5a0e */
1116 ZFS_IOC_VDEV_DETACH
, /* 0x5a0f */
1117 ZFS_IOC_VDEV_SETPATH
, /* 0x5a10 */
1118 ZFS_IOC_VDEV_SETFRU
, /* 0x5a11 */
1119 ZFS_IOC_OBJSET_STATS
, /* 0x5a12 */
1120 ZFS_IOC_OBJSET_ZPLPROPS
, /* 0x5a13 */
1121 ZFS_IOC_DATASET_LIST_NEXT
, /* 0x5a14 */
1122 ZFS_IOC_SNAPSHOT_LIST_NEXT
, /* 0x5a15 */
1123 ZFS_IOC_SET_PROP
, /* 0x5a16 */
1124 ZFS_IOC_CREATE
, /* 0x5a17 */
1125 ZFS_IOC_DESTROY
, /* 0x5a18 */
1126 ZFS_IOC_ROLLBACK
, /* 0x5a19 */
1127 ZFS_IOC_RENAME
, /* 0x5a1a */
1128 ZFS_IOC_RECV
, /* 0x5a1b */
1129 ZFS_IOC_SEND
, /* 0x5a1c */
1130 ZFS_IOC_INJECT_FAULT
, /* 0x5a1d */
1131 ZFS_IOC_CLEAR_FAULT
, /* 0x5a1e */
1132 ZFS_IOC_INJECT_LIST_NEXT
, /* 0x5a1f */
1133 ZFS_IOC_ERROR_LOG
, /* 0x5a20 */
1134 ZFS_IOC_CLEAR
, /* 0x5a21 */
1135 ZFS_IOC_PROMOTE
, /* 0x5a22 */
1136 ZFS_IOC_SNAPSHOT
, /* 0x5a23 */
1137 ZFS_IOC_DSOBJ_TO_DSNAME
, /* 0x5a24 */
1138 ZFS_IOC_OBJ_TO_PATH
, /* 0x5a25 */
1139 ZFS_IOC_POOL_SET_PROPS
, /* 0x5a26 */
1140 ZFS_IOC_POOL_GET_PROPS
, /* 0x5a27 */
1141 ZFS_IOC_SET_FSACL
, /* 0x5a28 */
1142 ZFS_IOC_GET_FSACL
, /* 0x5a29 */
1143 ZFS_IOC_SHARE
, /* 0x5a2a */
1144 ZFS_IOC_INHERIT_PROP
, /* 0x5a2b */
1145 ZFS_IOC_SMB_ACL
, /* 0x5a2c */
1146 ZFS_IOC_USERSPACE_ONE
, /* 0x5a2d */
1147 ZFS_IOC_USERSPACE_MANY
, /* 0x5a2e */
1148 ZFS_IOC_USERSPACE_UPGRADE
, /* 0x5a2f */
1149 ZFS_IOC_HOLD
, /* 0x5a30 */
1150 ZFS_IOC_RELEASE
, /* 0x5a31 */
1151 ZFS_IOC_GET_HOLDS
, /* 0x5a32 */
1152 ZFS_IOC_OBJSET_RECVD_PROPS
, /* 0x5a33 */
1153 ZFS_IOC_VDEV_SPLIT
, /* 0x5a34 */
1154 ZFS_IOC_NEXT_OBJ
, /* 0x5a35 */
1155 ZFS_IOC_DIFF
, /* 0x5a36 */
1156 ZFS_IOC_TMP_SNAPSHOT
, /* 0x5a37 */
1157 ZFS_IOC_OBJ_TO_STATS
, /* 0x5a38 */
1158 ZFS_IOC_SPACE_WRITTEN
, /* 0x5a39 */
1159 ZFS_IOC_SPACE_SNAPS
, /* 0x5a3a */
1160 ZFS_IOC_DESTROY_SNAPS
, /* 0x5a3b */
1161 ZFS_IOC_POOL_REGUID
, /* 0x5a3c */
1162 ZFS_IOC_POOL_REOPEN
, /* 0x5a3d */
1163 ZFS_IOC_SEND_PROGRESS
, /* 0x5a3e */
1164 ZFS_IOC_LOG_HISTORY
, /* 0x5a3f */
1165 ZFS_IOC_SEND_NEW
, /* 0x5a40 */
1166 ZFS_IOC_SEND_SPACE
, /* 0x5a41 */
1167 ZFS_IOC_CLONE
, /* 0x5a42 */
1168 ZFS_IOC_BOOKMARK
, /* 0x5a43 */
1169 ZFS_IOC_GET_BOOKMARKS
, /* 0x5a44 */
1170 ZFS_IOC_DESTROY_BOOKMARKS
, /* 0x5a45 */
1171 ZFS_IOC_CHANNEL_PROGRAM
, /* 0x5a46 */
1172 ZFS_IOC_RECV_NEW
, /* 0x5a47 */
1173 ZFS_IOC_POOL_SYNC
, /* 0x5a48 */
1174 ZFS_IOC_LOAD_KEY
, /* 0x5a49 */
1175 ZFS_IOC_UNLOAD_KEY
, /* 0x5a4a */
1176 ZFS_IOC_CHANGE_KEY
, /* 0x5a4b */
1177 ZFS_IOC_REMAP
, /* 0x5a4c */
1178 ZFS_IOC_POOL_CHECKPOINT
, /* 0x5a4d */
1179 ZFS_IOC_POOL_DISCARD_CHECKPOINT
, /* 0x5a4e */
1182 * Linux - 3/64 numbers reserved.
1184 ZFS_IOC_LINUX
= ('Z' << 8) + 0x80,
1185 ZFS_IOC_EVENTS_NEXT
, /* 0x5a81 */
1186 ZFS_IOC_EVENTS_CLEAR
, /* 0x5a82 */
1187 ZFS_IOC_EVENTS_SEEK
, /* 0x5a83 */
1190 * FreeBSD - 1/64 numbers reserved.
1192 ZFS_IOC_FREEBSD
= ('Z' << 8) + 0xC0,
1198 * zvol ioctl to get dataset name
1200 #define BLKZNAME _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN])
1203 * ZFS-specific error codes used for returning descriptive errors
1204 * to the userland through zfs ioctls.
1206 * The enum implicitly includes all the error codes from errno.h.
1207 * New code should use and extend this enum for errors that are
1208 * not described precisely by generic errno codes.
1210 * These numbers should not change over time. New entries should be appended.
1213 ZFS_ERR_CHECKPOINT_EXISTS
= 1024,
1214 ZFS_ERR_DISCARDING_CHECKPOINT
,
1215 ZFS_ERR_NO_CHECKPOINT
,
1216 ZFS_ERR_DEVRM_IN_PROGRESS
,
1217 ZFS_ERR_VDEV_TOO_BIG
,
1218 ZFS_ERR_IOC_CMD_UNAVAIL
,
1219 ZFS_ERR_IOC_ARG_UNAVAIL
,
1220 ZFS_ERR_IOC_ARG_REQUIRED
,
1221 ZFS_ERR_IOC_ARG_BADTYPE
,
1225 * Internal SPA load state. Used by FMA diagnosis engine.
1228 SPA_LOAD_NONE
, /* no load in progress */
1229 SPA_LOAD_OPEN
, /* normal open */
1230 SPA_LOAD_IMPORT
, /* import in progress */
1231 SPA_LOAD_TRYIMPORT
, /* tryimport in progress */
1232 SPA_LOAD_RECOVER
, /* recovery requested */
1233 SPA_LOAD_ERROR
, /* load failed */
1234 SPA_LOAD_CREATE
/* creation in progress */
1238 * Bookmark name values.
1240 #define ZPOOL_ERR_LIST "error list"
1241 #define ZPOOL_ERR_DATASET "dataset"
1242 #define ZPOOL_ERR_OBJECT "object"
1244 #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1)
1247 * The following are names used in the nvlist describing
1248 * the pool's history log.
1250 #define ZPOOL_HIST_RECORD "history record"
1251 #define ZPOOL_HIST_TIME "history time"
1252 #define ZPOOL_HIST_CMD "history command"
1253 #define ZPOOL_HIST_WHO "history who"
1254 #define ZPOOL_HIST_ZONE "history zone"
1255 #define ZPOOL_HIST_HOST "history hostname"
1256 #define ZPOOL_HIST_TXG "history txg"
1257 #define ZPOOL_HIST_INT_EVENT "history internal event"
1258 #define ZPOOL_HIST_INT_STR "history internal str"
1259 #define ZPOOL_HIST_INT_NAME "internal_name"
1260 #define ZPOOL_HIST_IOCTL "ioctl"
1261 #define ZPOOL_HIST_INPUT_NVL "in_nvl"
1262 #define ZPOOL_HIST_OUTPUT_NVL "out_nvl"
1263 #define ZPOOL_HIST_DSNAME "dsname"
1264 #define ZPOOL_HIST_DSID "dsid"
1265 #define ZPOOL_HIST_ERRNO "errno"
1268 * Special nvlist name that will not have its args recorded in the pool's
1271 #define ZPOOL_HIDDEN_ARGS "hidden_args"
1274 * Flags for ZFS_IOC_VDEV_SET_STATE
1276 #define ZFS_ONLINE_CHECKREMOVE 0x1
1277 #define ZFS_ONLINE_UNSPARE 0x2
1278 #define ZFS_ONLINE_FORCEFAULT 0x4
1279 #define ZFS_ONLINE_EXPAND 0x8
1280 #define ZFS_OFFLINE_TEMPORARY 0x1
1283 * Flags for ZFS_IOC_POOL_IMPORT
1285 #define ZFS_IMPORT_NORMAL 0x0
1286 #define ZFS_IMPORT_VERBATIM 0x1
1287 #define ZFS_IMPORT_ANY_HOST 0x2
1288 #define ZFS_IMPORT_MISSING_LOG 0x4
1289 #define ZFS_IMPORT_ONLY 0x8
1290 #define ZFS_IMPORT_TEMP_NAME 0x10
1291 #define ZFS_IMPORT_SKIP_MMP 0x20
1292 #define ZFS_IMPORT_LOAD_KEYS 0x40
1293 #define ZFS_IMPORT_CHECKPOINT 0x80
1296 * Channel program argument/return nvlist keys and defaults.
1298 #define ZCP_ARG_PROGRAM "program"
1299 #define ZCP_ARG_ARGLIST "arg"
1300 #define ZCP_ARG_SYNC "sync"
1301 #define ZCP_ARG_INSTRLIMIT "instrlimit"
1302 #define ZCP_ARG_MEMLIMIT "memlimit"
1304 #define ZCP_ARG_CLIARGV "argv"
1306 #define ZCP_RET_ERROR "error"
1307 #define ZCP_RET_RETURN "return"
1309 #define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000)
1310 #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT)
1311 #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024)
1312 #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT)
1315 * Sysevent payload members. ZFS will generate the following sysevents with the
1318 * ESC_ZFS_RESILVER_START
1319 * ESC_ZFS_RESILVER_END
1320 * ESC_ZFS_POOL_DESTROY
1321 * ESC_ZFS_POOL_REGUID
1323 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1324 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1326 * ESC_ZFS_VDEV_REMOVE
1327 * ESC_ZFS_VDEV_CLEAR
1328 * ESC_ZFS_VDEV_CHECK
1330 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1331 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1332 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
1333 * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
1335 * ESC_ZFS_HISTORY_EVENT
1337 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
1338 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
1339 * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional)
1340 * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional)
1341 * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional)
1342 * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional)
1343 * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional)
1344 * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional)
1345 * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional)
1346 * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional)
1347 * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional)
1348 * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional)
1349 * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional)
1350 * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional)
1352 * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1353 * history log nvlist. The keynames will be free of any spaces or other
1354 * characters that could be potentially unexpected to consumers of the
1357 #define ZFS_EV_POOL_NAME "pool_name"
1358 #define ZFS_EV_POOL_GUID "pool_guid"
1359 #define ZFS_EV_VDEV_PATH "vdev_path"
1360 #define ZFS_EV_VDEV_GUID "vdev_guid"
1361 #define ZFS_EV_HIST_TIME "history_time"
1362 #define ZFS_EV_HIST_CMD "history_command"
1363 #define ZFS_EV_HIST_WHO "history_who"
1364 #define ZFS_EV_HIST_ZONE "history_zone"
1365 #define ZFS_EV_HIST_HOST "history_hostname"
1366 #define ZFS_EV_HIST_TXG "history_txg"
1367 #define ZFS_EV_HIST_INT_EVENT "history_internal_event"
1368 #define ZFS_EV_HIST_INT_STR "history_internal_str"
1369 #define ZFS_EV_HIST_INT_NAME "history_internal_name"
1370 #define ZFS_EV_HIST_IOCTL "history_ioctl"
1371 #define ZFS_EV_HIST_DSNAME "history_dsname"
1372 #define ZFS_EV_HIST_DSID "history_dsid"
1378 #endif /* _SYS_FS_ZFS_H */