]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/fs/zfs.h
Illumos #2882, #2883, #2900
[mirror_zfs.git] / include / sys / fs / zfs.h
index 86d7ad51531334688d3909afba308d78568c70e0..164bf3591cb6d508b91254174d50d4b97e19b592 100644 (file)
@@ -21,8 +21,9 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  */
 
 /* Portions Copyright 2010 Robert Milkowski */
@@ -51,6 +52,16 @@ typedef enum {
        ZFS_TYPE_POOL           = 0x8
 } zfs_type_t;
 
+typedef enum dmu_objset_type {
+       DMU_OST_NONE,
+       DMU_OST_META,
+       DMU_OST_ZFS,
+       DMU_OST_ZVOL,
+       DMU_OST_OTHER,                  /* For testing only! */
+       DMU_OST_ANY,                    /* Be careful! */
+       DMU_OST_NUMTYPES
+} dmu_objset_type_t;
+
 #define        ZFS_TYPE_DATASET        \
        (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
 
@@ -62,7 +73,7 @@ typedef enum {
  * Dataset properties are identified by these constants and must be added to
  * the end of this list to ensure that external consumers are not affected
  * by the change. If you make any changes to this list, be sure to update
- * the property table in usr/src/common/zfs/zfs_prop.c.
+ * the property table in module/zcommon/zfs_prop.c.
  */
 typedef enum {
        ZFS_PROP_TYPE,
@@ -127,6 +138,7 @@ typedef enum {
        ZFS_PROP_REFRATIO,
        ZFS_PROP_WRITTEN,
        ZFS_PROP_CLONES,
+       ZFS_PROP_SNAPDEV,
        ZFS_NUM_PROPS
 } zfs_prop_t;
 
@@ -144,7 +156,7 @@ extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
  * Pool properties are identified by these constants and must be added to the
  * end of this list to ensure that external consumers are not affected
  * by the change. If you make any changes to this list, be sure to update
- * the property table in usr/src/common/zfs/zpool_prop.c.
+ * the property table in module/zcommon/zpool_prop.c.
  */
 typedef enum {
        ZPOOL_PROP_NAME,
@@ -167,9 +179,15 @@ typedef enum {
        ZPOOL_PROP_ALLOCATED,
        ZPOOL_PROP_READONLY,
        ZPOOL_PROP_ASHIFT,
+       ZPOOL_PROP_COMMENT,
+       ZPOOL_PROP_EXPANDSZ,
+       ZPOOL_PROP_FREEING,
        ZPOOL_NUM_PROPS
 } zpool_prop_t;
 
+/* Small enough to not hog a whole line of printout in zpool(1M). */
+#define        ZPROP_MAX_COMMENT       32
+
 #define        ZPROP_CONT              -2
 #define        ZPROP_INVAL             -1
 
@@ -238,6 +256,8 @@ const char *zpool_prop_to_name(zpool_prop_t);
 const char *zpool_prop_default_string(zpool_prop_t);
 uint64_t zpool_prop_default_numeric(zpool_prop_t);
 boolean_t zpool_prop_readonly(zpool_prop_t);
+boolean_t zpool_prop_feature(const char *);
+boolean_t zpool_prop_unsupported(const char *);
 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
 uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
@@ -350,6 +370,7 @@ typedef enum {
 #define        SPA_VERSION_26                  26ULL
 #define        SPA_VERSION_27                  27ULL
 #define        SPA_VERSION_28                  28ULL
+#define        SPA_VERSION_5000                5000ULL
 
 /*
  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
@@ -357,8 +378,8 @@ typedef enum {
  * and do the appropriate changes.  Also bump the version number in
  * usr/src/grub/capability.
  */
-#define        SPA_VERSION                     SPA_VERSION_28
-#define        SPA_VERSION_STRING              "28"
+#define        SPA_VERSION                     SPA_VERSION_5000
+#define        SPA_VERSION_STRING              "5000"
 
 /*
  * Symbolic names for the changes that caused a SPA_VERSION switch.
@@ -409,6 +430,12 @@ typedef enum {
 #define        SPA_VERSION_DEADLISTS           SPA_VERSION_26
 #define        SPA_VERSION_FAST_SNAP           SPA_VERSION_27
 #define        SPA_VERSION_MULTI_REPLACE       SPA_VERSION_28
+#define        SPA_VERSION_BEFORE_FEATURES     SPA_VERSION_28
+#define        SPA_VERSION_FEATURES            SPA_VERSION_5000
+
+#define        SPA_VERSION_IS_SUPPORTED(v) \
+       (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
+       ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
 
 /*
  * ZPL version - rev'd whenever an incompatible on-disk format change
@@ -500,11 +527,18 @@ typedef struct zpool_rewind_policy {
 #define        ZPOOL_CONFIG_SPLIT_LIST         "guid_list"
 #define        ZPOOL_CONFIG_REMOVING           "removing"
 #define        ZPOOL_CONFIG_RESILVERING        "resilvering"
+#define        ZPOOL_CONFIG_COMMENT            "comment"
 #define        ZPOOL_CONFIG_SUSPENDED          "suspended"     /* not stored on disk */
 #define        ZPOOL_CONFIG_TIMESTAMP          "timestamp"     /* not stored on disk */
 #define        ZPOOL_CONFIG_BOOTFS             "bootfs"        /* not stored on disk */
 #define        ZPOOL_CONFIG_MISSING_DEVICES    "missing_vdevs" /* not stored on disk */
 #define        ZPOOL_CONFIG_LOAD_INFO          "load_info"     /* not stored on disk */
+#define        ZPOOL_CONFIG_REWIND_INFO        "rewind_info"   /* not stored on disk */
+#define        ZPOOL_CONFIG_UNSUP_FEAT         "unsup_feat"    /* not stored on disk */
+#define        ZPOOL_CONFIG_ENABLED_FEAT       "enabled_feat"  /* not stored on disk */
+#define        ZPOOL_CONFIG_CAN_RDONLY         "can_rdonly"    /* not stored on disk */
+#define        ZPOOL_CONFIG_FEATURES_FOR_READ  "features_for_read"
+#define        ZPOOL_CONFIG_FEATURE_STATS      "feature_stats" /* not stored on disk */
 /*
  * The persistent vdev state is stored as separate values rather than a single
  * 'vdev_state' entry.  This is because a device can be in multiple states, such
@@ -583,6 +617,7 @@ typedef enum vdev_aux {
        VDEV_AUX_BAD_LABEL,     /* the label is OK but invalid          */
        VDEV_AUX_VERSION_NEWER, /* on-disk version is too new           */
        VDEV_AUX_VERSION_OLDER, /* on-disk version is too old           */
+       VDEV_AUX_UNSUP_FEAT,    /* unsupported features                 */
        VDEV_AUX_SPARED,        /* hot spare used in another pool       */
        VDEV_AUX_ERR_EXCEEDED,  /* too many errors                      */
        VDEV_AUX_IO_FAILURE,    /* experienced I/O failure              */
@@ -673,6 +708,7 @@ typedef struct vdev_stat {
        uint64_t        vs_space;               /* total capacity       */
        uint64_t        vs_dspace;              /* deflated capacity    */
        uint64_t        vs_rsize;               /* replaceable dev size */
+       uint64_t        vs_esize;               /* expandable dev size */
        uint64_t        vs_ops[ZIO_TYPES];      /* operation count      */
        uint64_t        vs_bytes[ZIO_TYPES];    /* bytes read/written   */
        uint64_t        vs_read_errors;         /* read errors          */
@@ -727,10 +763,10 @@ typedef struct ddt_histogram {
 /*
  * /dev/zfs ioctl numbers.
  */
-#define        ZFS_IOC         ('Z' << 8)
-
 typedef enum zfs_ioc {
-       ZFS_IOC_POOL_CREATE = ZFS_IOC,
+       ZFS_IOC_FIRST = ('Z' << 8),
+       ZFS_IOC = ZFS_IOC_FIRST,
+       ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
        ZFS_IOC_POOL_DESTROY,
        ZFS_IOC_POOL_IMPORT,
        ZFS_IOC_POOL_EXPORT,
@@ -767,7 +803,7 @@ typedef enum zfs_ioc {
        ZFS_IOC_ERROR_LOG,
        ZFS_IOC_CLEAR,
        ZFS_IOC_PROMOTE,
-       ZFS_IOC_DESTROY_SNAPS_NVL,
+       ZFS_IOC_DESTROY_SNAPS,
        ZFS_IOC_SNAPSHOT,
        ZFS_IOC_DSOBJ_TO_DSNAME,
        ZFS_IOC_OBJ_TO_PATH,
@@ -795,6 +831,13 @@ typedef enum zfs_ioc {
        ZFS_IOC_POOL_REGUID,
        ZFS_IOC_SPACE_WRITTEN,
        ZFS_IOC_SPACE_SNAPS,
+       ZFS_IOC_POOL_REOPEN,
+       ZFS_IOC_SEND_PROGRESS,
+       ZFS_IOC_LOG_HISTORY,
+       ZFS_IOC_SEND_NEW,
+       ZFS_IOC_SEND_SPACE,
+       ZFS_IOC_CLONE,
+       ZFS_IOC_LAST
 } zfs_ioc_t;
 
 /*
@@ -836,6 +879,12 @@ typedef enum {
 #define        ZPOOL_HIST_TXG          "history txg"
 #define        ZPOOL_HIST_INT_EVENT    "history internal event"
 #define        ZPOOL_HIST_INT_STR      "history internal str"
+#define        ZPOOL_HIST_INT_NAME     "internal_name"
+#define        ZPOOL_HIST_IOCTL        "ioctl"
+#define        ZPOOL_HIST_INPUT_NVL    "in_nvl"
+#define        ZPOOL_HIST_OUTPUT_NVL   "out_nvl"
+#define        ZPOOL_HIST_DSNAME       "dsname"
+#define        ZPOOL_HIST_DSID         "dsid"
 
 /*
  * Flags for ZFS_IOC_VDEV_SET_STATE
@@ -881,56 +930,6 @@ typedef enum {
 #define        ZFS_EV_VDEV_PATH        "vdev_path"
 #define        ZFS_EV_VDEV_GUID        "vdev_guid"
 
-/*
- * Note: This is encoded on-disk, so new events must be added to the
- * end, and unused events can not be removed.  Be sure to edit
- * libzfs_pool.c: hist_event_table[].
- */
-typedef enum history_internal_events {
-       LOG_NO_EVENT = 0,
-       LOG_POOL_CREATE,
-       LOG_POOL_VDEV_ADD,
-       LOG_POOL_REMOVE,
-       LOG_POOL_DESTROY,
-       LOG_POOL_EXPORT,
-       LOG_POOL_IMPORT,
-       LOG_POOL_VDEV_ATTACH,
-       LOG_POOL_VDEV_REPLACE,
-       LOG_POOL_VDEV_DETACH,
-       LOG_POOL_VDEV_ONLINE,
-       LOG_POOL_VDEV_OFFLINE,
-       LOG_POOL_UPGRADE,
-       LOG_POOL_CLEAR,
-       LOG_POOL_SCAN,
-       LOG_POOL_PROPSET,
-       LOG_DS_CREATE,
-       LOG_DS_CLONE,
-       LOG_DS_DESTROY,
-       LOG_DS_DESTROY_BEGIN,
-       LOG_DS_INHERIT,
-       LOG_DS_PROPSET,
-       LOG_DS_QUOTA,
-       LOG_DS_PERM_UPDATE,
-       LOG_DS_PERM_REMOVE,
-       LOG_DS_PERM_WHO_REMOVE,
-       LOG_DS_PROMOTE,
-       LOG_DS_RECEIVE,
-       LOG_DS_RENAME,
-       LOG_DS_RESERVATION,
-       LOG_DS_REPLAY_INC_SYNC,
-       LOG_DS_REPLAY_FULL_SYNC,
-       LOG_DS_ROLLBACK,
-       LOG_DS_SNAPSHOT,
-       LOG_DS_UPGRADE,
-       LOG_DS_REFQUOTA,
-       LOG_DS_REFRESERV,
-       LOG_POOL_SCAN_DONE,
-       LOG_DS_USER_HOLD,
-       LOG_DS_USER_RELEASE,
-       LOG_POOL_SPLIT,
-       LOG_END
-} history_internal_events_t;
-
 #ifdef __cplusplus
 }
 #endif