]> git.proxmox.com Git - mirror_zfs.git/blobdiff - include/sys/zfs_ioctl.h
OpenZFS 6531 - Provide mechanism to artificially limit disk performance
[mirror_zfs.git] / include / sys / zfs_ioctl.h
index 21bfe2b8f9b0510048c5abe912bc4eccbe9162c8..ac70f690ebc56088c2ad4ea7dacc95733fecb2eb 100644 (file)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 #ifndef        _SYS_ZFS_IOCTL_H
@@ -61,6 +61,11 @@ extern "C" {
  */
 #define        ZFS_SNAPDEV_HIDDEN              0
 #define        ZFS_SNAPDEV_VISIBLE             1
+/*
+ * Property values for acltype
+ */
+#define        ZFS_ACLTYPE_OFF                 0
+#define        ZFS_ACLTYPE_POSIXACL            1
 
 /*
  * Field manipulation macros for the drr_versioninfo field of the
@@ -85,15 +90,22 @@ typedef enum drr_headertype {
  * Feature flags for zfs send streams (flags in drr_versioninfo)
  */
 
-#define        DMU_BACKUP_FEATURE_DEDUP        (0x1)
-#define        DMU_BACKUP_FEATURE_DEDUPPROPS   (0x2)
-#define        DMU_BACKUP_FEATURE_SA_SPILL     (0x4)
+#define        DMU_BACKUP_FEATURE_DEDUP                (1<<0)
+#define        DMU_BACKUP_FEATURE_DEDUPPROPS           (1<<1)
+#define        DMU_BACKUP_FEATURE_SA_SPILL             (1<<2)
+/* flags #3 - #15 are reserved for incompatible closed-source implementations */
+#define        DMU_BACKUP_FEATURE_EMBED_DATA           (1<<16)
+#define        DMU_BACKUP_FEATURE_EMBED_DATA_LZ4       (1<<17)
+/* flag #18 is reserved for a Delphix feature */
+#define        DMU_BACKUP_FEATURE_LARGE_BLOCKS         (1<<19)
 
 /*
  * Mask of all supported backup features
  */
 #define        DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP | \
-               DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL)
+    DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL | \
+    DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 | \
+    DMU_BACKUP_FEATURE_LARGE_BLOCKS)
 
 /* Are all features in the given flag word currently supported? */
 #define        DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))
@@ -135,7 +147,7 @@ typedef struct dmu_replay_record {
        enum {
                DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
                DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF,
-               DRR_SPILL, DRR_NUMTYPES
+               DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_NUMTYPES
        } drr_type;
        uint32_t drr_payloadlen;
        union {
@@ -212,6 +224,35 @@ typedef struct dmu_replay_record {
                        uint64_t drr_pad[4]; /* needed for crypto */
                        /* spill data follows */
                } drr_spill;
+               struct drr_write_embedded {
+                       uint64_t drr_object;
+                       uint64_t drr_offset;
+                       /* logical length, should equal blocksize */
+                       uint64_t drr_length;
+                       uint64_t drr_toguid;
+                       uint8_t drr_compression;
+                       uint8_t drr_etype;
+                       uint8_t drr_pad[6];
+                       uint32_t drr_lsize; /* uncompressed size of payload */
+                       uint32_t drr_psize; /* compr. (real) size of payload */
+                       /* (possibly compressed) content follows */
+               } drr_write_embedded;
+
+               /*
+                * Nore: drr_checksum is overlaid with all record types
+                * except DRR_BEGIN.  Therefore its (non-pad) members
+                * must not overlap with members from the other structs.
+                * We accomplish this by putting its members at the very
+                * end of the struct.
+                */
+               struct drr_checksum {
+                       uint64_t drr_pad[34];
+                       /*
+                        * fletcher-4 checksum of everything preceding the
+                        * checksum.
+                        */
+                       zio_cksum_t drr_checksum;
+               } drr_checksum;
        } drr_u;
 } dmu_replay_record_t;
 
@@ -246,6 +287,7 @@ typedef struct zinject_record {
        uint32_t        zi_iotype;
        int32_t         zi_duration;
        uint64_t        zi_timer;
+       uint64_t        zi_nlanes;
        uint32_t        zi_cmd;
        uint32_t        zi_pad;
 } zinject_record_t;
@@ -254,9 +296,13 @@ typedef struct zinject_record {
 #define        ZINJECT_FLUSH_ARC       0x2
 #define        ZINJECT_UNLOAD_SPA      0x4
 
+#define        ZEVENT_NONE             0x0
 #define        ZEVENT_NONBLOCK         0x1
 #define        ZEVENT_SIZE             1024
 
+#define        ZEVENT_SEEK_START       0
+#define        ZEVENT_SEEK_END         UINT64_MAX
+
 typedef enum zinject_type {
        ZINJECT_UNINITIALIZED,
        ZINJECT_DATA_FAULT,
@@ -302,7 +348,6 @@ typedef struct zfs_cmd {
        uint64_t        zc_history;             /* really (char *) */
        char            zc_value[MAXPATHLEN * 2];
        char            zc_string[MAXNAMELEN];
-       char            zc_top_ds[MAXPATHLEN];
        uint64_t        zc_guid;
        uint64_t        zc_nvlist_conf;         /* really (char *) */
        uint64_t        zc_nvlist_conf_size;
@@ -317,8 +362,8 @@ typedef struct zfs_cmd {
        dmu_objset_stats_t zc_objset_stats;
        struct drr_begin zc_begin_record;
        zinject_record_t zc_inject_record;
-       boolean_t       zc_defer_destroy;
-       boolean_t       zc_temphold;
+       uint32_t        zc_defer_destroy;
+       uint32_t        zc_flags;
        uint64_t        zc_action_handle;
        int             zc_cleanup_fd;
        uint8_t         zc_simple;
@@ -352,7 +397,10 @@ extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
 extern int zfs_secpolicy_rename_perms(const char *from,
     const char *to, cred_t *cr);
 extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
-extern int zfs_unmount_snap(const char *, void *);
+extern int zfs_unmount_snap(const char *);
+extern void zfs_destroy_unmount_origin(const char *);
+
+extern boolean_t dataset_name_hidden(const char *name);
 
 enum zfsdev_state_type {
        ZST_ONEXIT,
@@ -360,8 +408,15 @@ enum zfsdev_state_type {
        ZST_ALL,
 };
 
+/*
+ * The zfsdev_state_t structure is managed as a singly-linked list
+ * from which items are never deleted.  This allows for lock-free
+ * reading of the list so long as assignments to the zs_next and
+ * reads from zs_minor are performed atomically.  Empty items are
+ * indicated by storing -1 into zs_minor.
+ */
 typedef struct zfsdev_state {
-        list_node_t             zs_next;        /* next zfsdev_state_t link */
+       struct zfsdev_state     *zs_next;       /* next zfsdev_state_t link */
        struct file             *zs_file;       /* associated file struct */
        minor_t                 zs_minor;       /* made up minor number */
        void                    *zs_onexit;     /* onexit data */
@@ -369,7 +424,7 @@ typedef struct zfsdev_state {
 } zfsdev_state_t;
 
 extern void *zfsdev_get_state(minor_t minor, enum zfsdev_state_type which);
-extern minor_t zfsdev_getminor(struct file *filp);
+extern int zfsdev_getminor(struct file *filp, minor_t *minorp);
 extern minor_t zfsdev_minor_alloc(void);
 
 #endif /* _KERNEL */