blob: 2a9178d3aebf4e3770696423df95b45d623847b2 [file] [log] [blame]
Christopher Ferris106b3a82016-08-24 12:15:38 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _BTRFS_CTREE_H_
20#define _BTRFS_CTREE_H_
Christopher Ferris525ce912017-07-26 13:12:53 -070021#include <linux/btrfs.h>
22#include <linux/types.h>
Christopher Ferris32ff3f82020-12-14 13:10:04 -080023#include <stddef.h>
Christopher Ferris106b3a82016-08-24 12:15:38 -070024#define BTRFS_ROOT_TREE_OBJECTID 1ULL
25#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070026#define BTRFS_CHUNK_TREE_OBJECTID 3ULL
27#define BTRFS_DEV_TREE_OBJECTID 4ULL
28#define BTRFS_FS_TREE_OBJECTID 5ULL
29#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070030#define BTRFS_CSUM_TREE_OBJECTID 7ULL
31#define BTRFS_QUOTA_TREE_OBJECTID 8ULL
32#define BTRFS_UUID_TREE_OBJECTID 9ULL
33#define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070034#define BTRFS_DEV_STATS_OBJECTID 0ULL
35#define BTRFS_BALANCE_OBJECTID - 4ULL
36#define BTRFS_ORPHAN_OBJECTID - 5ULL
37#define BTRFS_TREE_LOG_OBJECTID - 6ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070038#define BTRFS_TREE_LOG_FIXUP_OBJECTID - 7ULL
39#define BTRFS_TREE_RELOC_OBJECTID - 8ULL
40#define BTRFS_DATA_RELOC_TREE_OBJECTID - 9ULL
41#define BTRFS_EXTENT_CSUM_OBJECTID - 10ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070042#define BTRFS_FREE_SPACE_OBJECTID - 11ULL
43#define BTRFS_FREE_INO_OBJECTID - 12ULL
44#define BTRFS_MULTIPLE_OBJECTIDS - 255ULL
45#define BTRFS_FIRST_FREE_OBJECTID 256ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070046#define BTRFS_LAST_FREE_OBJECTID - 256ULL
47#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
48#define BTRFS_DEV_ITEMS_OBJECTID 1ULL
49#define BTRFS_BTREE_INODE_OBJECTID 1
Christopher Ferris106b3a82016-08-24 12:15:38 -070050#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2
51#define BTRFS_DEV_REPLACE_DEVID 0ULL
52#define BTRFS_INODE_ITEM_KEY 1
53#define BTRFS_INODE_REF_KEY 12
Christopher Ferris106b3a82016-08-24 12:15:38 -070054#define BTRFS_INODE_EXTREF_KEY 13
55#define BTRFS_XATTR_ITEM_KEY 24
56#define BTRFS_ORPHAN_ITEM_KEY 48
57#define BTRFS_DIR_LOG_ITEM_KEY 60
Christopher Ferris106b3a82016-08-24 12:15:38 -070058#define BTRFS_DIR_LOG_INDEX_KEY 72
59#define BTRFS_DIR_ITEM_KEY 84
60#define BTRFS_DIR_INDEX_KEY 96
61#define BTRFS_EXTENT_DATA_KEY 108
Christopher Ferris106b3a82016-08-24 12:15:38 -070062#define BTRFS_EXTENT_CSUM_KEY 128
63#define BTRFS_ROOT_ITEM_KEY 132
64#define BTRFS_ROOT_BACKREF_KEY 144
65#define BTRFS_ROOT_REF_KEY 156
Christopher Ferris106b3a82016-08-24 12:15:38 -070066#define BTRFS_EXTENT_ITEM_KEY 168
67#define BTRFS_METADATA_ITEM_KEY 169
68#define BTRFS_TREE_BLOCK_REF_KEY 176
69#define BTRFS_EXTENT_DATA_REF_KEY 178
Christopher Ferris106b3a82016-08-24 12:15:38 -070070#define BTRFS_EXTENT_REF_V0_KEY 180
71#define BTRFS_SHARED_BLOCK_REF_KEY 182
72#define BTRFS_SHARED_DATA_REF_KEY 184
73#define BTRFS_BLOCK_GROUP_ITEM_KEY 192
Christopher Ferris106b3a82016-08-24 12:15:38 -070074#define BTRFS_FREE_SPACE_INFO_KEY 198
75#define BTRFS_FREE_SPACE_EXTENT_KEY 199
76#define BTRFS_FREE_SPACE_BITMAP_KEY 200
77#define BTRFS_DEV_EXTENT_KEY 204
Christopher Ferris106b3a82016-08-24 12:15:38 -070078#define BTRFS_DEV_ITEM_KEY 216
79#define BTRFS_CHUNK_ITEM_KEY 228
80#define BTRFS_QGROUP_STATUS_KEY 240
81#define BTRFS_QGROUP_INFO_KEY 242
Christopher Ferris106b3a82016-08-24 12:15:38 -070082#define BTRFS_QGROUP_LIMIT_KEY 244
83#define BTRFS_QGROUP_RELATION_KEY 246
84#define BTRFS_BALANCE_ITEM_KEY 248
85#define BTRFS_TEMPORARY_ITEM_KEY 248
Christopher Ferris106b3a82016-08-24 12:15:38 -070086#define BTRFS_DEV_STATS_KEY 249
87#define BTRFS_PERSISTENT_ITEM_KEY 249
88#define BTRFS_DEV_REPLACE_KEY 250
89#if BTRFS_UUID_SIZE != 16
Christopher Ferris106b3a82016-08-24 12:15:38 -070090#error "UUID items require BTRFS_UUID_SIZE == 16!"
91#endif
92#define BTRFS_UUID_KEY_SUBVOL 251
93#define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252
Christopher Ferris106b3a82016-08-24 12:15:38 -070094#define BTRFS_STRING_ITEM_KEY 253
95#define BTRFS_CSUM_SIZE 32
Christopher Ferris9584fa42019-12-09 15:36:13 -080096enum btrfs_csum_type {
97 BTRFS_CSUM_TYPE_CRC32 = 0,
Christopher Ferrisd32ca142020-02-04 16:16:51 -080098 BTRFS_CSUM_TYPE_XXHASH = 1,
99 BTRFS_CSUM_TYPE_SHA256 = 2,
100 BTRFS_CSUM_TYPE_BLAKE2 = 3,
Christopher Ferris9584fa42019-12-09 15:36:13 -0800101};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700102#define BTRFS_FT_UNKNOWN 0
Christopher Ferris106b3a82016-08-24 12:15:38 -0700103#define BTRFS_FT_REG_FILE 1
104#define BTRFS_FT_DIR 2
105#define BTRFS_FT_CHRDEV 3
106#define BTRFS_FT_BLKDEV 4
Christopher Ferris106b3a82016-08-24 12:15:38 -0700107#define BTRFS_FT_FIFO 5
108#define BTRFS_FT_SOCK 6
109#define BTRFS_FT_SYMLINK 7
110#define BTRFS_FT_XATTR 8
Christopher Ferris106b3a82016-08-24 12:15:38 -0700111#define BTRFS_FT_MAX 9
112struct btrfs_disk_key {
113 __le64 objectid;
114 __u8 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700115 __le64 offset;
116} __attribute__((__packed__));
117struct btrfs_key {
118 __u64 objectid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700119 __u8 type;
120 __u64 offset;
121} __attribute__((__packed__));
122struct btrfs_dev_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700123 __le64 devid;
124 __le64 total_bytes;
125 __le64 bytes_used;
126 __le32 io_align;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700127 __le32 io_width;
128 __le32 sector_size;
129 __le64 type;
130 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700131 __le64 start_offset;
132 __le32 dev_group;
133 __u8 seek_speed;
134 __u8 bandwidth;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700135 __u8 uuid[BTRFS_UUID_SIZE];
136 __u8 fsid[BTRFS_UUID_SIZE];
137} __attribute__((__packed__));
138struct btrfs_stripe {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700139 __le64 devid;
140 __le64 offset;
141 __u8 dev_uuid[BTRFS_UUID_SIZE];
142} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700143struct btrfs_chunk {
144 __le64 length;
145 __le64 owner;
146 __le64 stripe_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700147 __le64 type;
148 __le32 io_align;
149 __le32 io_width;
150 __le32 sector_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700151 __le16 num_stripes;
152 __le16 sub_stripes;
153 struct btrfs_stripe stripe;
154} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700155#define BTRFS_FREE_SPACE_EXTENT 1
156#define BTRFS_FREE_SPACE_BITMAP 2
157struct btrfs_free_space_entry {
158 __le64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700159 __le64 bytes;
160 __u8 type;
161} __attribute__((__packed__));
162struct btrfs_free_space_header {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700163 struct btrfs_disk_key location;
164 __le64 generation;
165 __le64 num_entries;
166 __le64 num_bitmaps;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700167} __attribute__((__packed__));
168#define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0)
169#define BTRFS_HEADER_FLAG_RELOC (1ULL << 1)
170#define BTRFS_SUPER_FLAG_ERROR (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700171#define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)
172#define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700173#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)
174#define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800175#define BTRFS_SUPER_FLAG_CHANGING_FSID_V2 (1ULL << 36)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700176struct btrfs_extent_item {
177 __le64 refs;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700178 __le64 generation;
179 __le64 flags;
180} __attribute__((__packed__));
181struct btrfs_extent_item_v0 {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700182 __le32 refs;
183} __attribute__((__packed__));
184#define BTRFS_EXTENT_FLAG_DATA (1ULL << 0)
185#define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700186#define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8)
187#define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48)
188struct btrfs_tree_block_info {
189 struct btrfs_disk_key key;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700190 __u8 level;
191} __attribute__((__packed__));
192struct btrfs_extent_data_ref {
193 __le64 root;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700194 __le64 objectid;
195 __le64 offset;
196 __le32 count;
197} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700198struct btrfs_shared_data_ref {
199 __le32 count;
200} __attribute__((__packed__));
201struct btrfs_extent_inline_ref {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700202 __u8 type;
203 __le64 offset;
204} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700205struct btrfs_dev_extent {
206 __le64 chunk_tree;
207 __le64 chunk_objectid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700208 __le64 chunk_offset;
209 __le64 length;
210 __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
211} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700212struct btrfs_inode_ref {
213 __le64 index;
214 __le16 name_len;
215} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700216struct btrfs_inode_extref {
217 __le64 parent_objectid;
218 __le64 index;
219 __le16 name_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700220 __u8 name[0];
221} __attribute__((__packed__));
222struct btrfs_timespec {
223 __le64 sec;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700224 __le32 nsec;
225} __attribute__((__packed__));
226struct btrfs_inode_item {
227 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700228 __le64 transid;
229 __le64 size;
230 __le64 nbytes;
231 __le64 block_group;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700232 __le32 nlink;
233 __le32 uid;
234 __le32 gid;
235 __le32 mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700236 __le64 rdev;
237 __le64 flags;
238 __le64 sequence;
239 __le64 reserved[4];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700240 struct btrfs_timespec atime;
241 struct btrfs_timespec ctime;
242 struct btrfs_timespec mtime;
243 struct btrfs_timespec otime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700244} __attribute__((__packed__));
245struct btrfs_dir_log_item {
246 __le64 end;
247} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700248struct btrfs_dir_item {
249 struct btrfs_disk_key location;
250 __le64 transid;
251 __le16 data_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700252 __le16 name_len;
253 __u8 type;
254} __attribute__((__packed__));
255#define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700256#define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48)
257struct btrfs_root_item {
258 struct btrfs_inode_item inode;
259 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700260 __le64 root_dirid;
261 __le64 bytenr;
262 __le64 byte_limit;
263 __le64 bytes_used;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700264 __le64 last_snapshot;
265 __le64 flags;
266 __le32 refs;
267 struct btrfs_disk_key drop_progress;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700268 __u8 drop_level;
269 __u8 level;
270 __le64 generation_v2;
271 __u8 uuid[BTRFS_UUID_SIZE];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700272 __u8 parent_uuid[BTRFS_UUID_SIZE];
273 __u8 received_uuid[BTRFS_UUID_SIZE];
274 __le64 ctransid;
275 __le64 otransid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700276 __le64 stransid;
277 __le64 rtransid;
278 struct btrfs_timespec ctime;
279 struct btrfs_timespec otime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700280 struct btrfs_timespec stime;
281 struct btrfs_timespec rtime;
282 __le64 reserved[8];
283} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700284struct btrfs_root_ref {
285 __le64 dirid;
286 __le64 sequence;
287 __le16 name_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700288} __attribute__((__packed__));
289struct btrfs_disk_balance_args {
290 __le64 profiles;
291 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700292 __le64 usage;
293 struct {
294 __le32 usage_min;
295 __le32 usage_max;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700296 };
297 };
298 __le64 devid;
299 __le64 pstart;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700300 __le64 pend;
301 __le64 vstart;
302 __le64 vend;
303 __le64 target;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700304 __le64 flags;
305 union {
306 __le64 limit;
307 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700308 __le32 limit_min;
309 __le32 limit_max;
310 };
311 };
Christopher Ferris106b3a82016-08-24 12:15:38 -0700312 __le32 stripes_min;
313 __le32 stripes_max;
314 __le64 unused[6];
315} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700316struct btrfs_balance_item {
317 __le64 flags;
318 struct btrfs_disk_balance_args data;
319 struct btrfs_disk_balance_args meta;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700320 struct btrfs_disk_balance_args sys;
321 __le64 unused[4];
322} __attribute__((__packed__));
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800323enum {
324 BTRFS_FILE_EXTENT_INLINE = 0,
325 BTRFS_FILE_EXTENT_REG = 1,
326 BTRFS_FILE_EXTENT_PREALLOC = 2,
327 BTRFS_NR_FILE_EXTENT_TYPES = 3,
328};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700329struct btrfs_file_extent_item {
330 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700331 __le64 ram_bytes;
332 __u8 compression;
333 __u8 encryption;
334 __le16 other_encoding;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700335 __u8 type;
336 __le64 disk_bytenr;
337 __le64 disk_num_bytes;
338 __le64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700339 __le64 num_bytes;
340} __attribute__((__packed__));
341struct btrfs_csum_item {
342 __u8 csum;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700343} __attribute__((__packed__));
344struct btrfs_dev_stats_item {
345 __le64 values[BTRFS_DEV_STAT_VALUES_MAX];
346} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700347#define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
348#define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700349struct btrfs_dev_replace_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700350 __le64 src_devid;
351 __le64 cursor_left;
352 __le64 cursor_right;
353 __le64 cont_reading_from_srcdev_mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700354 __le64 replace_state;
355 __le64 time_started;
356 __le64 time_stopped;
357 __le64 num_write_errors;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700358 __le64 num_uncorrectable_read_errors;
359} __attribute__((__packed__));
360#define BTRFS_BLOCK_GROUP_DATA (1ULL << 0)
361#define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700362#define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2)
363#define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3)
364#define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4)
365#define BTRFS_BLOCK_GROUP_DUP (1ULL << 5)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700366#define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
367#define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7)
368#define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800369#define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
370#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700371#define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_SPACE_INFO_GLOBAL_RSV)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700372enum btrfs_raid_types {
373 BTRFS_RAID_RAID10,
374 BTRFS_RAID_RAID1,
375 BTRFS_RAID_DUP,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700376 BTRFS_RAID_RAID0,
377 BTRFS_RAID_SINGLE,
378 BTRFS_RAID_RAID5,
379 BTRFS_RAID_RAID6,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800380 BTRFS_RAID_RAID1C3,
381 BTRFS_RAID_RAID1C4,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700382 BTRFS_NR_RAID_TYPES
383};
384#define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | BTRFS_BLOCK_GROUP_SYSTEM | BTRFS_BLOCK_GROUP_METADATA)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800385#define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4 | BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6 | BTRFS_BLOCK_GROUP_DUP | BTRFS_BLOCK_GROUP_RAID10)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700386#define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800387#define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID1C3 | BTRFS_BLOCK_GROUP_RAID1C4)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700388#define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
389#define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
390#define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | BTRFS_AVAIL_ALLOC_BIT_SINGLE)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700391struct btrfs_block_group_item {
392 __le64 used;
393 __le64 chunk_objectid;
394 __le64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700395} __attribute__((__packed__));
396struct btrfs_free_space_info {
397 __le32 extent_count;
398 __le32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700399} __attribute__((__packed__));
400#define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
401#define BTRFS_QGROUP_LEVEL_SHIFT 48
402#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700403#define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
404#define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2)
405#define BTRFS_QGROUP_STATUS_VERSION 1
406struct btrfs_qgroup_status_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700407 __le64 version;
408 __le64 generation;
409 __le64 flags;
410 __le64 rescan;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700411} __attribute__((__packed__));
412struct btrfs_qgroup_info_item {
413 __le64 generation;
414 __le64 rfer;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700415 __le64 rfer_cmpr;
416 __le64 excl;
417 __le64 excl_cmpr;
418} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700419struct btrfs_qgroup_limit_item {
420 __le64 flags;
421 __le64 max_rfer;
422 __le64 max_excl;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700423 __le64 rsv_rfer;
424 __le64 rsv_excl;
425} __attribute__((__packed__));
426#endif