Print this page
usr/src/cmd/zpool/zpool_util.c

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/fs/zfs.h
          +++ new/usr/src/uts/common/sys/fs/zfs.h
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  25      - * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
       26 + * Copyright (c) 2013, Saso Kiselkov. All rights reserved.
  26   27   * Copyright (c) 2014 Integros [integros.com]
  27   28   * Copyright 2017 Joyent, Inc.
  28   29   * Copyright (c) 2017 Datto Inc.
  29   30   */
  30   31  
  31   32  /* Portions Copyright 2010 Robert Milkowski */
  32   33  
  33   34  #ifndef _SYS_FS_ZFS_H
  34   35  #define _SYS_FS_ZFS_H
  35   36  
↓ open down ↓ 9 lines elided ↑ open up ↑
  45   46  
  46   47  /*
  47   48   * Each dataset can be one of the following types.  These constants can be
  48   49   * combined into masks that can be passed to various functions.
  49   50   */
  50   51  typedef enum {
  51   52          ZFS_TYPE_FILESYSTEM     = (1 << 0),
  52   53          ZFS_TYPE_SNAPSHOT       = (1 << 1),
  53   54          ZFS_TYPE_VOLUME         = (1 << 2),
  54   55          ZFS_TYPE_POOL           = (1 << 3),
  55      -        ZFS_TYPE_BOOKMARK       = (1 << 4)
       56 +        ZFS_TYPE_BOOKMARK       = (1 << 4),
       57 +        ZFS_TYPE_VDEV           = (1 << 5),
       58 +        ZFS_TYPE_COS            = (1 << 6),
       59 +        ZFS_TYPE_AUTOSNAP       = (1 << 7)
  56   60  } zfs_type_t;
  57   61  
  58   62  /*
  59   63   * NB: lzc_dataset_type should be updated whenever a new objset type is added,
  60   64   * if it represents a real type of a dataset that can be created from userland.
  61   65   */
  62   66  typedef enum dmu_objset_type {
  63   67          DMU_OST_NONE,
  64   68          DMU_OST_META,
  65   69          DMU_OST_ZFS,
  66   70          DMU_OST_ZVOL,
  67   71          DMU_OST_OTHER,                  /* For testing only! */
  68   72          DMU_OST_ANY,                    /* Be careful! */
  69   73          DMU_OST_NUMTYPES
  70   74  } dmu_objset_type_t;
  71   75  
  72   76  #define ZFS_TYPE_DATASET        \
  73      -        (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
       77 +        (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME |\
       78 +    ZFS_TYPE_SNAPSHOT | ZFS_TYPE_AUTOSNAP)
  74   79  
  75   80  /*
  76   81   * All of these include the terminating NUL byte.
  77   82   */
  78   83  #define ZAP_MAXNAMELEN 256
  79   84  #define ZAP_MAXVALUELEN (1024 * 8)
  80   85  #define ZAP_OLDMAXVALUELEN 1024
  81   86  #define ZFS_MAX_DATASET_NAME_LEN 256
  82   87  
  83   88  /*
  84   89   * Dataset properties are identified by these constants and must be added to
  85   90   * the end of this list to ensure that external consumers are not affected
  86   91   * by the change. If you make any changes to this list, be sure to update
  87   92   * the property table in usr/src/common/zfs/zfs_prop.c.
  88   93   */
  89   94  typedef enum {
  90      -        ZPROP_CONT = -2,
  91      -        ZPROP_INVAL = -1,
       95 +        ZFS_PROP_BAD = -1,
  92   96          ZFS_PROP_TYPE = 0,
  93   97          ZFS_PROP_CREATION,
  94   98          ZFS_PROP_USED,
  95   99          ZFS_PROP_AVAILABLE,
  96  100          ZFS_PROP_REFERENCED,
  97  101          ZFS_PROP_COMPRESSRATIO,
  98  102          ZFS_PROP_MOUNTED,
  99  103          ZFS_PROP_ORIGIN,
 100  104          ZFS_PROP_QUOTA,
 101  105          ZFS_PROP_RESERVATION,
↓ open down ↓ 51 lines elided ↑ open up ↑
 153  157          ZFS_PROP_CLONES,
 154  158          ZFS_PROP_LOGICALUSED,
 155  159          ZFS_PROP_LOGICALREFERENCED,
 156  160          ZFS_PROP_INCONSISTENT,          /* not exposed to the user */
 157  161          ZFS_PROP_FILESYSTEM_LIMIT,
 158  162          ZFS_PROP_SNAPSHOT_LIMIT,
 159  163          ZFS_PROP_FILESYSTEM_COUNT,
 160  164          ZFS_PROP_SNAPSHOT_COUNT,
 161  165          ZFS_PROP_REDUNDANT_METADATA,
 162  166          ZFS_PROP_PREV_SNAP,
      167 +        ZFS_PROP_LSTXG,
      168 +        ZFS_PROP_ZPL_META_TO_METADEV,
      169 +        ZFS_PROP_WBC_MODE,
 163  170          ZFS_PROP_RECEIVE_RESUME_TOKEN,
 164      -        ZFS_PROP_REMAPTXG,              /* not exposed to the user */
      171 +        ZFS_PROP_SMARTCOMPRESSION,
      172 +        ZFS_PROP_RATE_LIMIT,
      173 +        ZFS_PROP_MODIFIED,
 165  174          ZFS_NUM_PROPS
 166  175  } zfs_prop_t;
 167  176  
 168  177  typedef enum {
 169  178          ZFS_PROP_USERUSED,
 170  179          ZFS_PROP_USERQUOTA,
 171  180          ZFS_PROP_GROUPUSED,
 172  181          ZFS_PROP_GROUPQUOTA,
 173  182          ZFS_NUM_USERQUOTA_PROPS
 174  183  } zfs_userquota_prop_t;
 175  184  
 176  185  extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
 177  186  
 178  187  /*
 179  188   * Pool properties are identified by these constants and must be added to the
 180  189   * end of this list to ensure that external consumers are not affected
 181  190   * by the change. If you make any changes to this list, be sure to update
 182  191   * the property table in usr/src/common/zfs/zpool_prop.c.
      192 + *
      193 + * NOTE: When either adding or changing a feature make sure
      194 + * to update the zfs-tests zpool_get configuration file
      195 + * at usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
 183  196   */
 184  197  typedef enum {
 185      -        ZPOOL_PROP_INVAL = -1,
 186  198          ZPOOL_PROP_NAME,
 187  199          ZPOOL_PROP_SIZE,
 188  200          ZPOOL_PROP_CAPACITY,
 189  201          ZPOOL_PROP_ALTROOT,
 190  202          ZPOOL_PROP_HEALTH,
 191  203          ZPOOL_PROP_GUID,
 192  204          ZPOOL_PROP_VERSION,
 193  205          ZPOOL_PROP_BOOTFS,
 194  206          ZPOOL_PROP_DELEGATION,
 195  207          ZPOOL_PROP_AUTOREPLACE,
 196  208          ZPOOL_PROP_CACHEFILE,
 197  209          ZPOOL_PROP_FAILUREMODE,
 198  210          ZPOOL_PROP_LISTSNAPS,
 199  211          ZPOOL_PROP_AUTOEXPAND,
 200  212          ZPOOL_PROP_DEDUPDITTO,
 201  213          ZPOOL_PROP_DEDUPRATIO,
      214 +        ZPOOL_PROP_DDTCAPPED,
 202  215          ZPOOL_PROP_FREE,
 203  216          ZPOOL_PROP_ALLOCATED,
 204  217          ZPOOL_PROP_READONLY,
 205  218          ZPOOL_PROP_COMMENT,
 206  219          ZPOOL_PROP_EXPANDSZ,
 207  220          ZPOOL_PROP_FREEING,
 208  221          ZPOOL_PROP_FRAGMENTATION,
 209  222          ZPOOL_PROP_LEAKED,
 210  223          ZPOOL_PROP_MAXBLOCKSIZE,
      224 +        ZPOOL_PROP_ENABLESPECIAL,
      225 +        ZPOOL_PROP_LOWATERMARK,
      226 +        ZPOOL_PROP_HIWATERMARK,
      227 +        ZPOOL_PROP_DEDUPMETA_DITTO,
      228 +        ZPOOL_PROP_DDT_DESEGREGATION,
      229 +        ZPOOL_PROP_META_PLACEMENT,
      230 +        ZPOOL_PROP_DDT_META_TO_METADEV,
      231 +        ZPOOL_PROP_ZFS_META_TO_METADEV,
      232 +        ZPOOL_PROP_DEDUP_BEST_EFFORT,
      233 +        ZPOOL_PROP_DEDUP_LO_BEST_EFFORT,
      234 +        ZPOOL_PROP_DEDUP_HI_BEST_EFFORT,
      235 +        ZPOOL_PROP_FORCETRIM,
      236 +        ZPOOL_PROP_AUTOTRIM,
      237 +        ZPOOL_PROP_SMALL_DATA_TO_METADEV,
      238 +        ZPOOL_PROP_MINWATERMARK,
      239 +        ZPOOL_PROP_SYNC_TO_SPECIAL,
 211  240          ZPOOL_PROP_BOOTSIZE,
      241 +        ZPOOL_PROP_SCRUB_PRIO,
      242 +        ZPOOL_PROP_RESILVER_PRIO,
 212  243          ZPOOL_NUM_PROPS
 213  244  } zpool_prop_t;
 214  245  
      246 +/*
      247 + * Note: it is important to keep min/max active properties together in the
      248 + * same order as the corresponding zio_priority_t definitions as this order
      249 + * is relied upon when processing in loops. See vdev_impl.h for the set of
      250 + * macros that rely on this dependency.
      251 + * Also path must be the first entry in the enum as loops use it as a starting
      252 + * index.
      253 + */
      254 +typedef enum vdev_prop {
      255 +        VDEV_PROP_PATH,
      256 +        VDEV_PROP_FRU,
      257 +        /* minactive props for queue classes */
      258 +        VDEV_PROP_READ_MINACTIVE,
      259 +        VDEV_PROP_AREAD_MINACTIVE,
      260 +        VDEV_PROP_WRITE_MINACTIVE,
      261 +        VDEV_PROP_AWRITE_MINACTIVE,
      262 +        VDEV_PROP_RESILVER_MINACTIVE,
      263 +        VDEV_PROP_SCRUB_MINACTIVE,
      264 +        /* maxactive props for queue classes */
      265 +        VDEV_PROP_READ_MAXACTIVE,
      266 +        VDEV_PROP_AREAD_MAXACTIVE,
      267 +        VDEV_PROP_WRITE_MAXACTIVE,
      268 +        VDEV_PROP_AWRITE_MAXACTIVE,
      269 +        VDEV_PROP_RESILVER_MAXACTIVE,
      270 +        VDEV_PROP_SCRUB_MAXACTIVE,
      271 +        VDEV_PROP_PREFERRED_READ,
      272 +        VDEV_PROP_COS,
      273 +        VDEV_PROP_SPAREGROUP,
      274 +        VDEV_PROP_L2ADDDT,
      275 +        VDEV_PROP_GUID,
      276 +        VDEV_NUM_PROPS
      277 +} vdev_prop_t;
      278 +
      279 +/*
      280 + * Note: it is important to keep min/max active properties together in the
      281 + * same order as the corresponding zio_priority_t definitions as this order
      282 + * is relied upon when processing in loops. See cos.h for the set of
      283 + * macros that rely on this dependency.
      284 + */
      285 +typedef enum cos_prop {
      286 +        COS_PROP_GUID,
      287 +        /* user-defined cos name */
      288 +        COS_PROP_NAME,
      289 +        /* IO tunables */
      290 +        /* minactive props for queue classes */
      291 +        COS_PROP_READ_MINACTIVE,
      292 +        COS_PROP_AREAD_MINACTIVE,
      293 +        COS_PROP_WRITE_MINACTIVE,
      294 +        COS_PROP_AWRITE_MINACTIVE,
      295 +        COS_PROP_RESILVER_MINACTIVE,
      296 +        COS_PROP_SCRUB_MINACTIVE,
      297 +        /* maxactive props for queue classes */
      298 +        COS_PROP_READ_MAXACTIVE,
      299 +        COS_PROP_AREAD_MAXACTIVE,
      300 +        COS_PROP_WRITE_MAXACTIVE,
      301 +        COS_PROP_AWRITE_MAXACTIVE,
      302 +        COS_PROP_RESILVER_MAXACTIVE,
      303 +        COS_PROP_SCRUB_MAXACTIVE,
      304 +        /* preference for read in mirror configurations */
      305 +        COS_PROP_PREFERRED_READ,
      306 +        COS_NUM_PROPS
      307 +} cos_prop_t;
      308 +
 215  309  /* Small enough to not hog a whole line of printout in zpool(1M). */
 216  310  #define ZPROP_MAX_COMMENT       32
 217  311  
      312 +#define ZPROP_CONT              -2
      313 +#define ZPROP_INVAL             -1
      314 +
 218  315  #define ZPROP_VALUE             "value"
 219  316  #define ZPROP_SOURCE            "source"
 220  317  
 221  318  typedef enum {
 222  319          ZPROP_SRC_NONE = 0x1,
 223  320          ZPROP_SRC_DEFAULT = 0x2,
 224  321          ZPROP_SRC_TEMPORARY = 0x4,
 225  322          ZPROP_SRC_LOCAL = 0x8,
 226  323          ZPROP_SRC_INHERITED = 0x10,
 227  324          ZPROP_SRC_RECEIVED = 0x20
↓ open down ↓ 58 lines elided ↑ open up ↑
 286  383  const char *zpool_prop_default_string(zpool_prop_t);
 287  384  uint64_t zpool_prop_default_numeric(zpool_prop_t);
 288  385  boolean_t zpool_prop_readonly(zpool_prop_t);
 289  386  boolean_t zpool_prop_feature(const char *);
 290  387  boolean_t zpool_prop_unsupported(const char *name);
 291  388  int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
 292  389  int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
 293  390  uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
 294  391  
 295  392  /*
      393 + * Vdev property functions shared between libzfs and kernel.
      394 + */
      395 +vdev_prop_t vdev_name_to_prop(const char *);
      396 +const char *vdev_prop_to_name(vdev_prop_t);
      397 +const char *vdev_prop_default_string(vdev_prop_t);
      398 +uint64_t vdev_prop_default_numeric(vdev_prop_t);
      399 +boolean_t vdev_prop_readonly(vdev_prop_t);
      400 +int vdev_prop_index_to_string(vdev_prop_t, uint64_t, const char **);
      401 +int vdev_prop_string_to_index(vdev_prop_t, const char *, uint64_t *);
      402 +uint64_t vdev_prop_random_value(vdev_prop_t, uint64_t seed);
      403 +
      404 +/*
      405 + * COS property functions shared between libzfs and kernel.
      406 + */
      407 +cos_prop_t cos_name_to_prop(const char *);
      408 +const char *cos_prop_to_name(cos_prop_t);
      409 +const char *cos_prop_default_string(cos_prop_t);
      410 +uint64_t cos_prop_default_numeric(cos_prop_t);
      411 +boolean_t cos_prop_readonly(cos_prop_t);
      412 +int cos_prop_index_to_string(cos_prop_t, uint64_t, const char **);
      413 +int cos_prop_string_to_index(cos_prop_t, const char *, uint64_t *);
      414 +uint64_t cos_prop_random_value(cos_prop_t, uint64_t seed);
      415 +
      416 +#define MAXCOSNAMELEN   (64)
      417 +/*
 296  418   * Definitions for the Delegation.
 297  419   */
 298  420  typedef enum {
 299  421          ZFS_DELEG_WHO_UNKNOWN = 0,
 300  422          ZFS_DELEG_USER = 'u',
 301  423          ZFS_DELEG_USER_SETS = 'U',
 302  424          ZFS_DELEG_GROUP = 'g',
 303  425          ZFS_DELEG_GROUP_SETS = 'G',
 304  426          ZFS_DELEG_EVERYONE = 'e',
 305  427          ZFS_DELEG_EVERYONE_SETS = 'E',
↓ open down ↓ 41 lines elided ↑ open up ↑
 347  469  typedef enum zfs_smb_acl_op {
 348  470          ZFS_SMB_ACL_ADD,
 349  471          ZFS_SMB_ACL_REMOVE,
 350  472          ZFS_SMB_ACL_RENAME,
 351  473          ZFS_SMB_ACL_PURGE
 352  474  } zfs_smb_acl_op_t;
 353  475  
 354  476  typedef enum zfs_cache_type {
 355  477          ZFS_CACHE_NONE = 0,
 356  478          ZFS_CACHE_METADATA = 1,
 357      -        ZFS_CACHE_ALL = 2
      479 +        ZFS_CACHE_ALL = 2,
      480 +        ZFS_CACHE_DATA = 3
 358  481  } zfs_cache_type_t;
 359  482  
 360  483  typedef enum {
 361  484          ZFS_SYNC_STANDARD = 0,
 362  485          ZFS_SYNC_ALWAYS = 1,
 363  486          ZFS_SYNC_DISABLED = 2
 364  487  } zfs_sync_type_t;
 365  488  
 366  489  typedef enum {
 367  490          ZFS_REDUNDANT_METADATA_ALL,
 368  491          ZFS_REDUNDANT_METADATA_MOST
 369  492  } zfs_redundant_metadata_type_t;
 370  493  
      494 +typedef enum {
      495 +        ZFS_WBC_MODE_OFF,
      496 +        ZFS_WBC_MODE_ON,
      497 +        ZFS_WBC_MODE_OFF_DELAYED
      498 +} zfs_wbc_mode_t;
      499 +
 371  500  /*
 372  501   * On-disk version number.
 373  502   */
 374  503  #define SPA_VERSION_1                   1ULL
 375  504  #define SPA_VERSION_2                   2ULL
 376  505  #define SPA_VERSION_3                   3ULL
 377  506  #define SPA_VERSION_4                   4ULL
 378  507  #define SPA_VERSION_5                   5ULL
 379  508  #define SPA_VERSION_6                   6ULL
 380  509  #define SPA_VERSION_7                   7ULL
↓ open down ↓ 120 lines elided ↑ open up ↑
 501  630  
 502  631  typedef struct zpool_rewind_policy {
 503  632          uint32_t        zrp_request;    /* rewind behavior requested */
 504  633          uint64_t        zrp_maxmeta;    /* max acceptable meta-data errors */
 505  634          uint64_t        zrp_maxdata;    /* max acceptable data errors */
 506  635          uint64_t        zrp_txg;        /* specific txg to load */
 507  636  } zpool_rewind_policy_t;
 508  637  
 509  638  /*
 510  639   * The following are configuration names used in the nvlist describing a pool's
 511      - * configuration.  New on-disk names should be prefixed with "<reverse-DNS>:"
 512      - * (e.g. "org.open-zfs:") to avoid conflicting names being developed
 513      - * independently.
      640 + * configuration.
 514  641   */
 515  642  #define ZPOOL_CONFIG_VERSION            "version"
 516  643  #define ZPOOL_CONFIG_POOL_NAME          "name"
 517  644  #define ZPOOL_CONFIG_POOL_STATE         "state"
 518  645  #define ZPOOL_CONFIG_POOL_TXG           "txg"
 519  646  #define ZPOOL_CONFIG_POOL_GUID          "pool_guid"
 520  647  #define ZPOOL_CONFIG_CREATE_TXG         "create_txg"
 521  648  #define ZPOOL_CONFIG_TOP_GUID           "top_guid"
 522  649  #define ZPOOL_CONFIG_VDEV_TREE          "vdev_tree"
 523  650  #define ZPOOL_CONFIG_TYPE               "type"
 524  651  #define ZPOOL_CONFIG_CHILDREN           "children"
 525  652  #define ZPOOL_CONFIG_ID                 "id"
 526  653  #define ZPOOL_CONFIG_GUID               "guid"
 527      -#define ZPOOL_CONFIG_INDIRECT_OBJECT    "com.delphix:indirect_object"
 528      -#define ZPOOL_CONFIG_INDIRECT_BIRTHS    "com.delphix:indirect_births"
 529      -#define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev"
 530  654  #define ZPOOL_CONFIG_PATH               "path"
 531  655  #define ZPOOL_CONFIG_DEVID              "devid"
 532  656  #define ZPOOL_CONFIG_METASLAB_ARRAY     "metaslab_array"
 533  657  #define ZPOOL_CONFIG_METASLAB_SHIFT     "metaslab_shift"
 534  658  #define ZPOOL_CONFIG_ASHIFT             "ashift"
 535  659  #define ZPOOL_CONFIG_ASIZE              "asize"
 536  660  #define ZPOOL_CONFIG_DTL                "DTL"
 537  661  #define ZPOOL_CONFIG_SCAN_STATS         "scan_stats"    /* not stored on disk */
 538      -#define ZPOOL_CONFIG_REMOVAL_STATS      "removal_stats" /* not stored on disk */
 539  662  #define ZPOOL_CONFIG_VDEV_STATS         "vdev_stats"    /* not stored on disk */
 540      -#define ZPOOL_CONFIG_INDIRECT_SIZE      "indirect_size" /* not stored on disk */
 541  663  #define ZPOOL_CONFIG_WHOLE_DISK         "whole_disk"
 542  664  #define ZPOOL_CONFIG_ERRCOUNT           "error_count"
 543  665  #define ZPOOL_CONFIG_NOT_PRESENT        "not_present"
 544  666  #define ZPOOL_CONFIG_SPARES             "spares"
 545  667  #define ZPOOL_CONFIG_IS_SPARE           "is_spare"
 546  668  #define ZPOOL_CONFIG_NPARITY            "nparity"
 547  669  #define ZPOOL_CONFIG_HOSTID             "hostid"
 548  670  #define ZPOOL_CONFIG_HOSTNAME           "hostname"
 549  671  #define ZPOOL_CONFIG_LOADED_TIME        "initial_load_time"
 550  672  #define ZPOOL_CONFIG_UNSPARE            "unspare"
 551  673  #define ZPOOL_CONFIG_PHYS_PATH          "phys_path"
 552  674  #define ZPOOL_CONFIG_IS_LOG             "is_log"
      675 +#define ZPOOL_CONFIG_IS_SPECIAL         "is_special"
 553  676  #define ZPOOL_CONFIG_L2CACHE            "l2cache"
      677 +#define ZPOOL_CONFIG_L2CACHE_PERSISTENT "l2cache_persistent"
 554  678  #define ZPOOL_CONFIG_HOLE_ARRAY         "hole_array"
 555  679  #define ZPOOL_CONFIG_VDEV_CHILDREN      "vdev_children"
 556  680  #define ZPOOL_CONFIG_IS_HOLE            "is_hole"
 557  681  #define ZPOOL_CONFIG_DDT_HISTOGRAM      "ddt_histogram"
 558  682  #define ZPOOL_CONFIG_DDT_OBJ_STATS      "ddt_object_stats"
 559  683  #define ZPOOL_CONFIG_DDT_STATS          "ddt_stats"
 560  684  #define ZPOOL_CONFIG_SPLIT              "splitcfg"
 561  685  #define ZPOOL_CONFIG_ORIG_GUID          "orig_guid"
 562  686  #define ZPOOL_CONFIG_SPLIT_GUID         "split_guid"
 563  687  #define ZPOOL_CONFIG_SPLIT_LIST         "guid_list"
 564  688  #define ZPOOL_CONFIG_REMOVING           "removing"
      689 +#define ZPOOL_CONFIG_RESILVERING        "resilvering"
 565  690  #define ZPOOL_CONFIG_RESILVER_TXG       "resilver_txg"
 566  691  #define ZPOOL_CONFIG_COMMENT            "comment"
 567  692  #define ZPOOL_CONFIG_SUSPENDED          "suspended"     /* not stored on disk */
 568  693  #define ZPOOL_CONFIG_TIMESTAMP          "timestamp"     /* not stored on disk */
 569  694  #define ZPOOL_CONFIG_BOOTFS             "bootfs"        /* not stored on disk */
 570  695  #define ZPOOL_CONFIG_MISSING_DEVICES    "missing_vdevs" /* not stored on disk */
 571  696  #define ZPOOL_CONFIG_LOAD_INFO          "load_info"     /* not stored on disk */
 572  697  #define ZPOOL_CONFIG_REWIND_INFO        "rewind_info"   /* not stored on disk */
 573  698  #define ZPOOL_CONFIG_UNSUP_FEAT         "unsup_feat"    /* not stored on disk */
 574  699  #define ZPOOL_CONFIG_ENABLED_FEAT       "enabled_feat"  /* not stored on disk */
 575  700  #define ZPOOL_CONFIG_CAN_RDONLY         "can_rdonly"    /* not stored on disk */
 576  701  #define ZPOOL_CONFIG_FEATURES_FOR_READ  "features_for_read"
 577  702  #define ZPOOL_CONFIG_FEATURE_STATS      "feature_stats" /* not stored on disk */
      703 +#define ZPOOL_CONFIG_IS_SSD             "is_ssd"        /* not stored on disk */
 578  704  #define ZPOOL_CONFIG_VDEV_TOP_ZAP       "com.delphix:vdev_zap_top"
 579  705  #define ZPOOL_CONFIG_VDEV_LEAF_ZAP      "com.delphix:vdev_zap_leaf"
 580  706  #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS  "com.delphix:has_per_vdev_zaps"
 581      -#define ZPOOL_CONFIG_CACHEFILE          "cachefile"     /* not stored on disk */
 582  707  /*
 583  708   * The persistent vdev state is stored as separate values rather than a single
 584  709   * 'vdev_state' entry.  This is because a device can be in multiple states, such
 585  710   * as offline and degraded.
 586  711   */
 587  712  #define ZPOOL_CONFIG_OFFLINE            "offline"
 588  713  #define ZPOOL_CONFIG_FAULTED            "faulted"
 589  714  #define ZPOOL_CONFIG_DEGRADED           "degraded"
 590  715  #define ZPOOL_CONFIG_REMOVED            "removed"
 591  716  #define ZPOOL_CONFIG_FRU                "fru"
 592  717  #define ZPOOL_CONFIG_AUX_STATE          "aux_state"
      718 +#define ZPOOL_CONFIG_TRIM_PROG          "trim_prog"
      719 +#define ZPOOL_CONFIG_TRIM_RATE          "trim_rate"
      720 +#define ZPOOL_CONFIG_TRIM_START_TIME    "trim_start_time"
      721 +#define ZPOOL_CONFIG_TRIM_STOP_TIME     "trim_stop_time"
 593  722  
 594  723  /* Rewind policy parameters */
 595  724  #define ZPOOL_REWIND_POLICY             "rewind-policy"
 596  725  #define ZPOOL_REWIND_REQUEST            "rewind-request"
 597  726  #define ZPOOL_REWIND_REQUEST_TXG        "rewind-request-txg"
 598  727  #define ZPOOL_REWIND_META_THRESH        "rewind-meta-thresh"
 599  728  #define ZPOOL_REWIND_DATA_THRESH        "rewind-data-thresh"
 600  729  
 601  730  /* Rewind data discovered */
 602  731  #define ZPOOL_CONFIG_LOAD_TIME          "rewind_txg_ts"
↓ open down ↓ 4 lines elided ↑ open up ↑
 607  736  #define VDEV_TYPE_MIRROR                "mirror"
 608  737  #define VDEV_TYPE_REPLACING             "replacing"
 609  738  #define VDEV_TYPE_RAIDZ                 "raidz"
 610  739  #define VDEV_TYPE_DISK                  "disk"
 611  740  #define VDEV_TYPE_FILE                  "file"
 612  741  #define VDEV_TYPE_MISSING               "missing"
 613  742  #define VDEV_TYPE_HOLE                  "hole"
 614  743  #define VDEV_TYPE_SPARE                 "spare"
 615  744  #define VDEV_TYPE_LOG                   "log"
 616  745  #define VDEV_TYPE_L2CACHE               "l2cache"
 617      -#define VDEV_TYPE_INDIRECT              "indirect"
      746 +#define VDEV_TYPE_SPECIAL               "special"
 618  747  
 619      -/* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
 620      -#define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
 621      -        "com.delphix:indirect_obsolete_sm"
 622      -#define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
 623      -        "com.delphix:obsolete_counts_are_precise"
 624      -
 625  748  /*
 626  749   * This is needed in userland to report the minimum necessary device size.
 627  750   *
 628  751   * Note that the zfs test suite uses 64MB vdevs.
 629  752   */
 630  753  #define SPA_MINDEVSIZE          (64ULL << 20)
 631  754  
 632  755  /*
 633  756   * Set if the fragmentation has not yet been calculated. This can happen
 634  757   * because the space maps have not been upgraded or the histogram feature
↓ open down ↓ 37 lines elided ↑ open up ↑
 672  795          VDEV_AUX_TOO_SMALL,     /* vdev size is too small               */
 673  796          VDEV_AUX_BAD_LABEL,     /* the label is OK but invalid          */
 674  797          VDEV_AUX_VERSION_NEWER, /* on-disk version is too new           */
 675  798          VDEV_AUX_VERSION_OLDER, /* on-disk version is too old           */
 676  799          VDEV_AUX_UNSUP_FEAT,    /* unsupported features                 */
 677  800          VDEV_AUX_SPARED,        /* hot spare used in another pool       */
 678  801          VDEV_AUX_ERR_EXCEEDED,  /* too many errors                      */
 679  802          VDEV_AUX_IO_FAILURE,    /* experienced I/O failure              */
 680  803          VDEV_AUX_BAD_LOG,       /* cannot read log chain(s)             */
 681  804          VDEV_AUX_EXTERNAL,      /* external diagnosis                   */
 682      -        VDEV_AUX_SPLIT_POOL,    /* vdev was split off into another pool */
 683      -        VDEV_AUX_CHILDREN_OFFLINE /* all children are offline           */
      805 +        VDEV_AUX_SPLIT_POOL     /* vdev was split off into another pool */
 684  806  } vdev_aux_t;
 685  807  
 686  808  /*
 687  809   * pool state.  The following states are written to disk as part of the normal
 688  810   * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
 689  811   * states are software abstractions used at various levels to communicate
 690  812   * pool state.
 691  813   */
 692  814  typedef enum pool_state {
 693  815          POOL_STATE_ACTIVE = 0,          /* In active use                */
↓ open down ↓ 6 lines elided ↑ open up ↑
 700  822          POOL_STATE_POTENTIALLY_ACTIVE   /* Internal libzfs state        */
 701  823  } pool_state_t;
 702  824  
 703  825  /*
 704  826   * Scan Functions.
 705  827   */
 706  828  typedef enum pool_scan_func {
 707  829          POOL_SCAN_NONE,
 708  830          POOL_SCAN_SCRUB,
 709  831          POOL_SCAN_RESILVER,
      832 +        POOL_SCAN_MOS,
      833 +        POOL_SCAN_META,
 710  834          POOL_SCAN_FUNCS
 711  835  } pool_scan_func_t;
 712  836  
 713  837  /*
      838 + * TRIM command configuration info.
      839 + */
      840 +typedef struct trim_cmd_info_s {
      841 +        uint64_t        tci_start;      /* B_TRUE = start; B_FALSE = stop */
      842 +        uint64_t        tci_rate;       /* requested TRIM rate in bytes/sec */
      843 +} trim_cmd_info_t;
      844 +
      845 +/*
 714  846   * Used to control scrub pause and resume.
 715  847   */
 716  848  typedef enum pool_scrub_cmd {
 717  849          POOL_SCRUB_NORMAL = 0,
 718  850          POOL_SCRUB_PAUSE,
 719  851          POOL_SCRUB_FLAGS_END
 720  852  } pool_scrub_cmd_t;
 721  853  
 722      -
 723  854  /*
 724  855   * ZIO types.  Needed to interpret vdev statistics below.
 725  856   */
 726  857  typedef enum zio_type {
 727  858          ZIO_TYPE_NULL = 0,
 728  859          ZIO_TYPE_READ,
 729  860          ZIO_TYPE_WRITE,
 730  861          ZIO_TYPE_FREE,
 731  862          ZIO_TYPE_CLAIM,
 732  863          ZIO_TYPE_IOCTL,
↓ open down ↓ 4 lines elided ↑ open up ↑
 737  868   * Pool statistics.  Note: all fields should be 64-bit because this
 738  869   * is passed between kernel and userland as an nvlist uint64 array.
 739  870   */
 740  871  typedef struct pool_scan_stat {
 741  872          /* values stored on disk */
 742  873          uint64_t        pss_func;       /* pool_scan_func_t */
 743  874          uint64_t        pss_state;      /* dsl_scan_state_t */
 744  875          uint64_t        pss_start_time; /* scan start time */
 745  876          uint64_t        pss_end_time;   /* scan end time */
 746  877          uint64_t        pss_to_examine; /* total bytes to scan */
 747      -        uint64_t        pss_examined;   /* total examined bytes */
      878 +        uint64_t        pss_examined;   /* total bytes located by scanner */
      879 +        uint64_t        pss_issued;     /* total bytes checked by scanner */
 748  880          uint64_t        pss_to_process; /* total bytes to process */
 749  881          uint64_t        pss_processed;  /* total processed bytes */
 750  882          uint64_t        pss_errors;     /* scan errors  */
 751  883  
 752  884          /* values not stored on disk */
 753  885          uint64_t        pss_pass_exam;  /* examined bytes per scan pass */
      886 +        uint64_t        pss_pass_work;  /* issued bytes per scan pass */
 754  887          uint64_t        pss_pass_start; /* start time of a scan pass */
 755  888          uint64_t        pss_pass_scrub_pause; /* pause time of a scurb pass */
 756  889          /* cumulative time scrub spent paused, needed for rate calculation */
 757  890          uint64_t        pss_pass_scrub_spent_paused;
 758  891  } pool_scan_stat_t;
 759  892  
 760      -typedef struct pool_removal_stat {
 761      -        uint64_t prs_state; /* dsl_scan_state_t */
 762      -        uint64_t prs_removing_vdev;
 763      -        uint64_t prs_start_time;
 764      -        uint64_t prs_end_time;
 765      -        uint64_t prs_to_copy; /* bytes that need to be copied */
 766      -        uint64_t prs_copied; /* bytes copied so far */
 767      -        /*
 768      -         * bytes of memory used for indirect mappings.
 769      -         * This includes all removed vdevs.
 770      -         */
 771      -        uint64_t prs_mapping_memory;
 772      -} pool_removal_stat_t;
 773      -
 774  893  typedef enum dsl_scan_state {
 775  894          DSS_NONE,
 776  895          DSS_SCANNING,
 777  896          DSS_FINISHED,
 778  897          DSS_CANCELED,
      898 +        DSS_FINISHING,
 779  899          DSS_NUM_STATES
 780  900  } dsl_scan_state_t;
 781  901  
 782  902  
 783  903  /*
 784  904   * Vdev statistics.  Note: all fields should be 64-bit because this
 785  905   * is passed between kernel and userland as an nvlist uint64 array.
 786  906   */
 787  907  typedef struct vdev_stat {
 788  908          hrtime_t        vs_timestamp;           /* time since vdev load */
↓ open down ↓ 6 lines elided ↑ open up ↑
 795  915          uint64_t        vs_esize;               /* expandable dev size */
 796  916          uint64_t        vs_ops[ZIO_TYPES];      /* operation count      */
 797  917          uint64_t        vs_bytes[ZIO_TYPES];    /* bytes read/written   */
 798  918          uint64_t        vs_read_errors;         /* read errors          */
 799  919          uint64_t        vs_write_errors;        /* write errors         */
 800  920          uint64_t        vs_checksum_errors;     /* checksum errors      */
 801  921          uint64_t        vs_self_healed;         /* self-healed bytes    */
 802  922          uint64_t        vs_scan_removing;       /* removing?    */
 803  923          uint64_t        vs_scan_processed;      /* scan processed bytes */
 804  924          uint64_t        vs_fragmentation;       /* device fragmentation */
      925 +        hrtime_t        vs_latency[ZIO_TYPES];  /* moving average of latency */
      926 +        hrtime_t        vs_iotime[ZIO_TYPES];   /* time spent doing i/o */
 805  927  } vdev_stat_t;
 806  928  
 807  929  /*
 808  930   * DDT statistics.  Note: all fields should be 64-bit because this
 809  931   * is passed between kernel and userland as an nvlist uint64 array.
 810  932   */
 811  933  typedef struct ddt_object {
 812  934          uint64_t        ddo_count;      /* number of elments in ddt     */
 813  935          uint64_t        ddo_dspace;     /* size of ddt on disk          */
 814  936          uint64_t        ddo_mspace;     /* size of ddt in-core          */
↓ open down ↓ 48 lines elided ↑ open up ↑
 863  985          ZFS_IOC_POOL_TRYIMPORT,
 864  986          ZFS_IOC_POOL_SCAN,
 865  987          ZFS_IOC_POOL_FREEZE,
 866  988          ZFS_IOC_POOL_UPGRADE,
 867  989          ZFS_IOC_POOL_GET_HISTORY,
 868  990          ZFS_IOC_VDEV_ADD,
 869  991          ZFS_IOC_VDEV_REMOVE,
 870  992          ZFS_IOC_VDEV_SET_STATE,
 871  993          ZFS_IOC_VDEV_ATTACH,
 872  994          ZFS_IOC_VDEV_DETACH,
      995 +        ZFS_IOC_VDEV_SETL2ADDDT,
 873  996          ZFS_IOC_VDEV_SETPATH,
 874  997          ZFS_IOC_VDEV_SETFRU,
 875  998          ZFS_IOC_OBJSET_STATS,
 876  999          ZFS_IOC_OBJSET_ZPLPROPS,
 877 1000          ZFS_IOC_DATASET_LIST_NEXT,
 878 1001          ZFS_IOC_SNAPSHOT_LIST_NEXT,
 879 1002          ZFS_IOC_SET_PROP,
 880 1003          ZFS_IOC_CREATE,
 881 1004          ZFS_IOC_DESTROY,
 882 1005          ZFS_IOC_ROLLBACK,
↓ open down ↓ 34 lines elided ↑ open up ↑
 917 1040          ZFS_IOC_POOL_REGUID,
 918 1041          ZFS_IOC_POOL_REOPEN,
 919 1042          ZFS_IOC_SEND_PROGRESS,
 920 1043          ZFS_IOC_LOG_HISTORY,
 921 1044          ZFS_IOC_SEND_NEW,
 922 1045          ZFS_IOC_SEND_SPACE,
 923 1046          ZFS_IOC_CLONE,
 924 1047          ZFS_IOC_BOOKMARK,
 925 1048          ZFS_IOC_GET_BOOKMARKS,
 926 1049          ZFS_IOC_DESTROY_BOOKMARKS,
     1050 +        ZFS_IOC_VDEV_SET_PROPS,
     1051 +        ZFS_IOC_VDEV_GET_PROPS,
     1052 +        ZFS_IOC_COS_ALLOC,
     1053 +        ZFS_IOC_COS_FREE,
     1054 +        ZFS_IOC_COS_LIST,
     1055 +        ZFS_IOC_COS_SET_PROPS,
     1056 +        ZFS_IOC_COS_GET_PROPS,
     1057 +        ZFS_IOC_POOL_CONFIGS_NVL,
     1058 +        ZFS_IOC_POOL_STATS_NVL,
     1059 +        ZFS_IOC_OBJSET_STATS_NVL,
     1060 +        ZFS_IOC_DATASET_LIST_NEXT_NVL,
     1061 +        ZFS_IOC_SNAPSHOT_LIST_NEXT_NVL,
     1062 +        ZFS_IOC_POOL_GET_PROPS_NVL,
     1063 +        ZFS_IOC_CHECK_KRRP,
     1064 +        ZFS_IOC_BULK_LIST,
     1065 +        ZFS_IOC_POOL_TRIM,
 927 1066          ZFS_IOC_CHANNEL_PROGRAM,
 928      -        ZFS_IOC_REMAP,
     1067 +        ZFS_IOC_SET_PROPS_MDS,
 929 1068          ZFS_IOC_LAST
 930 1069  } zfs_ioc_t;
 931 1070  
 932 1071  /*
 933 1072   * Internal SPA load state.  Used by FMA diagnosis engine.
 934 1073   */
 935 1074  typedef enum {
 936 1075          SPA_LOAD_NONE,          /* no load in progress  */
 937 1076          SPA_LOAD_OPEN,          /* normal open          */
 938 1077          SPA_LOAD_IMPORT,        /* import in progress   */
↓ open down ↓ 138 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX