comparison usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h @ 11007:216d8396182e

PSARC/2009/557 ZFS send dedup 6812638 zfs send intra-stream dedup 6887817 want snapshot filtering for zfs send 6812603 zfs send can aggregate free records
author Lori Alt <Lori.Alt@Sun.COM>
date Mon, 09 Nov 2009 11:04:55 -0700
parents 8aac17999e4d
children 462283cb4096
comparison
equal deleted inserted replaced
11006:4fe66eb82610 11007:216d8396182e
28 28
29 #include <sys/cred.h> 29 #include <sys/cred.h>
30 #include <sys/dmu.h> 30 #include <sys/dmu.h>
31 #include <sys/zio.h> 31 #include <sys/zio.h>
32 #include <sys/dsl_deleg.h> 32 #include <sys/dsl_deleg.h>
33 #include <sys/spa.h>
33 34
34 #ifdef _KERNEL 35 #ifdef _KERNEL
35 #include <sys/nvpair.h> 36 #include <sys/nvpair.h>
36 #endif /* _KERNEL */ 37 #endif /* _KERNEL */
37 38
43 * Property values for snapdir 44 * Property values for snapdir
44 */ 45 */
45 #define ZFS_SNAPDIR_HIDDEN 0 46 #define ZFS_SNAPDIR_HIDDEN 0
46 #define ZFS_SNAPDIR_VISIBLE 1 47 #define ZFS_SNAPDIR_VISIBLE 1
47 48
48 #define DMU_BACKUP_STREAM_VERSION (1ULL) 49 /*
49 #define DMU_BACKUP_HEADER_VERSION (2ULL) 50 * Field manipulation macros for the drr_versioninfo field of the
51 * send stream header.
52 */
53
54 /*
55 * Header types for zfs send streams.
56 */
57 typedef enum drr_headertype {
58 DMU_SUBSTREAM = 0x1,
59 DMU_COMPOUNDSTREAM = 0x2
60 } drr_headertype_t;
61
62 #define DMU_GET_STREAM_HDRTYPE(vi) BF64_GET((vi), 0, 2)
63 #define DMU_SET_STREAM_HDRTYPE(vi, x) BF64_SET((vi), 0, 2, x)
64
65 #define DMU_GET_FEATUREFLAGS(vi) BF64_GET((vi), 2, 30)
66 #define DMU_SET_FEATUREFLAGS(vi, x) BF64_SET((vi), 2, 30, x)
67
68 /*
69 * Feature flags for zfs send streams (flags in drr_versioninfo)
70 */
71
72 #define DMU_BACKUP_FEATURE_DEDUP (0x1)
73
74 /*
75 * Mask of all supported backup features
76 */
77 #define DMU_BACKUP_FEATURE_MASK (DMU_BACKUP_FEATURE_DEDUP)
78
79 /* Are all features in the given flag word currently supported? */
80 #define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))
81
82 /*
83 * The drr_versioninfo field of the dmu_replay_record has the
84 * following layout:
85 *
86 * 64 56 48 40 32 24 16 8 0
87 * +-------+-------+-------+-------+-------+-------+-------+-------+
88 * | reserved | feature-flags |C|S|
89 * +-------+-------+-------+-------+-------+-------+-------+-------+
90 *
91 * The low order two bits indicate the header type: SUBSTREAM (0x1)
92 * or COMPOUNDSTREAM (0x2). Using two bits for this is historical:
93 * this field used to be a version number, where the two version types
94 * were 1 and 2. Using two bits for this allows earlier versions of
95 * the code to be able to recognize send streams that don't use any
96 * of the features indicated by feature flags.
97 */
98
50 #define DMU_BACKUP_MAGIC 0x2F5bacbacULL 99 #define DMU_BACKUP_MAGIC 0x2F5bacbacULL
51 100
52 #define DRR_FLAG_CLONE (1<<0) 101 #define DRR_FLAG_CLONE (1<<0)
53 #define DRR_FLAG_CI_DATA (1<<1) 102 #define DRR_FLAG_CI_DATA (1<<1)
54 103
56 * zfs ioctl command structure 105 * zfs ioctl command structure
57 */ 106 */
58 typedef struct dmu_replay_record { 107 typedef struct dmu_replay_record {
59 enum { 108 enum {
60 DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, 109 DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
61 DRR_WRITE, DRR_FREE, DRR_END, DRR_NUMTYPES 110 DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF,
111 DRR_NUMTYPES
62 } drr_type; 112 } drr_type;
63 uint32_t drr_payloadlen; 113 uint32_t drr_payloadlen;
64 union { 114 union {
65 struct drr_begin { 115 struct drr_begin {
66 uint64_t drr_magic; 116 uint64_t drr_magic;
67 uint64_t drr_version; 117 uint64_t drr_versioninfo; /* was drr_version */
68 uint64_t drr_creation_time; 118 uint64_t drr_creation_time;
69 dmu_objset_type_t drr_type; 119 dmu_objset_type_t drr_type;
70 uint32_t drr_flags; 120 uint32_t drr_flags;
71 uint64_t drr_toguid; 121 uint64_t drr_toguid;
72 uint64_t drr_fromguid; 122 uint64_t drr_fromguid;
73 char drr_toname[MAXNAMELEN]; 123 char drr_toname[MAXNAMELEN];
74 } drr_begin; 124 } drr_begin;
75 struct drr_end { 125 struct drr_end {
76 zio_cksum_t drr_checksum; 126 zio_cksum_t drr_checksum;
127 uint64_t drr_toguid;
77 } drr_end; 128 } drr_end;
78 struct drr_object { 129 struct drr_object {
79 uint64_t drr_object; 130 uint64_t drr_object;
80 dmu_object_type_t drr_type; 131 dmu_object_type_t drr_type;
81 dmu_object_type_t drr_bonustype; 132 dmu_object_type_t drr_bonustype;
82 uint32_t drr_blksz; 133 uint32_t drr_blksz;
83 uint32_t drr_bonuslen; 134 uint32_t drr_bonuslen;
84 uint8_t drr_checksum; 135 uint8_t drr_checksumtype;
85 uint8_t drr_compress; 136 uint8_t drr_compress;
86 uint8_t drr_pad[6]; 137 uint8_t drr_pad[6];
138 uint64_t drr_toguid;
87 /* bonus content follows */ 139 /* bonus content follows */
88 } drr_object; 140 } drr_object;
89 struct drr_freeobjects { 141 struct drr_freeobjects {
90 uint64_t drr_firstobj; 142 uint64_t drr_firstobj;
91 uint64_t drr_numobjs; 143 uint64_t drr_numobjs;
144 uint64_t drr_toguid;
92 } drr_freeobjects; 145 } drr_freeobjects;
93 struct drr_write { 146 struct drr_write {
94 uint64_t drr_object; 147 uint64_t drr_object;
95 dmu_object_type_t drr_type; 148 dmu_object_type_t drr_type;
96 uint32_t drr_pad; 149 uint32_t drr_pad;
97 uint64_t drr_offset; 150 uint64_t drr_offset;
98 uint64_t drr_length; 151 uint64_t drr_length;
152 uint64_t drr_toguid;
153 uint8_t drr_checksumtype;
154 uint8_t drr_pad2[7];
155 zio_cksum_t drr_blkcksum;
99 /* content follows */ 156 /* content follows */
100 } drr_write; 157 } drr_write;
101 struct drr_free { 158 struct drr_free {
102 uint64_t drr_object; 159 uint64_t drr_object;
103 uint64_t drr_offset; 160 uint64_t drr_offset;
104 uint64_t drr_length; 161 uint64_t drr_length;
162 uint64_t drr_toguid;
105 } drr_free; 163 } drr_free;
164 struct drr_write_byref {
165 /* where to put the data */
166 uint64_t drr_object;
167 uint64_t drr_offset;
168 uint64_t drr_length;
169 uint64_t drr_toguid;
170 /* where to find the prior copy of the data */
171 uint64_t drr_refguid;
172 uint64_t drr_refobject;
173 uint64_t drr_refoffset;
174 uint8_t drr_checksumtype;
175 uint8_t drr_pad[7];
176 zio_cksum_t drr_blkcksum;
177 } drr_write_byref;
106 } drr_u; 178 } drr_u;
107 } dmu_replay_record_t; 179 } dmu_replay_record_t;
108 180
109 typedef struct zinject_record { 181 typedef struct zinject_record {
110 uint64_t zi_objset; 182 uint64_t zi_objset;
148 220
149 typedef struct zfs_cmd { 221 typedef struct zfs_cmd {
150 char zc_name[MAXPATHLEN]; 222 char zc_name[MAXPATHLEN];
151 char zc_value[MAXPATHLEN * 2]; 223 char zc_value[MAXPATHLEN * 2];
152 char zc_string[MAXNAMELEN]; 224 char zc_string[MAXNAMELEN];
225 char zc_top_ds[MAXPATHLEN];
153 uint64_t zc_guid; 226 uint64_t zc_guid;
154 uint64_t zc_nvlist_conf; /* really (char *) */ 227 uint64_t zc_nvlist_conf; /* really (char *) */
155 uint64_t zc_nvlist_conf_size; 228 uint64_t zc_nvlist_conf_size;
156 uint64_t zc_nvlist_src; /* really (char *) */ 229 uint64_t zc_nvlist_src; /* really (char *) */
157 uint64_t zc_nvlist_src_size; 230 uint64_t zc_nvlist_src_size;