1 /* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright (c) 2011, 2016 by Delphix. All rights reserved. 25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 26 * Copyright (c) 2014 Integros [integros.com] 27 * Copyright 2020 Joyent, Inc. 28 * Copyright (c) 2017 Datto Inc. 29 * Copyright (c) 2017, Intel Corporation. 30 */ 31 32 /* Portions Copyright 2010 Robert Milkowski */ 33 34 #ifndef _SYS_FS_ZFS_H 35 #define _SYS_FS_ZFS_H 36 37 #include <sys/time.h> 38 /* 39 * In OpenZFS we include sys/zio_priority.h to get the enum value of 40 * ZIO_PRIORITY_NUM_QUEUEABLE, which is used for the various array sizes in 41 * the structure definitions below. However, in illumos zio_priority.h is not 42 * readily available to the userland code where we have a very large number of 43 * files including sys/zfs.h. Thus, we define ZIO_PRIORITY_N_QUEUEABLE here and 44 * this should be kept in sync if ZIO_PRIORITY_NUM_QUEUEABLE changes. 45 */ 46 #define ZIO_PRIORITY_N_QUEUEABLE 8 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 /* 53 * Types and constants shared between userland and the kernel. 54 */ 55 56 /* 57 * Each dataset can be one of the following types. These constants can be 58 * combined into masks that can be passed to various functions. 59 */ 60 typedef enum { 61 ZFS_TYPE_FILESYSTEM = (1 << 0), 62 ZFS_TYPE_SNAPSHOT = (1 << 1), 63 ZFS_TYPE_VOLUME = (1 << 2), 64 ZFS_TYPE_POOL = (1 << 3), 65 ZFS_TYPE_BOOKMARK = (1 << 4) 66 } zfs_type_t; 67 68 /* 69 * NB: lzc_dataset_type should be updated whenever a new objset type is added, 70 * if it represents a real type of a dataset that can be created from userland. 71 */ 72 typedef enum dmu_objset_type { 73 DMU_OST_NONE, 74 DMU_OST_META, 75 DMU_OST_ZFS, 76 DMU_OST_ZVOL, 77 DMU_OST_OTHER, /* For testing only! */ 78 DMU_OST_ANY, /* Be careful! */ 79 DMU_OST_NUMTYPES 80 } dmu_objset_type_t; 81 82 #define ZFS_TYPE_DATASET \ 83 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) 84 85 /* 86 * All of these include the terminating NUL byte. 87 */ 88 #define ZAP_MAXNAMELEN 256 89 #define ZAP_MAXVALUELEN (1024 * 8) 90 #define ZAP_OLDMAXVALUELEN 1024 91 #define ZFS_MAX_DATASET_NAME_LEN 256 92 93 /* 94 * Dataset properties are identified by these constants and must be added to 95 * the end of this list to ensure that external consumers are not affected 96 * by the change. If you make any changes to this list, be sure to update 97 * the property table in usr/src/common/zfs/zfs_prop.c. 98 */ 99 typedef enum { 100 ZPROP_CONT = -2, 101 ZPROP_INVAL = -1, 102 ZFS_PROP_TYPE = 0, 103 ZFS_PROP_CREATION, 104 ZFS_PROP_USED, 105 ZFS_PROP_AVAILABLE, 106 ZFS_PROP_REFERENCED, 107 ZFS_PROP_COMPRESSRATIO, 108 ZFS_PROP_MOUNTED, 109 ZFS_PROP_ORIGIN, 110 ZFS_PROP_QUOTA, 111 ZFS_PROP_RESERVATION, 112 ZFS_PROP_VOLSIZE, 113 ZFS_PROP_VOLBLOCKSIZE, 114 ZFS_PROP_RECORDSIZE, 115 ZFS_PROP_MOUNTPOINT, 116 ZFS_PROP_SHARENFS, 117 ZFS_PROP_CHECKSUM, 118 ZFS_PROP_COMPRESSION, 119 ZFS_PROP_ATIME, 120 ZFS_PROP_DEVICES, 121 ZFS_PROP_EXEC, 122 ZFS_PROP_SETUID, 123 ZFS_PROP_READONLY, 124 ZFS_PROP_ZONED, 125 ZFS_PROP_SNAPDIR, 126 ZFS_PROP_ACLMODE, 127 ZFS_PROP_ACLINHERIT, 128 ZFS_PROP_CREATETXG, 129 ZFS_PROP_NAME, /* not exposed to the user */ 130 ZFS_PROP_CANMOUNT, 131 ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ 132 ZFS_PROP_XATTR, 133 ZFS_PROP_NUMCLONES, /* not exposed to the user */ 134 ZFS_PROP_COPIES, 135 ZFS_PROP_VERSION, 136 ZFS_PROP_UTF8ONLY, 137 ZFS_PROP_NORMALIZE, 138 ZFS_PROP_CASE, 139 ZFS_PROP_VSCAN, 140 ZFS_PROP_NBMAND, 141 ZFS_PROP_SHARESMB, 142 ZFS_PROP_REFQUOTA, 143 ZFS_PROP_REFRESERVATION, 144 ZFS_PROP_GUID, 145 ZFS_PROP_PRIMARYCACHE, 146 ZFS_PROP_SECONDARYCACHE, 147 ZFS_PROP_USEDSNAP, 148 ZFS_PROP_USEDDS, 149 ZFS_PROP_USEDCHILD, 150 ZFS_PROP_USEDREFRESERV, 151 ZFS_PROP_USERACCOUNTING, /* not exposed to the user */ 152 ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */ 153 ZFS_PROP_DEFER_DESTROY, 154 ZFS_PROP_USERREFS, 155 ZFS_PROP_LOGBIAS, 156 ZFS_PROP_UNIQUE, /* not exposed to the user */ 157 ZFS_PROP_OBJSETID, /* not exposed to the user */ 158 ZFS_PROP_DEDUP, 159 ZFS_PROP_MLSLABEL, 160 ZFS_PROP_SYNC, 161 ZFS_PROP_DNODESIZE, 162 ZFS_PROP_REFRATIO, 163 ZFS_PROP_WRITTEN, 164 ZFS_PROP_CLONES, 165 ZFS_PROP_LOGICALUSED, 166 ZFS_PROP_LOGICALREFERENCED, 167 ZFS_PROP_INCONSISTENT, /* not exposed to the user */ 168 ZFS_PROP_FILESYSTEM_LIMIT, 169 ZFS_PROP_SNAPSHOT_LIMIT, 170 ZFS_PROP_FILESYSTEM_COUNT, 171 ZFS_PROP_SNAPSHOT_COUNT, 172 ZFS_PROP_REDUNDANT_METADATA, 173 ZFS_PROP_PREV_SNAP, 174 ZFS_PROP_RECEIVE_RESUME_TOKEN, 175 ZFS_PROP_REMAPTXG, /* not exposed to the user */ 176 ZFS_PROP_SPECIAL_SMALL_BLOCKS, 177 ZFS_PROP_ENCRYPTION, 178 ZFS_PROP_KEYLOCATION, 179 ZFS_PROP_KEYFORMAT, 180 ZFS_PROP_PBKDF2_SALT, 181 ZFS_PROP_PBKDF2_ITERS, 182 ZFS_PROP_ENCRYPTION_ROOT, 183 ZFS_PROP_KEY_GUID, 184 ZFS_PROP_KEYSTATUS, 185 ZFS_PROP_IVSET_GUID, /* not exposed to the user */ 186 ZFS_NUM_PROPS 187 } zfs_prop_t; 188 189 typedef enum { 190 ZFS_PROP_USERUSED, 191 ZFS_PROP_USERQUOTA, 192 ZFS_PROP_GROUPUSED, 193 ZFS_PROP_GROUPQUOTA, 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; 204 205 extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS]; 206 207 /* 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 usr/src/common/zfs/zpool_prop.c. 212 */ 213 typedef enum { 214 ZPOOL_PROP_INVAL = -1, 215 ZPOOL_PROP_NAME, 216 ZPOOL_PROP_SIZE, 217 ZPOOL_PROP_CAPACITY, 218 ZPOOL_PROP_ALTROOT, 219 ZPOOL_PROP_HEALTH, 220 ZPOOL_PROP_GUID, 221 ZPOOL_PROP_VERSION, 222 ZPOOL_PROP_BOOTFS, 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, 231 ZPOOL_PROP_FREE, 232 ZPOOL_PROP_ALLOCATED, 233 ZPOOL_PROP_READONLY, 234 ZPOOL_PROP_COMMENT, 235 ZPOOL_PROP_EXPANDSZ, 236 ZPOOL_PROP_FREEING, 237 ZPOOL_PROP_FRAGMENTATION, 238 ZPOOL_PROP_LEAKED, 239 ZPOOL_PROP_MAXBLOCKSIZE, 240 ZPOOL_PROP_BOOTSIZE, 241 ZPOOL_PROP_CHECKPOINT, 242 ZPOOL_PROP_TNAME, 243 ZPOOL_PROP_MAXDNODESIZE, 244 ZPOOL_PROP_MULTIHOST, 245 ZPOOL_PROP_ASHIFT, 246 ZPOOL_PROP_AUTOTRIM, 247 ZPOOL_NUM_PROPS 248 } zpool_prop_t; 249 250 /* Small enough to not hog a whole line of printout in zpool(1M). */ 251 #define ZPROP_MAX_COMMENT 32 252 253 #define ZPROP_VALUE "value" 254 #define ZPROP_SOURCE "source" 255 256 typedef enum { 257 ZPROP_SRC_NONE = 0x1, 258 ZPROP_SRC_DEFAULT = 0x2, 259 ZPROP_SRC_TEMPORARY = 0x4, 260 ZPROP_SRC_LOCAL = 0x8, 261 ZPROP_SRC_INHERITED = 0x10, 262 ZPROP_SRC_RECEIVED = 0x20 263 } zprop_source_t; 264 265 #define ZPROP_SRC_ALL 0x3f 266 267 #define ZPROP_SOURCE_VAL_RECVD "$recvd" 268 #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS" 269 /* 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 274 * preserved. 275 */ 276 #define ZPROP_HAS_RECVD "$hasrecvd" 277 278 typedef enum { 279 ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */ 280 ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */ 281 } zprop_errflags_t; 282 283 typedef int (*zprop_func)(int, void *); 284 285 /* 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. 289 */ 290 #define ZPOOL_ROOTFS_PROPS "root-props-nvl" 291 292 /* 293 * Length of 'written@' and 'written#' 294 */ 295 #define ZFS_WRITTEN_PROP_PREFIX_LEN 8 296 297 /* 298 * Dataset property functions shared between libzfs and kernel. 299 */ 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); 317 318 /* 319 * Pool property functions shared between libzfs and kernel. 320 */ 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_feature(const char *); 327 boolean_t zpool_prop_unsupported(const char *name); 328 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **); 329 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *); 330 uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed); 331 332 /* 333 * Definitions for the Delegation. 334 */ 335 typedef enum { 336 ZFS_DELEG_WHO_UNKNOWN = 0, 337 ZFS_DELEG_USER = 'u', 338 ZFS_DELEG_USER_SETS = 'U', 339 ZFS_DELEG_GROUP = 'g', 340 ZFS_DELEG_GROUP_SETS = 'G', 341 ZFS_DELEG_EVERYONE = 'e', 342 ZFS_DELEG_EVERYONE_SETS = 'E', 343 ZFS_DELEG_CREATE = 'c', 344 ZFS_DELEG_CREATE_SETS = 'C', 345 ZFS_DELEG_NAMED_SET = 's', 346 ZFS_DELEG_NAMED_SET_SETS = 'S' 347 } zfs_deleg_who_type_t; 348 349 typedef enum { 350 ZFS_DELEG_NONE = 0, 351 ZFS_DELEG_PERM_LOCAL = 1, 352 ZFS_DELEG_PERM_DESCENDENT = 2, 353 ZFS_DELEG_PERM_LOCALDESCENDENT = 3, 354 ZFS_DELEG_PERM_CREATE = 4 355 } zfs_deleg_inherit_t; 356 357 #define ZFS_DELEG_PERM_UID "uid" 358 #define ZFS_DELEG_PERM_GID "gid" 359 #define ZFS_DELEG_PERM_GROUPS "groups" 360 361 #define ZFS_MLSLABEL_DEFAULT "none" 362 363 #define ZFS_SMB_ACL_SRC "src" 364 #define ZFS_SMB_ACL_TARGET "target" 365 366 typedef enum { 367 ZFS_CANMOUNT_OFF = 0, 368 ZFS_CANMOUNT_ON = 1, 369 ZFS_CANMOUNT_NOAUTO = 2 370 } zfs_canmount_type_t; 371 372 typedef enum { 373 ZFS_LOGBIAS_LATENCY = 0, 374 ZFS_LOGBIAS_THROUGHPUT = 1 375 } zfs_logbias_op_t; 376 377 typedef enum zfs_share_op { 378 ZFS_SHARE_NFS = 0, 379 ZFS_UNSHARE_NFS = 1, 380 ZFS_SHARE_SMB = 2, 381 ZFS_UNSHARE_SMB = 3 382 } zfs_share_op_t; 383 384 typedef enum zfs_smb_acl_op { 385 ZFS_SMB_ACL_ADD, 386 ZFS_SMB_ACL_REMOVE, 387 ZFS_SMB_ACL_RENAME, 388 ZFS_SMB_ACL_PURGE 389 } zfs_smb_acl_op_t; 390 391 typedef enum zfs_cache_type { 392 ZFS_CACHE_NONE = 0, 393 ZFS_CACHE_METADATA = 1, 394 ZFS_CACHE_ALL = 2 395 } zfs_cache_type_t; 396 397 typedef enum { 398 ZFS_SYNC_STANDARD = 0, 399 ZFS_SYNC_ALWAYS = 1, 400 ZFS_SYNC_DISABLED = 2 401 } zfs_sync_type_t; 402 403 typedef enum { 404 ZFS_DNSIZE_LEGACY = 0, 405 ZFS_DNSIZE_AUTO = 1, 406 ZFS_DNSIZE_1K = 1024, 407 ZFS_DNSIZE_2K = 2048, 408 ZFS_DNSIZE_4K = 4096, 409 ZFS_DNSIZE_8K = 8192, 410 ZFS_DNSIZE_16K = 16384 411 } zfs_dnsize_type_t; 412 413 typedef enum { 414 ZFS_REDUNDANT_METADATA_ALL, 415 ZFS_REDUNDANT_METADATA_MOST 416 } zfs_redundant_metadata_type_t; 417 418 typedef enum zfs_keystatus { 419 ZFS_KEYSTATUS_NONE = 0, 420 ZFS_KEYSTATUS_UNAVAILABLE, 421 ZFS_KEYSTATUS_AVAILABLE 422 } zfs_keystatus_t; 423 424 typedef enum zfs_keyformat { 425 ZFS_KEYFORMAT_NONE = 0, 426 ZFS_KEYFORMAT_RAW, 427 ZFS_KEYFORMAT_HEX, 428 ZFS_KEYFORMAT_PASSPHRASE, 429 ZFS_KEYFORMAT_FORMATS 430 } zfs_keyformat_t; 431 432 typedef enum zfs_key_location { 433 ZFS_KEYLOCATION_NONE = 0, 434 ZFS_KEYLOCATION_PROMPT, 435 ZFS_KEYLOCATION_URI, 436 ZFS_KEYLOCATION_LOCATIONS 437 } zfs_keylocation_t; 438 439 #define DEFAULT_PBKDF2_ITERATIONS 350000 440 #define MIN_PBKDF2_ITERATIONS 100000 441 442 /* 443 * On-disk version number. 444 */ 445 #define SPA_VERSION_1 1ULL 446 #define SPA_VERSION_2 2ULL 447 #define SPA_VERSION_3 3ULL 448 #define SPA_VERSION_4 4ULL 449 #define SPA_VERSION_5 5ULL 450 #define SPA_VERSION_6 6ULL 451 #define SPA_VERSION_7 7ULL 452 #define SPA_VERSION_8 8ULL 453 #define SPA_VERSION_9 9ULL 454 #define SPA_VERSION_10 10ULL 455 #define SPA_VERSION_11 11ULL 456 #define SPA_VERSION_12 12ULL 457 #define SPA_VERSION_13 13ULL 458 #define SPA_VERSION_14 14ULL 459 #define SPA_VERSION_15 15ULL 460 #define SPA_VERSION_16 16ULL 461 #define SPA_VERSION_17 17ULL 462 #define SPA_VERSION_18 18ULL 463 #define SPA_VERSION_19 19ULL 464 #define SPA_VERSION_20 20ULL 465 #define SPA_VERSION_21 21ULL 466 #define SPA_VERSION_22 22ULL 467 #define SPA_VERSION_23 23ULL 468 #define SPA_VERSION_24 24ULL 469 #define SPA_VERSION_25 25ULL 470 #define SPA_VERSION_26 26ULL 471 #define SPA_VERSION_27 27ULL 472 #define SPA_VERSION_28 28ULL 473 #define SPA_VERSION_5000 5000ULL 474 475 /* 476 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk 477 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*}, 478 * and do the appropriate changes. Also bump the version number in 479 * usr/src/grub/capability. 480 */ 481 #define SPA_VERSION SPA_VERSION_5000 482 #define SPA_VERSION_STRING "5000" 483 484 /* 485 * Symbolic names for the changes that caused a SPA_VERSION switch. 486 * Used in the code when checking for presence or absence of a feature. 487 * Feel free to define multiple symbolic names for each version if there 488 * were multiple changes to on-disk structures during that version. 489 * 490 * NOTE: When checking the current SPA_VERSION in your code, be sure 491 * to use spa_version() since it reports the version of the 492 * last synced uberblock. Checking the in-flight version can 493 * be dangerous in some cases. 494 */ 495 #define SPA_VERSION_INITIAL SPA_VERSION_1 496 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2 497 #define SPA_VERSION_SPARES SPA_VERSION_3 498 #define SPA_VERSION_RAIDZ2 SPA_VERSION_3 499 #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3 500 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3 501 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3 502 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 503 #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 504 #define SPA_VERSION_BOOTFS SPA_VERSION_6 505 #define SPA_VERSION_SLOGS SPA_VERSION_7 506 #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8 507 #define SPA_VERSION_FUID SPA_VERSION_9 508 #define SPA_VERSION_REFRESERVATION SPA_VERSION_9 509 #define SPA_VERSION_REFQUOTA SPA_VERSION_9 510 #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9 511 #define SPA_VERSION_L2CACHE SPA_VERSION_10 512 #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11 513 #define SPA_VERSION_ORIGIN SPA_VERSION_11 514 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 515 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 516 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 517 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14 518 #define SPA_VERSION_USERSPACE SPA_VERSION_15 519 #define SPA_VERSION_STMF_PROP SPA_VERSION_16 520 #define SPA_VERSION_RAIDZ3 SPA_VERSION_17 521 #define SPA_VERSION_USERREFS SPA_VERSION_18 522 #define SPA_VERSION_HOLES SPA_VERSION_19 523 #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20 524 #define SPA_VERSION_DEDUP SPA_VERSION_21 525 #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22 526 #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23 527 #define SPA_VERSION_SA SPA_VERSION_24 528 #define SPA_VERSION_SCAN SPA_VERSION_25 529 #define SPA_VERSION_DIR_CLONES SPA_VERSION_26 530 #define SPA_VERSION_DEADLISTS SPA_VERSION_26 531 #define SPA_VERSION_FAST_SNAP SPA_VERSION_27 532 #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28 533 #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28 534 #define SPA_VERSION_FEATURES SPA_VERSION_5000 535 536 #define SPA_VERSION_IS_SUPPORTED(v) \ 537 (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \ 538 ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION)) 539 540 /* 541 * ZPL version - rev'd whenever an incompatible on-disk format change 542 * occurs. This is independent of SPA/DMU/ZAP versioning. You must 543 * also update the version_table[] and help message in zfs_prop.c. 544 * 545 * When changing, be sure to teach GRUB how to read the new format! 546 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*} 547 */ 548 #define ZPL_VERSION_1 1ULL 549 #define ZPL_VERSION_2 2ULL 550 #define ZPL_VERSION_3 3ULL 551 #define ZPL_VERSION_4 4ULL 552 #define ZPL_VERSION_5 5ULL 553 #define ZPL_VERSION ZPL_VERSION_5 554 #define ZPL_VERSION_STRING "5" 555 556 #define ZPL_VERSION_INITIAL ZPL_VERSION_1 557 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2 558 #define ZPL_VERSION_FUID ZPL_VERSION_3 559 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3 560 #define ZPL_VERSION_SYSATTR ZPL_VERSION_3 561 #define ZPL_VERSION_USERSPACE ZPL_VERSION_4 562 #define ZPL_VERSION_SA ZPL_VERSION_5 563 564 /* Rewind policy information */ 565 #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */ 566 #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */ 567 #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */ 568 #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */ 569 #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */ 570 #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */ 571 #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */ 572 573 typedef struct zpool_load_policy { 574 uint32_t zlp_rewind; /* rewind policy requested */ 575 uint64_t zlp_maxmeta; /* max acceptable meta-data errors */ 576 uint64_t zlp_maxdata; /* max acceptable data errors */ 577 uint64_t zlp_txg; /* specific txg to load */ 578 } zpool_load_policy_t; 579 580 /* 581 * The following are configuration names used in the nvlist describing a pool's 582 * configuration. New on-disk names should be prefixed with "<reverse-DNS>:" 583 * (e.g. "org.open-zfs:") to avoid conflicting names being developed 584 * independently. 585 */ 586 #define ZPOOL_CONFIG_VERSION "version" 587 #define ZPOOL_CONFIG_POOL_NAME "name" 588 #define ZPOOL_CONFIG_POOL_STATE "state" 589 #define ZPOOL_CONFIG_POOL_TXG "txg" 590 #define ZPOOL_CONFIG_POOL_GUID "pool_guid" 591 #define ZPOOL_CONFIG_CREATE_TXG "create_txg" 592 #define ZPOOL_CONFIG_TOP_GUID "top_guid" 593 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" 594 #define ZPOOL_CONFIG_TYPE "type" 595 #define ZPOOL_CONFIG_CHILDREN "children" 596 #define ZPOOL_CONFIG_ID "id" 597 #define ZPOOL_CONFIG_GUID "guid" 598 #define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object" 599 #define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births" 600 #define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev" 601 #define ZPOOL_CONFIG_PATH "path" 602 #define ZPOOL_CONFIG_DEVID "devid" 603 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" 604 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" 605 #define ZPOOL_CONFIG_ASHIFT "ashift" 606 #define ZPOOL_CONFIG_ASIZE "asize" 607 #define ZPOOL_CONFIG_DTL "DTL" 608 #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */ 609 #define ZPOOL_CONFIG_REMOVAL_STATS "removal_stats" /* not stored on disk */ 610 #define ZPOOL_CONFIG_CHECKPOINT_STATS "checkpoint_stats" /* not on disk */ 611 #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */ 612 #define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */ 613 614 /* container nvlist of extended stats */ 615 #define ZPOOL_CONFIG_VDEV_STATS_EX "vdev_stats_ex" 616 617 /* Active queue read/write stats */ 618 #define ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE "vdev_sync_r_active_queue" 619 #define ZPOOL_CONFIG_VDEV_SYNC_W_ACTIVE_QUEUE "vdev_sync_w_active_queue" 620 #define ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE "vdev_async_r_active_queue" 621 #define ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE "vdev_async_w_active_queue" 622 #define ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE "vdev_async_scrub_active_queue" 623 #define ZPOOL_CONFIG_VDEV_TRIM_ACTIVE_QUEUE "vdev_async_trim_active_queue" 624 625 /* Queue sizes */ 626 #define ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE "vdev_sync_r_pend_queue" 627 #define ZPOOL_CONFIG_VDEV_SYNC_W_PEND_QUEUE "vdev_sync_w_pend_queue" 628 #define ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE "vdev_async_r_pend_queue" 629 #define ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE "vdev_async_w_pend_queue" 630 #define ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE "vdev_async_scrub_pend_queue" 631 #define ZPOOL_CONFIG_VDEV_TRIM_PEND_QUEUE "vdev_async_trim_pend_queue" 632 633 /* Latency read/write histogram stats */ 634 #define ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO "vdev_tot_r_lat_histo" 635 #define ZPOOL_CONFIG_VDEV_TOT_W_LAT_HISTO "vdev_tot_w_lat_histo" 636 #define ZPOOL_CONFIG_VDEV_DISK_R_LAT_HISTO "vdev_disk_r_lat_histo" 637 #define ZPOOL_CONFIG_VDEV_DISK_W_LAT_HISTO "vdev_disk_w_lat_histo" 638 #define ZPOOL_CONFIG_VDEV_SYNC_R_LAT_HISTO "vdev_sync_r_lat_histo" 639 #define ZPOOL_CONFIG_VDEV_SYNC_W_LAT_HISTO "vdev_sync_w_lat_histo" 640 #define ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO "vdev_async_r_lat_histo" 641 #define ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO "vdev_async_w_lat_histo" 642 #define ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO "vdev_scrub_histo" 643 #define ZPOOL_CONFIG_VDEV_TRIM_LAT_HISTO "vdev_trim_histo" 644 645 /* Request size histograms */ 646 #define ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO "vdev_sync_ind_r_histo" 647 #define ZPOOL_CONFIG_VDEV_SYNC_IND_W_HISTO "vdev_sync_ind_w_histo" 648 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO "vdev_async_ind_r_histo" 649 #define ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO "vdev_async_ind_w_histo" 650 #define ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO "vdev_ind_scrub_histo" 651 #define ZPOOL_CONFIG_VDEV_IND_TRIM_HISTO "vdev_ind_trim_histo" 652 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO "vdev_sync_agg_r_histo" 653 #define ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO "vdev_sync_agg_w_histo" 654 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO "vdev_async_agg_r_histo" 655 #define ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO "vdev_async_agg_w_histo" 656 #define ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO "vdev_agg_scrub_histo" 657 #define ZPOOL_CONFIG_VDEV_AGG_TRIM_HISTO "vdev_agg_trim_histo" 658 659 /* Number of slow IOs */ 660 #define ZPOOL_CONFIG_VDEV_SLOW_IOS "vdev_slow_ios" 661 662 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" 663 #define ZPOOL_CONFIG_ERRCOUNT "error_count" 664 #define ZPOOL_CONFIG_NOT_PRESENT "not_present" 665 #define ZPOOL_CONFIG_SPARES "spares" 666 #define ZPOOL_CONFIG_IS_SPARE "is_spare" 667 #define ZPOOL_CONFIG_NPARITY "nparity" 668 #define ZPOOL_CONFIG_HOSTID "hostid" 669 #define ZPOOL_CONFIG_HOSTNAME "hostname" 670 #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time" 671 #define ZPOOL_CONFIG_UNSPARE "unspare" 672 #define ZPOOL_CONFIG_PHYS_PATH "phys_path" 673 #define ZPOOL_CONFIG_IS_LOG "is_log" 674 #define ZPOOL_CONFIG_L2CACHE "l2cache" 675 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array" 676 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children" 677 #define ZPOOL_CONFIG_IS_HOLE "is_hole" 678 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram" 679 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats" 680 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats" 681 #define ZPOOL_CONFIG_SPLIT "splitcfg" 682 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid" 683 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid" 684 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list" 685 #define ZPOOL_CONFIG_REMOVING "removing" 686 #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg" 687 #define ZPOOL_CONFIG_COMMENT "comment" 688 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */ 689 #define ZPOOL_CONFIG_SUSPENDED_REASON "suspended_reason" /* not stored */ 690 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ 691 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */ 692 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */ 693 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */ 694 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */ 695 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */ 696 #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */ 697 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */ 698 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read" 699 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */ 700 #define ZPOOL_CONFIG_ERRATA "errata" /* not stored on disk */ 701 #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top" 702 #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf" 703 #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps" 704 #define ZPOOL_CONFIG_RESILVER_DEFER "com.datto:resilver_defer" 705 #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */ 706 #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */ 707 #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */ 708 #define ZPOOL_CONFIG_MMP_SEQ "mmp_seq" /* not stored on disk */ 709 #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */ 710 #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */ 711 #define ZPOOL_CONFIG_ALLOCATION_BIAS "alloc_bias" /* not stored on disk */ 712 713 /* 714 * The persistent vdev state is stored as separate values rather than a single 715 * 'vdev_state' entry. This is because a device can be in multiple states, such 716 * as offline and degraded. 717 */ 718 #define ZPOOL_CONFIG_OFFLINE "offline" 719 #define ZPOOL_CONFIG_FAULTED "faulted" 720 #define ZPOOL_CONFIG_DEGRADED "degraded" 721 #define ZPOOL_CONFIG_REMOVED "removed" 722 #define ZPOOL_CONFIG_FRU "fru" 723 #define ZPOOL_CONFIG_AUX_STATE "aux_state" 724 725 /* Pool load policy parameters */ 726 #define ZPOOL_LOAD_POLICY "load-policy" 727 #define ZPOOL_LOAD_REWIND_POLICY "load-rewind-policy" 728 #define ZPOOL_LOAD_REQUEST_TXG "load-request-txg" 729 #define ZPOOL_LOAD_META_THRESH "load-meta-thresh" 730 #define ZPOOL_LOAD_DATA_THRESH "load-data-thresh" 731 732 /* Rewind data discovered */ 733 #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts" 734 #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors" 735 #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind" 736 737 #define VDEV_TYPE_ROOT "root" 738 #define VDEV_TYPE_MIRROR "mirror" 739 #define VDEV_TYPE_REPLACING "replacing" 740 #define VDEV_TYPE_RAIDZ "raidz" 741 #define VDEV_TYPE_DISK "disk" 742 #define VDEV_TYPE_FILE "file" 743 #define VDEV_TYPE_MISSING "missing" 744 #define VDEV_TYPE_HOLE "hole" 745 #define VDEV_TYPE_SPARE "spare" 746 #define VDEV_TYPE_LOG "log" 747 #define VDEV_TYPE_L2CACHE "l2cache" 748 #define VDEV_TYPE_INDIRECT "indirect" 749 750 /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */ 751 #define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \ 752 "com.delphix:indirect_obsolete_sm" 753 #define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \ 754 "com.delphix:obsolete_counts_are_precise" 755 #define VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \ 756 "com.delphix:pool_checkpoint_sm" 757 #define VDEV_TOP_ZAP_MS_UNFLUSHED_PHYS_TXGS \ 758 "com.delphix:ms_unflushed_phys_txgs" 759 760 #define VDEV_TOP_ZAP_ALLOCATION_BIAS \ 761 "org.zfsonlinux:allocation_bias" 762 763 /* vdev metaslab allocation bias */ 764 #define VDEV_ALLOC_BIAS_LOG "log" 765 #define VDEV_ALLOC_BIAS_SPECIAL "special" 766 #define VDEV_ALLOC_BIAS_DEDUP "dedup" 767 768 /* vdev initialize state */ 769 #define VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET \ 770 "com.delphix:next_offset_to_initialize" 771 #define VDEV_LEAF_ZAP_INITIALIZE_STATE \ 772 "com.delphix:vdev_initialize_state" 773 #define VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME \ 774 "com.delphix:vdev_initialize_action_time" 775 776 /* vdev TRIM state */ 777 #define VDEV_LEAF_ZAP_TRIM_LAST_OFFSET \ 778 "org.zfsonlinux:next_offset_to_trim" 779 #define VDEV_LEAF_ZAP_TRIM_STATE \ 780 "org.zfsonlinux:vdev_trim_state" 781 #define VDEV_LEAF_ZAP_TRIM_ACTION_TIME \ 782 "org.zfsonlinux:vdev_trim_action_time" 783 #define VDEV_LEAF_ZAP_TRIM_RATE \ 784 "org.zfsonlinux:vdev_trim_rate" 785 #define VDEV_LEAF_ZAP_TRIM_PARTIAL \ 786 "org.zfsonlinux:vdev_trim_partial" 787 #define VDEV_LEAF_ZAP_TRIM_SECURE \ 788 "org.zfsonlinux:vdev_trim_secure" 789 790 /* 791 * This is needed in userland to report the minimum necessary device size. 792 * 793 * Note that the zfs test suite uses 64MB vdevs. 794 */ 795 #define SPA_MINDEVSIZE (64ULL << 20) 796 797 /* 798 * Set if the fragmentation has not yet been calculated. This can happen 799 * because the space maps have not been upgraded or the histogram feature 800 * is not enabled. 801 */ 802 #define ZFS_FRAG_INVALID UINT64_MAX 803 804 /* 805 * The location of the pool configuration repository, shared between kernel and 806 * userland. 807 */ 808 #define ZPOOL_CACHE "/etc/zfs/zpool.cache" 809 810 /* 811 * vdev states are ordered from least to most healthy. 812 * A vdev that's CANT_OPEN or below is considered unusable. 813 */ 814 typedef enum vdev_state { 815 VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ 816 VDEV_STATE_CLOSED, /* Not currently open */ 817 VDEV_STATE_OFFLINE, /* Not allowed to open */ 818 VDEV_STATE_REMOVED, /* Explicitly removed from system */ 819 VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ 820 VDEV_STATE_FAULTED, /* External request to fault device */ 821 VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ 822 VDEV_STATE_HEALTHY /* Presumed good */ 823 } vdev_state_t; 824 825 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY 826 827 /* 828 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field 829 * of the vdev stats structure uses these constants to distinguish why. 830 */ 831 typedef enum vdev_aux { 832 VDEV_AUX_NONE, /* no error */ 833 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ 834 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ 835 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ 836 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ 837 VDEV_AUX_TOO_SMALL, /* vdev size is too small */ 838 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ 839 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ 840 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ 841 VDEV_AUX_UNSUP_FEAT, /* unsupported features */ 842 VDEV_AUX_SPARED, /* hot spare used in another pool */ 843 VDEV_AUX_ERR_EXCEEDED, /* too many errors */ 844 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */ 845 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */ 846 VDEV_AUX_EXTERNAL, /* external diagnosis */ 847 VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */ 848 VDEV_AUX_ACTIVE, /* vdev active on a different host */ 849 VDEV_AUX_CHILDREN_OFFLINE, /* all children are offline */ 850 VDEV_AUX_BAD_ASHIFT /* vdev ashift is invalid */ 851 } vdev_aux_t; 852 853 /* 854 * pool state. The following states are written to disk as part of the normal 855 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining 856 * states are software abstractions used at various levels to communicate 857 * pool state. 858 */ 859 typedef enum pool_state { 860 POOL_STATE_ACTIVE = 0, /* In active use */ 861 POOL_STATE_EXPORTED, /* Explicitly exported */ 862 POOL_STATE_DESTROYED, /* Explicitly destroyed */ 863 POOL_STATE_SPARE, /* Reserved for hot spare use */ 864 POOL_STATE_L2CACHE, /* Level 2 ARC device */ 865 POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ 866 POOL_STATE_UNAVAIL, /* Internal libzfs state */ 867 POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ 868 } pool_state_t; 869 870 /* 871 * mmp state. The following states provide additional detail describing 872 * why a pool couldn't be safely imported. 873 */ 874 typedef enum mmp_state { 875 MMP_STATE_ACTIVE = 0, /* In active use */ 876 MMP_STATE_INACTIVE, /* Inactive and safe to import */ 877 MMP_STATE_NO_HOSTID /* System hostid is not set */ 878 } mmp_state_t; 879 880 /* 881 * Scan Functions. 882 */ 883 typedef enum pool_scan_func { 884 POOL_SCAN_NONE, 885 POOL_SCAN_SCRUB, 886 POOL_SCAN_RESILVER, 887 POOL_SCAN_FUNCS 888 } pool_scan_func_t; 889 890 /* 891 * Used to control scrub pause and resume. 892 */ 893 typedef enum pool_scrub_cmd { 894 POOL_SCRUB_NORMAL = 0, 895 POOL_SCRUB_PAUSE, 896 POOL_SCRUB_FLAGS_END 897 } pool_scrub_cmd_t; 898 899 /* 900 * Initialize functions. 901 */ 902 typedef enum pool_initialize_func { 903 POOL_INITIALIZE_START, 904 POOL_INITIALIZE_CANCEL, 905 POOL_INITIALIZE_SUSPEND, 906 POOL_INITIALIZE_FUNCS 907 } pool_initialize_func_t; 908 909 /* 910 * TRIM functions. 911 */ 912 typedef enum pool_trim_func { 913 POOL_TRIM_START, 914 POOL_TRIM_CANCEL, 915 POOL_TRIM_SUSPEND, 916 POOL_TRIM_FUNCS 917 } pool_trim_func_t; 918 919 /* 920 * ZIO types. Needed to interpret vdev statistics below. 921 */ 922 typedef enum zio_type { 923 ZIO_TYPE_NULL = 0, 924 ZIO_TYPE_READ, 925 ZIO_TYPE_WRITE, 926 ZIO_TYPE_FREE, 927 ZIO_TYPE_CLAIM, 928 ZIO_TYPE_IOCTL, 929 ZIO_TYPE_TRIM, 930 ZIO_TYPES 931 } zio_type_t; 932 933 /* 934 * Pool statistics. Note: all fields should be 64-bit because this 935 * is passed between kernel and userland as an nvlist uint64 array. 936 */ 937 typedef struct pool_scan_stat { 938 /* values stored on disk */ 939 uint64_t pss_func; /* pool_scan_func_t */ 940 uint64_t pss_state; /* dsl_scan_state_t */ 941 uint64_t pss_start_time; /* scan start time */ 942 uint64_t pss_end_time; /* scan end time */ 943 uint64_t pss_to_examine; /* total bytes to scan */ 944 uint64_t pss_examined; /* total bytes located by scanner */ 945 uint64_t pss_to_process; /* total bytes to process */ 946 uint64_t pss_processed; /* total processed bytes */ 947 uint64_t pss_errors; /* scan errors */ 948 949 /* values not stored on disk */ 950 uint64_t pss_pass_exam; /* examined bytes per scan pass */ 951 uint64_t pss_pass_issued; /* issued bytes per scan pass */ 952 uint64_t pss_pass_start; /* start time of a scan pass */ 953 uint64_t pss_pass_scrub_pause; /* pause time of a scurb pass */ 954 /* cumulative time scrub spent paused, needed for rate calculation */ 955 uint64_t pss_pass_scrub_spent_paused; 956 957 /* Sorted scrubbing new fields */ 958 /* Stored on disk */ 959 uint64_t pss_issued; /* total bytes checked by scanner */ 960 } pool_scan_stat_t; 961 962 /* 963 * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER. The ordering 964 * of this enum must be maintained to ensure the errata identifiers map to 965 * the correct documentation. New errata may only be appended to the list 966 * and must contain corresponding documentation at the above link. 967 */ 968 typedef enum zpool_errata { 969 ZPOOL_ERRATA_NONE, 970 ZPOOL_ERRATA_ZOL_2094_SCRUB, 971 ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY, 972 ZPOOL_ERRATA_ZOL_6845_ENCRYPTION, 973 ZPOOL_ERRATA_ZOL_8308_ENCRYPTION, 974 } zpool_errata_t; 975 976 typedef struct pool_removal_stat { 977 uint64_t prs_state; /* dsl_scan_state_t */ 978 uint64_t prs_removing_vdev; 979 uint64_t prs_start_time; 980 uint64_t prs_end_time; 981 uint64_t prs_to_copy; /* bytes that need to be copied */ 982 uint64_t prs_copied; /* bytes copied so far */ 983 /* 984 * bytes of memory used for indirect mappings. 985 * This includes all removed vdevs. 986 */ 987 uint64_t prs_mapping_memory; 988 } pool_removal_stat_t; 989 990 typedef enum dsl_scan_state { 991 DSS_NONE, 992 DSS_SCANNING, 993 DSS_FINISHED, 994 DSS_CANCELED, 995 DSS_NUM_STATES 996 } dsl_scan_state_t; 997 998 typedef enum { 999 CS_NONE, 1000 CS_CHECKPOINT_EXISTS, 1001 CS_CHECKPOINT_DISCARDING, 1002 CS_NUM_STATES 1003 } checkpoint_state_t; 1004 1005 typedef struct pool_checkpoint_stat { 1006 uint64_t pcs_state; /* checkpoint_state_t */ 1007 uint64_t pcs_start_time; /* time checkpoint/discard started */ 1008 uint64_t pcs_space; /* checkpointed space */ 1009 } pool_checkpoint_stat_t; 1010 1011 typedef enum { 1012 VDEV_INITIALIZE_NONE, 1013 VDEV_INITIALIZE_ACTIVE, 1014 VDEV_INITIALIZE_CANCELED, 1015 VDEV_INITIALIZE_SUSPENDED, 1016 VDEV_INITIALIZE_COMPLETE 1017 } vdev_initializing_state_t; 1018 1019 typedef enum { 1020 VDEV_TRIM_NONE, 1021 VDEV_TRIM_ACTIVE, 1022 VDEV_TRIM_CANCELED, 1023 VDEV_TRIM_SUSPENDED, 1024 VDEV_TRIM_COMPLETE, 1025 } vdev_trim_state_t; 1026 1027 /* 1028 * Vdev statistics. Note: all fields should be 64-bit because this 1029 * is passed between kernel and user land as an nvlist uint64 array. 1030 * 1031 * The vs_ops[] and vs_bytes[] arrays must always be an array size of 6 in 1032 * order to keep subsequent members at their known fixed offsets. When 1033 * adding a new field it must be added to the end the structure. 1034 */ 1035 #define VS_ZIO_TYPES 6 1036 1037 typedef struct vdev_stat { 1038 hrtime_t vs_timestamp; /* time since vdev load */ 1039 uint64_t vs_state; /* vdev state */ 1040 uint64_t vs_aux; /* see vdev_aux_t */ 1041 uint64_t vs_alloc; /* space allocated */ 1042 uint64_t vs_space; /* total capacity */ 1043 uint64_t vs_dspace; /* deflated capacity */ 1044 uint64_t vs_rsize; /* replaceable dev size */ 1045 uint64_t vs_esize; /* expandable dev size */ 1046 uint64_t vs_ops[VS_ZIO_TYPES]; /* operation count */ 1047 uint64_t vs_bytes[VS_ZIO_TYPES]; /* bytes read/written */ 1048 uint64_t vs_read_errors; /* read errors */ 1049 uint64_t vs_write_errors; /* write errors */ 1050 uint64_t vs_checksum_errors; /* checksum errors */ 1051 uint64_t vs_initialize_errors; /* initializing errors */ 1052 uint64_t vs_self_healed; /* self-healed bytes */ 1053 uint64_t vs_scan_removing; /* removing? */ 1054 uint64_t vs_scan_processed; /* scan processed bytes */ 1055 uint64_t vs_fragmentation; /* device fragmentation */ 1056 uint64_t vs_initialize_bytes_done; /* bytes initialized */ 1057 uint64_t vs_initialize_bytes_est; /* total bytes to initialize */ 1058 uint64_t vs_initialize_state; /* vdev_initialzing_state_t */ 1059 uint64_t vs_initialize_action_time; /* time_t */ 1060 uint64_t vs_checkpoint_space; /* checkpoint-consumed space */ 1061 uint64_t vs_resilver_deferred; /* resilver deferred */ 1062 uint64_t vs_slow_ios; /* slow IOs */ 1063 uint64_t vs_trim_errors; /* trimming errors */ 1064 uint64_t vs_trim_notsup; /* supported by device */ 1065 uint64_t vs_trim_bytes_done; /* bytes trimmed */ 1066 uint64_t vs_trim_bytes_est; /* total bytes to trim */ 1067 uint64_t vs_trim_state; /* vdev_trim_state_t */ 1068 uint64_t vs_trim_action_time; /* time_t */ 1069 } vdev_stat_t; 1070 1071 /* 1072 * Extended stats 1073 * 1074 * These are stats which aren't included in the original iostat output. For 1075 * convenience, they are grouped together in vdev_stat_ex, although each stat 1076 * is individually exported as a nvlist. 1077 */ 1078 typedef struct vdev_stat_ex { 1079 /* Number of ZIOs issued to disk and waiting to finish */ 1080 uint64_t vsx_active_queue[ZIO_PRIORITY_N_QUEUEABLE]; 1081 1082 /* Number of ZIOs pending to be issued to disk */ 1083 uint64_t vsx_pend_queue[ZIO_PRIORITY_N_QUEUEABLE]; 1084 1085 /* 1086 * Below are the histograms for various latencies. Buckets are in 1087 * units of nanoseconds. 1088 */ 1089 1090 /* 1091 * 2^37 nanoseconds = 134s. Timeouts will probably start kicking in 1092 * before this. 1093 */ 1094 #define VDEV_L_HISTO_BUCKETS 37 /* Latency histo buckets */ 1095 #define VDEV_RQ_HISTO_BUCKETS 25 /* Request size histo buckets */ 1096 1097 /* Amount of time in ZIO queue (ns) */ 1098 uint64_t vsx_queue_histo[ZIO_PRIORITY_N_QUEUEABLE] 1099 [VDEV_L_HISTO_BUCKETS]; 1100 1101 /* Total ZIO latency (ns). Includes queuing and disk access time */ 1102 uint64_t vsx_total_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS]; 1103 1104 /* Amount of time to read/write the disk (ns) */ 1105 uint64_t vsx_disk_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS]; 1106 1107 /* "lookup the bucket for a value" macro */ 1108 #define HISTO(val, buckets) (val != 0 ? MIN(highbit64(val) - 1, \ 1109 buckets - 1) : 0) 1110 #define L_HISTO(a) HISTO(a, VDEV_L_HISTO_BUCKETS) 1111 #define RQ_HISTO(a) HISTO(a, VDEV_RQ_HISTO_BUCKETS) 1112 1113 /* Physical IO histogram */ 1114 uint64_t vsx_ind_histo[ZIO_PRIORITY_N_QUEUEABLE] 1115 [VDEV_RQ_HISTO_BUCKETS]; 1116 1117 /* Delegated (aggregated) physical IO histogram */ 1118 uint64_t vsx_agg_histo[ZIO_PRIORITY_N_QUEUEABLE] 1119 [VDEV_RQ_HISTO_BUCKETS]; 1120 1121 } vdev_stat_ex_t; 1122 1123 /* 1124 * DDT statistics. Note: all fields should be 64-bit because this 1125 * is passed between kernel and userland as an nvlist uint64 array. 1126 */ 1127 typedef struct ddt_object { 1128 uint64_t ddo_count; /* number of elments in ddt */ 1129 uint64_t ddo_dspace; /* size of ddt on disk */ 1130 uint64_t ddo_mspace; /* size of ddt in-core */ 1131 } ddt_object_t; 1132 1133 typedef struct ddt_stat { 1134 uint64_t dds_blocks; /* blocks */ 1135 uint64_t dds_lsize; /* logical size */ 1136 uint64_t dds_psize; /* physical size */ 1137 uint64_t dds_dsize; /* deflated allocated size */ 1138 uint64_t dds_ref_blocks; /* referenced blocks */ 1139 uint64_t dds_ref_lsize; /* referenced lsize * refcnt */ 1140 uint64_t dds_ref_psize; /* referenced psize * refcnt */ 1141 uint64_t dds_ref_dsize; /* referenced dsize * refcnt */ 1142 } ddt_stat_t; 1143 1144 typedef struct ddt_histogram { 1145 ddt_stat_t ddh_stat[64]; /* power-of-two histogram buckets */ 1146 } ddt_histogram_t; 1147 1148 #define ZVOL_DRIVER "zvol" 1149 #define ZFS_DRIVER "zfs" 1150 #define ZFS_DEV "/dev/zfs" 1151 #define ZFS_DISK_ROOT "/dev/dsk" 1152 #define ZFS_DISK_ROOTD ZFS_DISK_ROOT "/" 1153 #define ZFS_RDISK_ROOT "/dev/rdsk" 1154 #define ZFS_RDISK_ROOTD ZFS_RDISK_ROOT "/" 1155 1156 /* general zvol path */ 1157 #define ZVOL_DIR "/dev/zvol" 1158 /* expansion */ 1159 #define ZVOL_PSEUDO_DEV "/devices/pseudo/zfs@0:" 1160 /* for dump and swap */ 1161 #define ZVOL_FULL_DEV_DIR ZVOL_DIR "/dsk/" 1162 #define ZVOL_FULL_RDEV_DIR ZVOL_DIR "/rdsk/" 1163 1164 #define ZVOL_PROP_NAME "name" 1165 #define ZVOL_DEFAULT_BLOCKSIZE 8192 1166 1167 /* 1168 * /dev/zfs ioctl numbers. 1169 */ 1170 typedef enum zfs_ioc { 1171 ZFS_IOC_FIRST = ('Z' << 8), 1172 ZFS_IOC = ZFS_IOC_FIRST, 1173 ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, 1174 ZFS_IOC_POOL_DESTROY, 1175 ZFS_IOC_POOL_IMPORT, 1176 ZFS_IOC_POOL_EXPORT, 1177 ZFS_IOC_POOL_CONFIGS, 1178 ZFS_IOC_POOL_STATS, 1179 ZFS_IOC_POOL_TRYIMPORT, 1180 ZFS_IOC_POOL_SCAN, 1181 ZFS_IOC_POOL_FREEZE, 1182 ZFS_IOC_POOL_UPGRADE, 1183 ZFS_IOC_POOL_GET_HISTORY, 1184 ZFS_IOC_VDEV_ADD, 1185 ZFS_IOC_VDEV_REMOVE, 1186 ZFS_IOC_VDEV_SET_STATE, 1187 ZFS_IOC_VDEV_ATTACH, 1188 ZFS_IOC_VDEV_DETACH, 1189 ZFS_IOC_VDEV_SETPATH, 1190 ZFS_IOC_VDEV_SETFRU, 1191 ZFS_IOC_OBJSET_STATS, 1192 ZFS_IOC_OBJSET_ZPLPROPS, 1193 ZFS_IOC_DATASET_LIST_NEXT, 1194 ZFS_IOC_SNAPSHOT_LIST_NEXT, 1195 ZFS_IOC_SET_PROP, 1196 ZFS_IOC_CREATE, 1197 ZFS_IOC_DESTROY, 1198 ZFS_IOC_ROLLBACK, 1199 ZFS_IOC_RENAME, 1200 ZFS_IOC_RECV, 1201 ZFS_IOC_SEND, 1202 ZFS_IOC_INJECT_FAULT, 1203 ZFS_IOC_CLEAR_FAULT, 1204 ZFS_IOC_INJECT_LIST_NEXT, 1205 ZFS_IOC_ERROR_LOG, 1206 ZFS_IOC_CLEAR, 1207 ZFS_IOC_PROMOTE, 1208 ZFS_IOC_SNAPSHOT, 1209 ZFS_IOC_DSOBJ_TO_DSNAME, 1210 ZFS_IOC_OBJ_TO_PATH, 1211 ZFS_IOC_POOL_SET_PROPS, 1212 ZFS_IOC_POOL_GET_PROPS, 1213 ZFS_IOC_SET_FSACL, 1214 ZFS_IOC_GET_FSACL, 1215 ZFS_IOC_SHARE, 1216 ZFS_IOC_INHERIT_PROP, 1217 ZFS_IOC_SMB_ACL, 1218 ZFS_IOC_USERSPACE_ONE, 1219 ZFS_IOC_USERSPACE_MANY, 1220 ZFS_IOC_USERSPACE_UPGRADE, 1221 ZFS_IOC_HOLD, 1222 ZFS_IOC_RELEASE, 1223 ZFS_IOC_GET_HOLDS, 1224 ZFS_IOC_OBJSET_RECVD_PROPS, 1225 ZFS_IOC_VDEV_SPLIT, 1226 ZFS_IOC_NEXT_OBJ, 1227 ZFS_IOC_DIFF, 1228 ZFS_IOC_TMP_SNAPSHOT, 1229 ZFS_IOC_OBJ_TO_STATS, 1230 ZFS_IOC_SPACE_WRITTEN, 1231 ZFS_IOC_SPACE_SNAPS, 1232 ZFS_IOC_DESTROY_SNAPS, 1233 ZFS_IOC_POOL_REGUID, 1234 ZFS_IOC_POOL_REOPEN, 1235 ZFS_IOC_SEND_PROGRESS, 1236 ZFS_IOC_LOG_HISTORY, 1237 ZFS_IOC_SEND_NEW, 1238 ZFS_IOC_SEND_SPACE, 1239 ZFS_IOC_CLONE, 1240 ZFS_IOC_BOOKMARK, 1241 ZFS_IOC_GET_BOOKMARKS, 1242 ZFS_IOC_DESTROY_BOOKMARKS, 1243 ZFS_IOC_CHANNEL_PROGRAM, 1244 ZFS_IOC_REMAP, 1245 ZFS_IOC_POOL_CHECKPOINT, 1246 ZFS_IOC_POOL_DISCARD_CHECKPOINT, 1247 ZFS_IOC_POOL_INITIALIZE, 1248 ZFS_IOC_POOL_SYNC, 1249 ZFS_IOC_LOAD_KEY, 1250 ZFS_IOC_UNLOAD_KEY, 1251 ZFS_IOC_CHANGE_KEY, 1252 ZFS_IOC_POOL_TRIM, 1253 ZFS_IOC_LAST 1254 } zfs_ioc_t; 1255 1256 /* 1257 * ZFS-specific error codes used for returning descriptive errors 1258 * to the userland through zfs ioctls. 1259 * 1260 * The enum implicitly includes all the error codes from errno.h. 1261 * New code should use and extend this enum for errors that are 1262 * not described precisely by generic errno codes. 1263 */ 1264 typedef enum { 1265 ZFS_ERR_CHECKPOINT_EXISTS = 1024, 1266 ZFS_ERR_DISCARDING_CHECKPOINT, 1267 ZFS_ERR_NO_CHECKPOINT, 1268 ZFS_ERR_DEVRM_IN_PROGRESS, 1269 ZFS_ERR_VDEV_TOO_BIG, 1270 ZFS_ERR_FROM_IVSET_GUID_MISSING, 1271 ZFS_ERR_FROM_IVSET_GUID_MISMATCH, 1272 ZFS_ERR_SPILL_BLOCK_FLAG_MISSING, 1273 } zfs_errno_t; 1274 1275 /* 1276 * Internal SPA load state. Used by FMA diagnosis engine. 1277 */ 1278 typedef enum { 1279 SPA_LOAD_NONE, /* no load in progress */ 1280 SPA_LOAD_OPEN, /* normal open */ 1281 SPA_LOAD_IMPORT, /* import in progress */ 1282 SPA_LOAD_TRYIMPORT, /* tryimport in progress */ 1283 SPA_LOAD_RECOVER, /* recovery requested */ 1284 SPA_LOAD_ERROR, /* load failed */ 1285 SPA_LOAD_CREATE /* creation in progress */ 1286 } spa_load_state_t; 1287 1288 /* supported encryption algorithms */ 1289 enum zio_encrypt { 1290 ZIO_CRYPT_INHERIT = 0, 1291 ZIO_CRYPT_ON, 1292 ZIO_CRYPT_OFF, 1293 ZIO_CRYPT_AES_128_CCM, 1294 ZIO_CRYPT_AES_192_CCM, 1295 ZIO_CRYPT_AES_256_CCM, 1296 ZIO_CRYPT_AES_128_GCM, 1297 ZIO_CRYPT_AES_192_GCM, 1298 ZIO_CRYPT_AES_256_GCM, 1299 ZIO_CRYPT_FUNCTIONS 1300 }; 1301 1302 /* 1303 * Bookmark name values. 1304 */ 1305 #define ZPOOL_ERR_LIST "error list" 1306 #define ZPOOL_ERR_DATASET "dataset" 1307 #define ZPOOL_ERR_OBJECT "object" 1308 1309 #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) 1310 1311 /* 1312 * The following are names used in the nvlist describing 1313 * the pool's history log. 1314 */ 1315 #define ZPOOL_HIST_RECORD "history record" 1316 #define ZPOOL_HIST_TIME "history time" 1317 #define ZPOOL_HIST_CMD "history command" 1318 #define ZPOOL_HIST_WHO "history who" 1319 #define ZPOOL_HIST_ZONE "history zone" 1320 #define ZPOOL_HIST_HOST "history hostname" 1321 #define ZPOOL_HIST_TXG "history txg" 1322 #define ZPOOL_HIST_INT_EVENT "history internal event" 1323 #define ZPOOL_HIST_INT_STR "history internal str" 1324 #define ZPOOL_HIST_INT_NAME "internal_name" 1325 #define ZPOOL_HIST_IOCTL "ioctl" 1326 #define ZPOOL_HIST_INPUT_NVL "in_nvl" 1327 #define ZPOOL_HIST_OUTPUT_NVL "out_nvl" 1328 #define ZPOOL_HIST_DSNAME "dsname" 1329 #define ZPOOL_HIST_DSID "dsid" 1330 #define ZPOOL_HIST_ERRNO "errno" 1331 1332 /* 1333 * The following are names used when invoking ZFS_IOC_POOL_INITIALIZE. 1334 */ 1335 #define ZPOOL_INITIALIZE_COMMAND "initialize_command" 1336 #define ZPOOL_INITIALIZE_VDEVS "initialize_vdevs" 1337 1338 /* 1339 * Special nvlist name that will not have its args recorded in the pool's 1340 * history log. 1341 */ 1342 #define ZPOOL_HIDDEN_ARGS "hidden_args" 1343 1344 /* 1345 * The following are names used when invoking ZFS_IOC_POOL_TRIM. 1346 */ 1347 #define ZPOOL_TRIM_COMMAND "trim_command" 1348 #define ZPOOL_TRIM_VDEVS "trim_vdevs" 1349 #define ZPOOL_TRIM_RATE "trim_rate" 1350 #define ZPOOL_TRIM_SECURE "trim_secure" 1351 1352 /* 1353 * Flags for ZFS_IOC_VDEV_SET_STATE 1354 */ 1355 #define ZFS_ONLINE_CHECKREMOVE 0x1 1356 #define ZFS_ONLINE_UNSPARE 0x2 1357 #define ZFS_ONLINE_FORCEFAULT 0x4 1358 #define ZFS_ONLINE_EXPAND 0x8 1359 #define ZFS_OFFLINE_TEMPORARY 0x1 1360 1361 /* 1362 * Flags for ZFS_IOC_POOL_IMPORT 1363 */ 1364 #define ZFS_IMPORT_NORMAL 0x0 1365 #define ZFS_IMPORT_VERBATIM 0x1 1366 #define ZFS_IMPORT_ANY_HOST 0x2 1367 #define ZFS_IMPORT_MISSING_LOG 0x4 1368 #define ZFS_IMPORT_ONLY 0x8 1369 #define ZFS_IMPORT_CHECKPOINT 0x10 1370 #define ZFS_IMPORT_TEMP_NAME 0x20 1371 #define ZFS_IMPORT_SKIP_MMP 0x40 1372 #define ZFS_IMPORT_LOAD_KEYS 0x80 1373 1374 /* 1375 * Channel program argument/return nvlist keys and defaults. 1376 */ 1377 #define ZCP_ARG_PROGRAM "program" 1378 #define ZCP_ARG_ARGLIST "arg" 1379 #define ZCP_ARG_SYNC "sync" 1380 #define ZCP_ARG_INSTRLIMIT "instrlimit" 1381 #define ZCP_ARG_MEMLIMIT "memlimit" 1382 1383 #define ZCP_ARG_CLIARGV "argv" 1384 1385 #define ZCP_RET_ERROR "error" 1386 #define ZCP_RET_RETURN "return" 1387 1388 #define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000) 1389 #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) 1390 #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) 1391 #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) 1392 1393 /* 1394 * Sysevent payload members. ZFS will generate the following sysevents with the 1395 * given payloads: 1396 * 1397 * ESC_ZFS_RESILVER_START 1398 * ESC_ZFS_RESILVER_END 1399 * ESC_ZFS_POOL_DESTROY 1400 * ESC_ZFS_POOL_REGUID 1401 * 1402 * ZFS_EV_POOL_NAME DATA_TYPE_STRING 1403 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 1404 * 1405 * ESC_ZFS_VDEV_REMOVE 1406 * ESC_ZFS_VDEV_CLEAR 1407 * ESC_ZFS_VDEV_CHECK 1408 * 1409 * ZFS_EV_POOL_NAME DATA_TYPE_STRING 1410 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 1411 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) 1412 * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 1413 * 1414 * ESC_ZFS_HISTORY_EVENT 1415 * 1416 * ZFS_EV_POOL_NAME DATA_TYPE_STRING 1417 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 1418 * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional) 1419 * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional) 1420 * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional) 1421 * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional) 1422 * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional) 1423 * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional) 1424 * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional) 1425 * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional) 1426 * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional) 1427 * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional) 1428 * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional) 1429 * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional) 1430 * 1431 * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the 1432 * history log nvlist. The keynames will be free of any spaces or other 1433 * characters that could be potentially unexpected to consumers of the 1434 * sysevents. 1435 */ 1436 #define ZFS_EV_POOL_NAME "pool_name" 1437 #define ZFS_EV_POOL_GUID "pool_guid" 1438 #define ZFS_EV_VDEV_PATH "vdev_path" 1439 #define ZFS_EV_VDEV_GUID "vdev_guid" 1440 #define ZFS_EV_HIST_TIME "history_time" 1441 #define ZFS_EV_HIST_CMD "history_command" 1442 #define ZFS_EV_HIST_WHO "history_who" 1443 #define ZFS_EV_HIST_ZONE "history_zone" 1444 #define ZFS_EV_HIST_HOST "history_hostname" 1445 #define ZFS_EV_HIST_TXG "history_txg" 1446 #define ZFS_EV_HIST_INT_EVENT "history_internal_event" 1447 #define ZFS_EV_HIST_INT_STR "history_internal_str" 1448 #define ZFS_EV_HIST_INT_NAME "history_internal_name" 1449 #define ZFS_EV_HIST_IOCTL "history_ioctl" 1450 #define ZFS_EV_HIST_DSNAME "history_dsname" 1451 #define ZFS_EV_HIST_DSID "history_dsid" 1452 1453 #ifdef __cplusplus 1454 } 1455 #endif 1456 1457 #endif /* _SYS_FS_ZFS_H */ 1458