]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/fs/zfs.h
Fix send/recv lost spill block
[mirror_zfs.git] / include / sys / fs / zfs.h
index e49a58f43a2880c4ada5e884d1305c1b723b1963..3bcefdbfd775cacf52d0abdcd7070f206cce186c 100644 (file)
@@ -244,6 +244,7 @@ typedef enum {
        ZPOOL_PROP_MULTIHOST,
        ZPOOL_PROP_CHECKPOINT,
        ZPOOL_PROP_LOAD_GUID,
+       ZPOOL_PROP_AUTOTRIM,
        ZPOOL_NUM_PROPS
 } zpool_prop_t;
 
@@ -488,10 +489,8 @@ typedef enum zfs_key_location {
 #define        SPA_VERSION_5000                5000ULL
 
 /*
- * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
- * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
- * and do the appropriate changes.  Also bump the version number in
- * usr/src/grub/capability.
+ * The incrementing pool version number has been replaced by pool feature
+ * flags.  For more details, see zfeature.c.
  */
 #define        SPA_VERSION                     SPA_VERSION_5000
 #define        SPA_VERSION_STRING              "5000"
@@ -556,9 +555,6 @@ typedef enum zfs_key_location {
  * ZPL version - rev'd whenever an incompatible on-disk format change
  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
  * also update the version_table[] and help message in zfs_prop.c.
- *
- * When changing, be sure to teach GRUB how to read the new format!
- * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
  */
 #define        ZPL_VERSION_1                   1ULL
 #define        ZPL_VERSION_2                   2ULL
@@ -635,6 +631,7 @@ typedef struct zpool_load_policy {
 #define        ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE  "vdev_async_r_active_queue"
 #define        ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE  "vdev_async_w_active_queue"
 #define        ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE    "vdev_async_scrub_active_queue"
+#define        ZPOOL_CONFIG_VDEV_TRIM_ACTIVE_QUEUE     "vdev_async_trim_active_queue"
 
 /* Queue sizes */
 #define        ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE     "vdev_sync_r_pend_queue"
@@ -642,6 +639,7 @@ typedef struct zpool_load_policy {
 #define        ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE    "vdev_async_r_pend_queue"
 #define        ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE    "vdev_async_w_pend_queue"
 #define        ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE      "vdev_async_scrub_pend_queue"
+#define        ZPOOL_CONFIG_VDEV_TRIM_PEND_QUEUE       "vdev_async_trim_pend_queue"
 
 /* Latency read/write histogram stats */
 #define        ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO       "vdev_tot_r_lat_histo"
@@ -653,6 +651,7 @@ typedef struct zpool_load_policy {
 #define        ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO     "vdev_async_r_lat_histo"
 #define        ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO     "vdev_async_w_lat_histo"
 #define        ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO       "vdev_scrub_histo"
+#define        ZPOOL_CONFIG_VDEV_TRIM_LAT_HISTO        "vdev_trim_histo"
 
 /* Request size histograms */
 #define        ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO      "vdev_sync_ind_r_histo"
@@ -660,11 +659,13 @@ typedef struct zpool_load_policy {
 #define        ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO     "vdev_async_ind_r_histo"
 #define        ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO     "vdev_async_ind_w_histo"
 #define        ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO       "vdev_ind_scrub_histo"
+#define        ZPOOL_CONFIG_VDEV_IND_TRIM_HISTO        "vdev_ind_trim_histo"
 #define        ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO      "vdev_sync_agg_r_histo"
 #define        ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO      "vdev_sync_agg_w_histo"
 #define        ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO     "vdev_async_agg_r_histo"
 #define        ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO     "vdev_async_agg_w_histo"
 #define        ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO       "vdev_agg_scrub_histo"
+#define        ZPOOL_CONFIG_VDEV_AGG_TRIM_HISTO        "vdev_agg_trim_histo"
 
 /* Number of slow IOs */
 #define        ZPOOL_CONFIG_VDEV_SLOW_IOS              "vdev_slow_ios"
@@ -777,6 +778,7 @@ typedef struct zpool_load_policy {
 #define        VDEV_ALLOC_BIAS_SPECIAL         "special"
 #define        VDEV_ALLOC_BIAS_DEDUP           "dedup"
 
+/* vdev initialize state */
 #define        VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET    \
        "com.delphix:next_offset_to_initialize"
 #define        VDEV_LEAF_ZAP_INITIALIZE_STATE  \
@@ -784,6 +786,20 @@ typedef struct zpool_load_policy {
 #define        VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME    \
        "com.delphix:vdev_initialize_action_time"
 
+/* vdev TRIM state */
+#define        VDEV_LEAF_ZAP_TRIM_LAST_OFFSET  \
+       "org.zfsonlinux:next_offset_to_trim"
+#define        VDEV_LEAF_ZAP_TRIM_STATE        \
+       "org.zfsonlinux:vdev_trim_state"
+#define        VDEV_LEAF_ZAP_TRIM_ACTION_TIME  \
+       "org.zfsonlinux:vdev_trim_action_time"
+#define        VDEV_LEAF_ZAP_TRIM_RATE         \
+       "org.zfsonlinux:vdev_trim_rate"
+#define        VDEV_LEAF_ZAP_TRIM_PARTIAL      \
+       "org.zfsonlinux:vdev_trim_partial"
+#define        VDEV_LEAF_ZAP_TRIM_SECURE       \
+       "org.zfsonlinux:vdev_trim_secure"
+
 /*
  * This is needed in userland to report the minimum necessary device size.
  */
@@ -915,6 +931,7 @@ typedef enum zio_type {
        ZIO_TYPE_FREE,
        ZIO_TYPE_CLAIM,
        ZIO_TYPE_IOCTL,
+       ZIO_TYPE_TRIM,
        ZIO_TYPES
 } zio_type_t;
 
@@ -982,8 +999,14 @@ typedef enum zpool_errata {
 
 /*
  * Vdev statistics.  Note: all fields should be 64-bit because this
- * is passed between kernel and userland as an nvlist uint64 array.
+ * is passed between kernel and user land as an nvlist uint64 array.
+ *
+ * The vs_ops[] and vs_bytes[] arrays must always be an array size of 6 in
+ * order to keep subsequent members at their known fixed offsets.  When
+ * adding a new field it must be added to the end the structure.
  */
+#define        VS_ZIO_TYPES    6
+
 typedef struct vdev_stat {
        hrtime_t        vs_timestamp;           /* time since vdev load */
        uint64_t        vs_state;               /* vdev state           */
@@ -993,8 +1016,8 @@ typedef struct vdev_stat {
        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_ops[VS_ZIO_TYPES];   /* operation count      */
+       uint64_t        vs_bytes[VS_ZIO_TYPES]; /* bytes read/written   */
        uint64_t        vs_read_errors;         /* read errors          */
        uint64_t        vs_write_errors;        /* write errors         */
        uint64_t        vs_checksum_errors;     /* checksum errors      */
@@ -1010,6 +1033,12 @@ typedef struct vdev_stat {
        uint64_t        vs_checkpoint_space;    /* checkpoint-consumed space */
        uint64_t        vs_resilver_deferred;   /* resilver deferred    */
        uint64_t        vs_slow_ios;            /* slow IOs */
+       uint64_t        vs_trim_errors;         /* trimming errors      */
+       uint64_t        vs_trim_notsup;         /* supported by device */
+       uint64_t        vs_trim_bytes_done;     /* bytes trimmed */
+       uint64_t        vs_trim_bytes_est;      /* total bytes to trim */
+       uint64_t        vs_trim_state;          /* vdev_trim_state_t */
+       uint64_t        vs_trim_action_time;    /* time_t */
 } vdev_stat_t;
 
 /*
@@ -1068,12 +1097,22 @@ typedef struct vdev_stat_ex {
  * Initialize functions.
  */
 typedef enum pool_initialize_func {
-       POOL_INITIALIZE_DO,
+       POOL_INITIALIZE_START,
        POOL_INITIALIZE_CANCEL,
        POOL_INITIALIZE_SUSPEND,
        POOL_INITIALIZE_FUNCS
 } pool_initialize_func_t;
 
+/*
+ * TRIM functions.
+ */
+typedef enum pool_trim_func {
+       POOL_TRIM_START,
+       POOL_TRIM_CANCEL,
+       POOL_TRIM_SUSPEND,
+       POOL_TRIM_FUNCS
+} pool_trim_func_t;
+
 /*
  * DDT statistics.  Note: all fields should be 64-bit because this
  * is passed between kernel and userland as an nvlist uint64 array.
@@ -1126,6 +1165,14 @@ typedef enum {
        VDEV_INITIALIZE_COMPLETE
 } vdev_initializing_state_t;
 
+typedef enum {
+       VDEV_TRIM_NONE,
+       VDEV_TRIM_ACTIVE,
+       VDEV_TRIM_CANCELED,
+       VDEV_TRIM_SUSPENDED,
+       VDEV_TRIM_COMPLETE,
+} vdev_trim_state_t;
+
 /*
  * nvlist name constants. Facilitate restricting snapshot iteration range for
  * the "list next snapshot" ioctl
@@ -1140,7 +1187,7 @@ typedef enum {
  */
 typedef enum zfs_ioc {
        /*
-        * Illumos - 71/128 numbers reserved.
+        * illumos - 81/128 numbers reserved.
         */
        ZFS_IOC_FIRST = ('Z' << 8),
        ZFS_IOC = ZFS_IOC_FIRST,
@@ -1224,6 +1271,7 @@ typedef enum zfs_ioc {
        ZFS_IOC_POOL_CHECKPOINT,                /* 0x5a4d */
        ZFS_IOC_POOL_DISCARD_CHECKPOINT,        /* 0x5a4e */
        ZFS_IOC_POOL_INITIALIZE,                /* 0x5a4f */
+       ZFS_IOC_POOL_TRIM,                      /* 0x5a50 */
 
        /*
         * Linux - 3/64 numbers reserved.
@@ -1269,6 +1317,7 @@ typedef enum {
        ZFS_ERR_WRONG_PARENT,
        ZFS_ERR_FROM_IVSET_GUID_MISSING,
        ZFS_ERR_FROM_IVSET_GUID_MISMATCH,
+       ZFS_ERR_SPILL_BLOCK_FLAG_MISSING,
 } zfs_errno_t;
 
 /*
@@ -1326,6 +1375,14 @@ typedef enum {
 #define        ZPOOL_INITIALIZE_COMMAND        "initialize_command"
 #define        ZPOOL_INITIALIZE_VDEVS          "initialize_vdevs"
 
+/*
+ * The following are names used when invoking ZFS_IOC_POOL_TRIM.
+ */
+#define        ZPOOL_TRIM_COMMAND              "trim_command"
+#define        ZPOOL_TRIM_VDEVS                "trim_vdevs"
+#define        ZPOOL_TRIM_RATE                 "trim_rate"
+#define        ZPOOL_TRIM_SECURE               "trim_secure"
+
 /*
  * Flags for ZFS_IOC_VDEV_SET_STATE
  */