]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/fs/zfs.h
Introduce read/write kstats per dataset
[mirror_zfs.git] / include / sys / fs / zfs.h
index 480cecac9e5c725cc2f9b50d948692b9276d91f7..7daf72895730f03f5332be708bd3f6714a350a7b 100644 (file)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013, 2017 Joyent, Inc. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
@@ -145,7 +145,7 @@ typedef enum {
        ZFS_PROP_USERREFS,
        ZFS_PROP_LOGBIAS,
        ZFS_PROP_UNIQUE,                /* not exposed to the user */
-       ZFS_PROP_OBJSETID,              /* not exposed to the user */
+       ZFS_PROP_OBJSETID,
        ZFS_PROP_DEDUP,
        ZFS_PROP_MLSLABEL,
        ZFS_PROP_SYNC,
@@ -180,6 +180,7 @@ typedef enum {
        ZFS_PROP_ENCRYPTION_ROOT,
        ZFS_PROP_KEY_GUID,
        ZFS_PROP_KEYSTATUS,
+       ZFS_PROP_REMAPTXG,              /* not exposed to the user */
        ZFS_NUM_PROPS
 } zfs_prop_t;
 
@@ -192,6 +193,10 @@ typedef enum {
        ZFS_PROP_USEROBJQUOTA,
        ZFS_PROP_GROUPOBJUSED,
        ZFS_PROP_GROUPOBJQUOTA,
+       ZFS_PROP_PROJECTUSED,
+       ZFS_PROP_PROJECTQUOTA,
+       ZFS_PROP_PROJECTOBJUSED,
+       ZFS_PROP_PROJECTOBJQUOTA,
        ZFS_NUM_USERQUOTA_PROPS
 } zfs_userquota_prop_t;
 
@@ -234,6 +239,8 @@ typedef enum {
        ZPOOL_PROP_TNAME,
        ZPOOL_PROP_MAXDNODESIZE,
        ZPOOL_PROP_MULTIHOST,
+       ZPOOL_PROP_CHECKPOINT,
+       ZPOOL_PROP_LOAD_GUID,
        ZPOOL_NUM_PROPS
 } zpool_prop_t;
 
@@ -314,6 +321,7 @@ 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_setonce(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 **);
@@ -565,7 +573,7 @@ typedef enum zfs_key_location {
 #define        ZPL_VERSION_USERSPACE           ZPL_VERSION_4
 #define        ZPL_VERSION_SA                  ZPL_VERSION_5
 
-/* Rewind request information */
+/* Rewind policy information */
 #define        ZPOOL_NO_REWIND         1  /* No policy - default behavior */
 #define        ZPOOL_NEVER_REWIND      2  /* Do not search for best txg or rewind */
 #define        ZPOOL_TRY_REWIND        4  /* Search for best txg, but do not rewind */
@@ -574,16 +582,18 @@ typedef enum zfs_key_location {
 #define        ZPOOL_REWIND_MASK       28 /* All the possible rewind bits */
 #define        ZPOOL_REWIND_POLICIES   31 /* All the possible policy bits */
 
-typedef struct zpool_rewind_policy {
-       uint32_t        zrp_request;    /* rewind behavior requested */
-       uint64_t        zrp_maxmeta;    /* max acceptable meta-data errors */
-       uint64_t        zrp_maxdata;    /* max acceptable data errors */
-       uint64_t        zrp_txg;        /* specific txg to load */
-} zpool_rewind_policy_t;
+typedef struct zpool_load_policy {
+       uint32_t        zlp_rewind;     /* rewind policy requested */
+       uint64_t        zlp_maxmeta;    /* max acceptable meta-data errors */
+       uint64_t        zlp_maxdata;    /* max acceptable data errors */
+       uint64_t        zlp_txg;        /* specific txg to load */
+} zpool_load_policy_t;
 
 /*
  * The following are configuration names used in the nvlist describing a pool's
- * configuration.
+ * configuration.  New on-disk names should be prefixed with "<reverse-DNS>:"
+ * (e.g. "org.open-zfs:") to avoid conflicting names being developed
+ * independently.
  */
 #define        ZPOOL_CONFIG_VERSION            "version"
 #define        ZPOOL_CONFIG_POOL_NAME          "name"
@@ -597,6 +607,9 @@ typedef struct zpool_rewind_policy {
 #define        ZPOOL_CONFIG_CHILDREN           "children"
 #define        ZPOOL_CONFIG_ID                 "id"
 #define        ZPOOL_CONFIG_GUID               "guid"
+#define        ZPOOL_CONFIG_INDIRECT_OBJECT    "com.delphix:indirect_object"
+#define        ZPOOL_CONFIG_INDIRECT_BIRTHS    "com.delphix:indirect_births"
+#define        ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev"
 #define        ZPOOL_CONFIG_PATH               "path"
 #define        ZPOOL_CONFIG_DEVID              "devid"
 #define        ZPOOL_CONFIG_METASLAB_ARRAY     "metaslab_array"
@@ -605,7 +618,10 @@ typedef struct zpool_rewind_policy {
 #define        ZPOOL_CONFIG_ASIZE              "asize"
 #define        ZPOOL_CONFIG_DTL                "DTL"
 #define        ZPOOL_CONFIG_SCAN_STATS         "scan_stats"    /* not stored on disk */
+#define        ZPOOL_CONFIG_REMOVAL_STATS      "removal_stats" /* not stored on disk */
+#define        ZPOOL_CONFIG_CHECKPOINT_STATS   "checkpoint_stats" /* not on disk */
 #define        ZPOOL_CONFIG_VDEV_STATS         "vdev_stats"    /* not stored on disk */
+#define        ZPOOL_CONFIG_INDIRECT_SIZE      "indirect_size" /* not stored on disk */
 
 /* container nvlist of extended stats */
 #define        ZPOOL_CONFIG_VDEV_STATS_EX      "vdev_stats_ex"
@@ -677,6 +693,7 @@ typedef struct zpool_rewind_policy {
 #define        ZPOOL_CONFIG_RESILVER_TXG       "resilver_txg"
 #define        ZPOOL_CONFIG_COMMENT            "comment"
 #define        ZPOOL_CONFIG_SUSPENDED          "suspended"     /* not stored on disk */
+#define        ZPOOL_CONFIG_SUSPENDED_REASON   "suspended_reason"      /* not stored */
 #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 */
@@ -691,6 +708,7 @@ typedef struct zpool_rewind_policy {
 #define        ZPOOL_CONFIG_VDEV_TOP_ZAP       "com.delphix:vdev_zap_top"
 #define        ZPOOL_CONFIG_VDEV_LEAF_ZAP      "com.delphix:vdev_zap_leaf"
 #define        ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS  "com.delphix:has_per_vdev_zaps"
+#define        ZPOOL_CONFIG_CACHEFILE          "cachefile"     /* not stored on disk */
 #define        ZPOOL_CONFIG_MMP_STATE          "mmp_state"     /* not stored on disk */
 #define        ZPOOL_CONFIG_MMP_TXG            "mmp_txg"       /* not stored on disk */
 #define        ZPOOL_CONFIG_MMP_HOSTNAME       "mmp_hostname"  /* not stored on disk */
@@ -708,12 +726,12 @@ typedef struct zpool_rewind_policy {
 #define        ZPOOL_CONFIG_FRU                "fru"
 #define        ZPOOL_CONFIG_AUX_STATE          "aux_state"
 
-/* Rewind policy parameters */
-#define        ZPOOL_REWIND_POLICY             "rewind-policy"
-#define        ZPOOL_REWIND_REQUEST            "rewind-request"
-#define        ZPOOL_REWIND_REQUEST_TXG        "rewind-request-txg"
-#define        ZPOOL_REWIND_META_THRESH        "rewind-meta-thresh"
-#define        ZPOOL_REWIND_DATA_THRESH        "rewind-data-thresh"
+/* Pool load policy parameters */
+#define        ZPOOL_LOAD_POLICY               "load-policy"
+#define        ZPOOL_LOAD_REWIND_POLICY        "load-rewind-policy"
+#define        ZPOOL_LOAD_REQUEST_TXG          "load-request-txg"
+#define        ZPOOL_LOAD_META_THRESH          "load-meta-thresh"
+#define        ZPOOL_LOAD_DATA_THRESH          "load-data-thresh"
 
 /* Rewind data discovered */
 #define        ZPOOL_CONFIG_LOAD_TIME          "rewind_txg_ts"
@@ -731,6 +749,15 @@ typedef struct zpool_rewind_policy {
 #define        VDEV_TYPE_SPARE                 "spare"
 #define        VDEV_TYPE_LOG                   "log"
 #define        VDEV_TYPE_L2CACHE               "l2cache"
+#define        VDEV_TYPE_INDIRECT              "indirect"
+
+/* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
+#define        VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
+       "com.delphix:indirect_obsolete_sm"
+#define        VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
+       "com.delphix:obsolete_counts_are_precise"
+#define        VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \
+       "com.delphix:pool_checkpoint_sm"
 
 /*
  * This is needed in userland to report the minimum necessary device size.
@@ -791,6 +818,7 @@ typedef enum vdev_aux {
        VDEV_AUX_BAD_ASHIFT,    /* vdev ashift is invalid               */
        VDEV_AUX_EXTERNAL_PERSIST,      /* persistent forced fault      */
        VDEV_AUX_ACTIVE,        /* vdev active on a different host      */
+       VDEV_AUX_CHILDREN_OFFLINE, /* all children are offline          */
 } vdev_aux_t;
 
 /*
@@ -839,6 +867,18 @@ typedef enum pool_scrub_cmd {
        POOL_SCRUB_FLAGS_END
 } pool_scrub_cmd_t;
 
+typedef enum {
+       CS_NONE,
+       CS_CHECKPOINT_EXISTS,
+       CS_CHECKPOINT_DISCARDING,
+       CS_NUM_STATES
+} checkpoint_state_t;
+
+typedef struct pool_checkpoint_stat {
+       uint64_t pcs_state;             /* checkpoint_state_t */
+       uint64_t pcs_start_time;        /* time checkpoint/discard started */
+       uint64_t pcs_space;             /* checkpointed space */
+} pool_checkpoint_stat_t;
 
 /*
  * ZIO types.  Needed to interpret vdev statistics below.
@@ -879,6 +919,20 @@ typedef struct pool_scan_stat {
        uint64_t        pss_issued;     /* total bytes checked by scanner */
 } pool_scan_stat_t;
 
+typedef struct pool_removal_stat {
+       uint64_t prs_state; /* dsl_scan_state_t */
+       uint64_t prs_removing_vdev;
+       uint64_t prs_start_time;
+       uint64_t prs_end_time;
+       uint64_t prs_to_copy; /* bytes that need to be copied */
+       uint64_t prs_copied; /* bytes copied so far */
+       /*
+        * bytes of memory used for indirect mappings.
+        * This includes all removed vdevs.
+        */
+       uint64_t prs_mapping_memory;
+} pool_removal_stat_t;
+
 typedef enum dsl_scan_state {
        DSS_NONE,
        DSS_SCANNING,
@@ -922,7 +976,7 @@ typedef struct vdev_stat {
        uint64_t        vs_scan_removing;       /* removing?    */
        uint64_t        vs_scan_processed;      /* scan processed bytes */
        uint64_t        vs_fragmentation;       /* device fragmentation */
-
+       uint64_t        vs_checkpoint_space;    /* checkpoint-consumed space */
 } vdev_stat_t;
 
 /*
@@ -1107,6 +1161,9 @@ typedef enum zfs_ioc {
        ZFS_IOC_LOAD_KEY,
        ZFS_IOC_UNLOAD_KEY,
        ZFS_IOC_CHANGE_KEY,
+       ZFS_IOC_REMAP,
+       ZFS_IOC_POOL_CHECKPOINT,
+       ZFS_IOC_POOL_DISCARD_CHECKPOINT,
 
        /*
         * Linux - 3/64 numbers reserved.
@@ -1129,6 +1186,22 @@ typedef enum zfs_ioc {
  */
 #define        BLKZNAME                _IOR(0x12, 125, char[ZFS_MAX_DATASET_NAME_LEN])
 
+/*
+ * ZFS-specific error codes used for returning descriptive errors
+ * to the userland through zfs ioctls.
+ *
+ * The enum implicitly includes all the error codes from errno.h.
+ * New code should use and extend this enum for errors that are
+ * not described precisely by generic errno codes.
+ */
+typedef enum {
+       ZFS_ERR_CHECKPOINT_EXISTS = 1024,
+       ZFS_ERR_DISCARDING_CHECKPOINT,
+       ZFS_ERR_NO_CHECKPOINT,
+       ZFS_ERR_DEVRM_IN_PROGRESS,
+       ZFS_ERR_VDEV_TOO_BIG
+} zfs_errno_t;
+
 /*
  * Internal SPA load state.  Used by FMA diagnosis engine.
  */
@@ -1198,12 +1271,14 @@ typedef enum {
 #define        ZFS_IMPORT_TEMP_NAME    0x10
 #define        ZFS_IMPORT_SKIP_MMP     0x20
 #define        ZFS_IMPORT_LOAD_KEYS    0x40
+#define        ZFS_IMPORT_CHECKPOINT   0x80
 
 /*
  * Channel program argument/return nvlist keys and defaults.
  */
 #define        ZCP_ARG_PROGRAM         "program"
 #define        ZCP_ARG_ARGLIST         "arg"
+#define        ZCP_ARG_SYNC            "sync"
 #define        ZCP_ARG_INSTRLIMIT      "instrlimit"
 #define        ZCP_ARG_MEMLIMIT        "memlimit"