blob: 50ada36058b7ae288e29683043c2e32713e8c557 [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 Ferris106b3a82016-08-24 12:15:38 -070023#define BTRFS_ROOT_TREE_OBJECTID 1ULL
24#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070025#define BTRFS_CHUNK_TREE_OBJECTID 3ULL
26#define BTRFS_DEV_TREE_OBJECTID 4ULL
27#define BTRFS_FS_TREE_OBJECTID 5ULL
28#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070029#define BTRFS_CSUM_TREE_OBJECTID 7ULL
30#define BTRFS_QUOTA_TREE_OBJECTID 8ULL
31#define BTRFS_UUID_TREE_OBJECTID 9ULL
32#define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070033#define BTRFS_DEV_STATS_OBJECTID 0ULL
34#define BTRFS_BALANCE_OBJECTID - 4ULL
35#define BTRFS_ORPHAN_OBJECTID - 5ULL
36#define BTRFS_TREE_LOG_OBJECTID - 6ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070037#define BTRFS_TREE_LOG_FIXUP_OBJECTID - 7ULL
38#define BTRFS_TREE_RELOC_OBJECTID - 8ULL
39#define BTRFS_DATA_RELOC_TREE_OBJECTID - 9ULL
40#define BTRFS_EXTENT_CSUM_OBJECTID - 10ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070041#define BTRFS_FREE_SPACE_OBJECTID - 11ULL
42#define BTRFS_FREE_INO_OBJECTID - 12ULL
43#define BTRFS_MULTIPLE_OBJECTIDS - 255ULL
44#define BTRFS_FIRST_FREE_OBJECTID 256ULL
Christopher Ferris106b3a82016-08-24 12:15:38 -070045#define BTRFS_LAST_FREE_OBJECTID - 256ULL
46#define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
47#define BTRFS_DEV_ITEMS_OBJECTID 1ULL
48#define BTRFS_BTREE_INODE_OBJECTID 1
Christopher Ferris106b3a82016-08-24 12:15:38 -070049#define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2
50#define BTRFS_DEV_REPLACE_DEVID 0ULL
51#define BTRFS_INODE_ITEM_KEY 1
52#define BTRFS_INODE_REF_KEY 12
Christopher Ferris106b3a82016-08-24 12:15:38 -070053#define BTRFS_INODE_EXTREF_KEY 13
54#define BTRFS_XATTR_ITEM_KEY 24
55#define BTRFS_ORPHAN_ITEM_KEY 48
56#define BTRFS_DIR_LOG_ITEM_KEY 60
Christopher Ferris106b3a82016-08-24 12:15:38 -070057#define BTRFS_DIR_LOG_INDEX_KEY 72
58#define BTRFS_DIR_ITEM_KEY 84
59#define BTRFS_DIR_INDEX_KEY 96
60#define BTRFS_EXTENT_DATA_KEY 108
Christopher Ferris106b3a82016-08-24 12:15:38 -070061#define BTRFS_EXTENT_CSUM_KEY 128
62#define BTRFS_ROOT_ITEM_KEY 132
63#define BTRFS_ROOT_BACKREF_KEY 144
64#define BTRFS_ROOT_REF_KEY 156
Christopher Ferris106b3a82016-08-24 12:15:38 -070065#define BTRFS_EXTENT_ITEM_KEY 168
66#define BTRFS_METADATA_ITEM_KEY 169
67#define BTRFS_TREE_BLOCK_REF_KEY 176
68#define BTRFS_EXTENT_DATA_REF_KEY 178
Christopher Ferris106b3a82016-08-24 12:15:38 -070069#define BTRFS_EXTENT_REF_V0_KEY 180
70#define BTRFS_SHARED_BLOCK_REF_KEY 182
71#define BTRFS_SHARED_DATA_REF_KEY 184
72#define BTRFS_BLOCK_GROUP_ITEM_KEY 192
Christopher Ferris106b3a82016-08-24 12:15:38 -070073#define BTRFS_FREE_SPACE_INFO_KEY 198
74#define BTRFS_FREE_SPACE_EXTENT_KEY 199
75#define BTRFS_FREE_SPACE_BITMAP_KEY 200
76#define BTRFS_DEV_EXTENT_KEY 204
Christopher Ferris106b3a82016-08-24 12:15:38 -070077#define BTRFS_DEV_ITEM_KEY 216
78#define BTRFS_CHUNK_ITEM_KEY 228
79#define BTRFS_QGROUP_STATUS_KEY 240
80#define BTRFS_QGROUP_INFO_KEY 242
Christopher Ferris106b3a82016-08-24 12:15:38 -070081#define BTRFS_QGROUP_LIMIT_KEY 244
82#define BTRFS_QGROUP_RELATION_KEY 246
83#define BTRFS_BALANCE_ITEM_KEY 248
84#define BTRFS_TEMPORARY_ITEM_KEY 248
Christopher Ferris106b3a82016-08-24 12:15:38 -070085#define BTRFS_DEV_STATS_KEY 249
86#define BTRFS_PERSISTENT_ITEM_KEY 249
87#define BTRFS_DEV_REPLACE_KEY 250
88#if BTRFS_UUID_SIZE != 16
Christopher Ferris106b3a82016-08-24 12:15:38 -070089#error "UUID items require BTRFS_UUID_SIZE == 16!"
90#endif
91#define BTRFS_UUID_KEY_SUBVOL 251
92#define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252
Christopher Ferris106b3a82016-08-24 12:15:38 -070093#define BTRFS_STRING_ITEM_KEY 253
94#define BTRFS_CSUM_SIZE 32
Christopher Ferris9584fa42019-12-09 15:36:13 -080095enum btrfs_csum_type {
96 BTRFS_CSUM_TYPE_CRC32 = 0,
Christopher Ferrisd32ca142020-02-04 16:16:51 -080097 BTRFS_CSUM_TYPE_XXHASH = 1,
98 BTRFS_CSUM_TYPE_SHA256 = 2,
99 BTRFS_CSUM_TYPE_BLAKE2 = 3,
Christopher Ferris9584fa42019-12-09 15:36:13 -0800100};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700101#define BTRFS_FT_UNKNOWN 0
Christopher Ferris106b3a82016-08-24 12:15:38 -0700102#define BTRFS_FT_REG_FILE 1
103#define BTRFS_FT_DIR 2
104#define BTRFS_FT_CHRDEV 3
105#define BTRFS_FT_BLKDEV 4
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106#define BTRFS_FT_FIFO 5
107#define BTRFS_FT_SOCK 6
108#define BTRFS_FT_SYMLINK 7
109#define BTRFS_FT_XATTR 8
Christopher Ferris106b3a82016-08-24 12:15:38 -0700110#define BTRFS_FT_MAX 9
111struct btrfs_disk_key {
112 __le64 objectid;
113 __u8 type;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700114 __le64 offset;
115} __attribute__((__packed__));
116struct btrfs_key {
117 __u64 objectid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700118 __u8 type;
119 __u64 offset;
120} __attribute__((__packed__));
121struct btrfs_dev_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700122 __le64 devid;
123 __le64 total_bytes;
124 __le64 bytes_used;
125 __le32 io_align;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700126 __le32 io_width;
127 __le32 sector_size;
128 __le64 type;
129 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130 __le64 start_offset;
131 __le32 dev_group;
132 __u8 seek_speed;
133 __u8 bandwidth;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700134 __u8 uuid[BTRFS_UUID_SIZE];
135 __u8 fsid[BTRFS_UUID_SIZE];
136} __attribute__((__packed__));
137struct btrfs_stripe {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700138 __le64 devid;
139 __le64 offset;
140 __u8 dev_uuid[BTRFS_UUID_SIZE];
141} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700142struct btrfs_chunk {
143 __le64 length;
144 __le64 owner;
145 __le64 stripe_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700146 __le64 type;
147 __le32 io_align;
148 __le32 io_width;
149 __le32 sector_size;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700150 __le16 num_stripes;
151 __le16 sub_stripes;
152 struct btrfs_stripe stripe;
153} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700154#define BTRFS_FREE_SPACE_EXTENT 1
155#define BTRFS_FREE_SPACE_BITMAP 2
156struct btrfs_free_space_entry {
157 __le64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700158 __le64 bytes;
159 __u8 type;
160} __attribute__((__packed__));
161struct btrfs_free_space_header {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700162 struct btrfs_disk_key location;
163 __le64 generation;
164 __le64 num_entries;
165 __le64 num_bitmaps;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700166} __attribute__((__packed__));
167#define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0)
168#define BTRFS_HEADER_FLAG_RELOC (1ULL << 1)
169#define BTRFS_SUPER_FLAG_ERROR (1ULL << 2)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700170#define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)
171#define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)
Christopher Ferris76a1d452018-06-27 14:12:29 -0700172#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)
173#define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)
Christopher Ferrisd842e432019-03-07 10:21:59 -0800174#define BTRFS_SUPER_FLAG_CHANGING_FSID_V2 (1ULL << 36)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700175struct btrfs_extent_item {
176 __le64 refs;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700177 __le64 generation;
178 __le64 flags;
179} __attribute__((__packed__));
180struct btrfs_extent_item_v0 {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700181 __le32 refs;
182} __attribute__((__packed__));
183#define BTRFS_EXTENT_FLAG_DATA (1ULL << 0)
184#define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700185#define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8)
186#define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48)
187struct btrfs_tree_block_info {
188 struct btrfs_disk_key key;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700189 __u8 level;
190} __attribute__((__packed__));
191struct btrfs_extent_data_ref {
192 __le64 root;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700193 __le64 objectid;
194 __le64 offset;
195 __le32 count;
196} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700197struct btrfs_shared_data_ref {
198 __le32 count;
199} __attribute__((__packed__));
200struct btrfs_extent_inline_ref {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700201 __u8 type;
202 __le64 offset;
203} __attribute__((__packed__));
204struct btrfs_extent_ref_v0 {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700205 __le64 root;
206 __le64 generation;
207 __le64 objectid;
208 __le32 count;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700209} __attribute__((__packed__));
210struct btrfs_dev_extent {
211 __le64 chunk_tree;
212 __le64 chunk_objectid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700213 __le64 chunk_offset;
214 __le64 length;
215 __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
216} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700217struct btrfs_inode_ref {
218 __le64 index;
219 __le16 name_len;
220} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700221struct btrfs_inode_extref {
222 __le64 parent_objectid;
223 __le64 index;
224 __le16 name_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700225 __u8 name[0];
226} __attribute__((__packed__));
227struct btrfs_timespec {
228 __le64 sec;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700229 __le32 nsec;
230} __attribute__((__packed__));
231struct btrfs_inode_item {
232 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700233 __le64 transid;
234 __le64 size;
235 __le64 nbytes;
236 __le64 block_group;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700237 __le32 nlink;
238 __le32 uid;
239 __le32 gid;
240 __le32 mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700241 __le64 rdev;
242 __le64 flags;
243 __le64 sequence;
244 __le64 reserved[4];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700245 struct btrfs_timespec atime;
246 struct btrfs_timespec ctime;
247 struct btrfs_timespec mtime;
248 struct btrfs_timespec otime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700249} __attribute__((__packed__));
250struct btrfs_dir_log_item {
251 __le64 end;
252} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700253struct btrfs_dir_item {
254 struct btrfs_disk_key location;
255 __le64 transid;
256 __le16 data_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700257 __le16 name_len;
258 __u8 type;
259} __attribute__((__packed__));
260#define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700261#define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48)
262struct btrfs_root_item {
263 struct btrfs_inode_item inode;
264 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700265 __le64 root_dirid;
266 __le64 bytenr;
267 __le64 byte_limit;
268 __le64 bytes_used;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700269 __le64 last_snapshot;
270 __le64 flags;
271 __le32 refs;
272 struct btrfs_disk_key drop_progress;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700273 __u8 drop_level;
274 __u8 level;
275 __le64 generation_v2;
276 __u8 uuid[BTRFS_UUID_SIZE];
Christopher Ferris106b3a82016-08-24 12:15:38 -0700277 __u8 parent_uuid[BTRFS_UUID_SIZE];
278 __u8 received_uuid[BTRFS_UUID_SIZE];
279 __le64 ctransid;
280 __le64 otransid;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700281 __le64 stransid;
282 __le64 rtransid;
283 struct btrfs_timespec ctime;
284 struct btrfs_timespec otime;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700285 struct btrfs_timespec stime;
286 struct btrfs_timespec rtime;
287 __le64 reserved[8];
288} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700289struct btrfs_root_ref {
290 __le64 dirid;
291 __le64 sequence;
292 __le16 name_len;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700293} __attribute__((__packed__));
294struct btrfs_disk_balance_args {
295 __le64 profiles;
296 union {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700297 __le64 usage;
298 struct {
299 __le32 usage_min;
300 __le32 usage_max;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700301 };
302 };
303 __le64 devid;
304 __le64 pstart;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700305 __le64 pend;
306 __le64 vstart;
307 __le64 vend;
308 __le64 target;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700309 __le64 flags;
310 union {
311 __le64 limit;
312 struct {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700313 __le32 limit_min;
314 __le32 limit_max;
315 };
316 };
Christopher Ferris106b3a82016-08-24 12:15:38 -0700317 __le32 stripes_min;
318 __le32 stripes_max;
319 __le64 unused[6];
320} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700321struct btrfs_balance_item {
322 __le64 flags;
323 struct btrfs_disk_balance_args data;
324 struct btrfs_disk_balance_args meta;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700325 struct btrfs_disk_balance_args sys;
326 __le64 unused[4];
327} __attribute__((__packed__));
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800328enum {
329 BTRFS_FILE_EXTENT_INLINE = 0,
330 BTRFS_FILE_EXTENT_REG = 1,
331 BTRFS_FILE_EXTENT_PREALLOC = 2,
332 BTRFS_NR_FILE_EXTENT_TYPES = 3,
333};
Christopher Ferris106b3a82016-08-24 12:15:38 -0700334struct btrfs_file_extent_item {
335 __le64 generation;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700336 __le64 ram_bytes;
337 __u8 compression;
338 __u8 encryption;
339 __le16 other_encoding;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700340 __u8 type;
341 __le64 disk_bytenr;
342 __le64 disk_num_bytes;
343 __le64 offset;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700344 __le64 num_bytes;
345} __attribute__((__packed__));
346struct btrfs_csum_item {
347 __u8 csum;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700348} __attribute__((__packed__));
349struct btrfs_dev_stats_item {
350 __le64 values[BTRFS_DEV_STAT_VALUES_MAX];
351} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700352#define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
353#define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
Christopher Ferris106b3a82016-08-24 12:15:38 -0700354struct btrfs_dev_replace_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700355 __le64 src_devid;
356 __le64 cursor_left;
357 __le64 cursor_right;
358 __le64 cont_reading_from_srcdev_mode;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700359 __le64 replace_state;
360 __le64 time_started;
361 __le64 time_stopped;
362 __le64 num_write_errors;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700363 __le64 num_uncorrectable_read_errors;
364} __attribute__((__packed__));
365#define BTRFS_BLOCK_GROUP_DATA (1ULL << 0)
366#define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700367#define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2)
368#define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3)
369#define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4)
370#define BTRFS_BLOCK_GROUP_DUP (1ULL << 5)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700371#define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
372#define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7)
373#define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800374#define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
375#define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700376#define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | BTRFS_SPACE_INFO_GLOBAL_RSV)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700377enum btrfs_raid_types {
378 BTRFS_RAID_RAID10,
379 BTRFS_RAID_RAID1,
380 BTRFS_RAID_DUP,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700381 BTRFS_RAID_RAID0,
382 BTRFS_RAID_SINGLE,
383 BTRFS_RAID_RAID5,
384 BTRFS_RAID_RAID6,
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800385 BTRFS_RAID_RAID1C3,
386 BTRFS_RAID_RAID1C4,
Christopher Ferris106b3a82016-08-24 12:15:38 -0700387 BTRFS_NR_RAID_TYPES
388};
389#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 -0800390#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 -0700391#define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800392#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 -0700393#define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
394#define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
395#define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | BTRFS_AVAIL_ALLOC_BIT_SINGLE)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700396struct btrfs_block_group_item {
397 __le64 used;
398 __le64 chunk_objectid;
399 __le64 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700400} __attribute__((__packed__));
401struct btrfs_free_space_info {
402 __le32 extent_count;
403 __le32 flags;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700404} __attribute__((__packed__));
405#define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
406#define BTRFS_QGROUP_LEVEL_SHIFT 48
407#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
Christopher Ferris106b3a82016-08-24 12:15:38 -0700408#define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
409#define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2)
410#define BTRFS_QGROUP_STATUS_VERSION 1
411struct btrfs_qgroup_status_item {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700412 __le64 version;
413 __le64 generation;
414 __le64 flags;
415 __le64 rescan;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700416} __attribute__((__packed__));
417struct btrfs_qgroup_info_item {
418 __le64 generation;
419 __le64 rfer;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700420 __le64 rfer_cmpr;
421 __le64 excl;
422 __le64 excl_cmpr;
423} __attribute__((__packed__));
Christopher Ferris106b3a82016-08-24 12:15:38 -0700424struct btrfs_qgroup_limit_item {
425 __le64 flags;
426 __le64 max_rfer;
427 __le64 max_excl;
Christopher Ferris106b3a82016-08-24 12:15:38 -0700428 __le64 rsv_rfer;
429 __le64 rsv_excl;
430} __attribute__((__packed__));
431#endif