logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

btrfs_tree.h (35623B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _BTRFS_CTREE_H_
  3. #define _BTRFS_CTREE_H_
  4. #include <linux/btrfs.h>
  5. #include <linux/types.h>
  6. #include <stddef.h>
  7. /* ASCII for _BHRfS_M, no terminating nul */
  8. #define BTRFS_MAGIC 0x4D5F53665248425FULL
  9. #define BTRFS_MAX_LEVEL 8
  10. /*
  11. * We can actually store much bigger names, but lets not confuse the rest of
  12. * linux.
  13. */
  14. #define BTRFS_NAME_LEN 255
  15. /*
  16. * Theoretical limit is larger, but we keep this down to a sane value. That
  17. * should limit greatly the possibility of collisions on inode ref items.
  18. */
  19. #define BTRFS_LINK_MAX 65535U
  20. /*
  21. * This header contains the structure definitions and constants used
  22. * by file system objects that can be retrieved using
  23. * the BTRFS_IOC_SEARCH_TREE ioctl. That means basically anything that
  24. * is needed to describe a leaf node's key or item contents.
  25. */
  26. /* holds pointers to all of the tree roots */
  27. #define BTRFS_ROOT_TREE_OBJECTID 1ULL
  28. /* stores information about which extents are in use, and reference counts */
  29. #define BTRFS_EXTENT_TREE_OBJECTID 2ULL
  30. /*
  31. * chunk tree stores translations from logical -> physical block numbering
  32. * the super block points to the chunk tree
  33. */
  34. #define BTRFS_CHUNK_TREE_OBJECTID 3ULL
  35. /*
  36. * stores information about which areas of a given device are in use.
  37. * one per device. The tree of tree roots points to the device tree
  38. */
  39. #define BTRFS_DEV_TREE_OBJECTID 4ULL
  40. /* one per subvolume, storing files and directories */
  41. #define BTRFS_FS_TREE_OBJECTID 5ULL
  42. /* directory objectid inside the root tree */
  43. #define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL
  44. /* holds checksums of all the data extents */
  45. #define BTRFS_CSUM_TREE_OBJECTID 7ULL
  46. /* holds quota configuration and tracking */
  47. #define BTRFS_QUOTA_TREE_OBJECTID 8ULL
  48. /* for storing items that use the BTRFS_UUID_KEY* types */
  49. #define BTRFS_UUID_TREE_OBJECTID 9ULL
  50. /* tracks free space in block groups. */
  51. #define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL
  52. /* Holds the block group items for extent tree v2. */
  53. #define BTRFS_BLOCK_GROUP_TREE_OBJECTID 11ULL
  54. /* Tracks RAID stripes in block groups. */
  55. #define BTRFS_RAID_STRIPE_TREE_OBJECTID 12ULL
  56. /* device stats in the device tree */
  57. #define BTRFS_DEV_STATS_OBJECTID 0ULL
  58. /* for storing balance parameters in the root tree */
  59. #define BTRFS_BALANCE_OBJECTID -4ULL
  60. /* orphan objectid for tracking unlinked/truncated files */
  61. #define BTRFS_ORPHAN_OBJECTID -5ULL
  62. /* does write ahead logging to speed up fsyncs */
  63. #define BTRFS_TREE_LOG_OBJECTID -6ULL
  64. #define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL
  65. /* for space balancing */
  66. #define BTRFS_TREE_RELOC_OBJECTID -8ULL
  67. #define BTRFS_DATA_RELOC_TREE_OBJECTID -9ULL
  68. /*
  69. * extent checksums all have this objectid
  70. * this allows them to share the logging tree
  71. * for fsyncs
  72. */
  73. #define BTRFS_EXTENT_CSUM_OBJECTID -10ULL
  74. /* For storing free space cache */
  75. #define BTRFS_FREE_SPACE_OBJECTID -11ULL
  76. /*
  77. * The inode number assigned to the special inode for storing
  78. * free ino cache
  79. */
  80. #define BTRFS_FREE_INO_OBJECTID -12ULL
  81. /* dummy objectid represents multiple objectids */
  82. #define BTRFS_MULTIPLE_OBJECTIDS -255ULL
  83. /*
  84. * All files have objectids in this range.
  85. */
  86. #define BTRFS_FIRST_FREE_OBJECTID 256ULL
  87. #define BTRFS_LAST_FREE_OBJECTID -256ULL
  88. #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
  89. /*
  90. * the device items go into the chunk tree. The key is in the form
  91. * [ 1 BTRFS_DEV_ITEM_KEY device_id ]
  92. */
  93. #define BTRFS_DEV_ITEMS_OBJECTID 1ULL
  94. #define BTRFS_BTREE_INODE_OBJECTID 1
  95. #define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2
  96. #define BTRFS_DEV_REPLACE_DEVID 0ULL
  97. /*
  98. * inode items have the data typically returned from stat and store other
  99. * info about object characteristics. There is one for every file and dir in
  100. * the FS
  101. */
  102. #define BTRFS_INODE_ITEM_KEY 1
  103. #define BTRFS_INODE_REF_KEY 12
  104. #define BTRFS_INODE_EXTREF_KEY 13
  105. #define BTRFS_XATTR_ITEM_KEY 24
  106. /*
  107. * fs verity items are stored under two different key types on disk.
  108. * The descriptor items:
  109. * [ inode objectid, BTRFS_VERITY_DESC_ITEM_KEY, offset ]
  110. *
  111. * At offset 0, we store a btrfs_verity_descriptor_item which tracks the size
  112. * of the descriptor item and some extra data for encryption.
  113. * Starting at offset 1, these hold the generic fs verity descriptor. The
  114. * latter are opaque to btrfs, we just read and write them as a blob for the
  115. * higher level verity code. The most common descriptor size is 256 bytes.
  116. *
  117. * The merkle tree items:
  118. * [ inode objectid, BTRFS_VERITY_MERKLE_ITEM_KEY, offset ]
  119. *
  120. * These also start at offset 0, and correspond to the merkle tree bytes. When
  121. * fsverity asks for page 0 of the merkle tree, we pull up one page starting at
  122. * offset 0 for this key type. These are also opaque to btrfs, we're blindly
  123. * storing whatever fsverity sends down.
  124. */
  125. #define BTRFS_VERITY_DESC_ITEM_KEY 36
  126. #define BTRFS_VERITY_MERKLE_ITEM_KEY 37
  127. #define BTRFS_ORPHAN_ITEM_KEY 48
  128. /* reserve 2-15 close to the inode for later flexibility */
  129. /*
  130. * dir items are the name -> inode pointers in a directory. There is one
  131. * for every name in a directory. BTRFS_DIR_LOG_ITEM_KEY is no longer used
  132. * but it's still defined here for documentation purposes and to help avoid
  133. * having its numerical value reused in the future.
  134. */
  135. #define BTRFS_DIR_LOG_ITEM_KEY 60
  136. #define BTRFS_DIR_LOG_INDEX_KEY 72
  137. #define BTRFS_DIR_ITEM_KEY 84
  138. #define BTRFS_DIR_INDEX_KEY 96
  139. /*
  140. * extent data is for file data
  141. */
  142. #define BTRFS_EXTENT_DATA_KEY 108
  143. /*
  144. * extent csums are stored in a separate tree and hold csums for
  145. * an entire extent on disk.
  146. */
  147. #define BTRFS_EXTENT_CSUM_KEY 128
  148. /*
  149. * root items point to tree roots. They are typically in the root
  150. * tree used by the super block to find all the other trees
  151. */
  152. #define BTRFS_ROOT_ITEM_KEY 132
  153. /*
  154. * root backrefs tie subvols and snapshots to the directory entries that
  155. * reference them
  156. */
  157. #define BTRFS_ROOT_BACKREF_KEY 144
  158. /*
  159. * root refs make a fast index for listing all of the snapshots and
  160. * subvolumes referenced by a given root. They point directly to the
  161. * directory item in the root that references the subvol
  162. */
  163. #define BTRFS_ROOT_REF_KEY 156
  164. /*
  165. * extent items are in the extent map tree. These record which blocks
  166. * are used, and how many references there are to each block
  167. */
  168. #define BTRFS_EXTENT_ITEM_KEY 168
  169. /*
  170. * The same as the BTRFS_EXTENT_ITEM_KEY, except it's metadata we already know
  171. * the length, so we save the level in key->offset instead of the length.
  172. */
  173. #define BTRFS_METADATA_ITEM_KEY 169
  174. /*
  175. * Special __inline__ ref key which stores the id of the subvolume which originally
  176. * created the extent. This subvolume owns the extent permanently from the
  177. * perspective of simple quotas. Needed to know which subvolume to free quota
  178. * usage from when the extent is deleted.
  179. *
  180. * Stored as an __inline__ ref rather to avoid wasting space on a separate item on
  181. * top of the existing extent item. However, unlike the other __inline__ refs,
  182. * there is one one owner ref per extent rather than one per extent.
  183. *
  184. * Because of this, it goes at the front of the list of __inline__ refs, and thus
  185. * must have a lower type value than any other __inline__ ref type (to satisfy the
  186. * disk format rule that __inline__ refs have non-decreasing type).
  187. */
  188. #define BTRFS_EXTENT_OWNER_REF_KEY 172
  189. #define BTRFS_TREE_BLOCK_REF_KEY 176
  190. #define BTRFS_EXTENT_DATA_REF_KEY 178
  191. /*
  192. * Obsolete key. Defintion removed in 6.6, value may be reused in the future.
  193. *
  194. * #define BTRFS_EXTENT_REF_V0_KEY 180
  195. */
  196. #define BTRFS_SHARED_BLOCK_REF_KEY 182
  197. #define BTRFS_SHARED_DATA_REF_KEY 184
  198. /*
  199. * block groups give us hints into the extent allocation trees. Which
  200. * blocks are free etc etc
  201. */
  202. #define BTRFS_BLOCK_GROUP_ITEM_KEY 192
  203. /*
  204. * Every block group is represented in the free space tree by a free space info
  205. * item, which stores some accounting information. It is keyed on
  206. * (block_group_start, FREE_SPACE_INFO, block_group_length).
  207. */
  208. #define BTRFS_FREE_SPACE_INFO_KEY 198
  209. /*
  210. * A free space extent tracks an extent of space that is free in a block group.
  211. * It is keyed on (start, FREE_SPACE_EXTENT, length).
  212. */
  213. #define BTRFS_FREE_SPACE_EXTENT_KEY 199
  214. /*
  215. * When a block group becomes very fragmented, we convert it to use bitmaps
  216. * instead of extents. A free space bitmap is keyed on
  217. * (start, FREE_SPACE_BITMAP, length); the corresponding item is a bitmap with
  218. * (length / sectorsize) bits.
  219. */
  220. #define BTRFS_FREE_SPACE_BITMAP_KEY 200
  221. #define BTRFS_DEV_EXTENT_KEY 204
  222. #define BTRFS_DEV_ITEM_KEY 216
  223. #define BTRFS_CHUNK_ITEM_KEY 228
  224. #define BTRFS_RAID_STRIPE_KEY 230
  225. /*
  226. * Records the overall state of the qgroups.
  227. * There's only one instance of this key present,
  228. * (0, BTRFS_QGROUP_STATUS_KEY, 0)
  229. */
  230. #define BTRFS_QGROUP_STATUS_KEY 240
  231. /*
  232. * Records the currently used space of the qgroup.
  233. * One key per qgroup, (0, BTRFS_QGROUP_INFO_KEY, qgroupid).
  234. */
  235. #define BTRFS_QGROUP_INFO_KEY 242
  236. /*
  237. * Contains the user configured limits for the qgroup.
  238. * One key per qgroup, (0, BTRFS_QGROUP_LIMIT_KEY, qgroupid).
  239. */
  240. #define BTRFS_QGROUP_LIMIT_KEY 244
  241. /*
  242. * Records the child-parent relationship of qgroups. For
  243. * each relation, 2 keys are present:
  244. * (childid, BTRFS_QGROUP_RELATION_KEY, parentid)
  245. * (parentid, BTRFS_QGROUP_RELATION_KEY, childid)
  246. */
  247. #define BTRFS_QGROUP_RELATION_KEY 246
  248. /*
  249. * Obsolete name, see BTRFS_TEMPORARY_ITEM_KEY.
  250. */
  251. #define BTRFS_BALANCE_ITEM_KEY 248
  252. /*
  253. * The key type for tree items that are stored persistently, but do not need to
  254. * exist for extended period of time. The items can exist in any tree.
  255. *
  256. * [subtype, BTRFS_TEMPORARY_ITEM_KEY, data]
  257. *
  258. * Existing items:
  259. *
  260. * - balance status item
  261. * (BTRFS_BALANCE_OBJECTID, BTRFS_TEMPORARY_ITEM_KEY, 0)
  262. */
  263. #define BTRFS_TEMPORARY_ITEM_KEY 248
  264. /*
  265. * Obsolete name, see BTRFS_PERSISTENT_ITEM_KEY
  266. */
  267. #define BTRFS_DEV_STATS_KEY 249
  268. /*
  269. * The key type for tree items that are stored persistently and usually exist
  270. * for a long period, eg. filesystem lifetime. The item kinds can be status
  271. * information, stats or preference values. The item can exist in any tree.
  272. *
  273. * [subtype, BTRFS_PERSISTENT_ITEM_KEY, data]
  274. *
  275. * Existing items:
  276. *
  277. * - device statistics, store IO stats in the device tree, one key for all
  278. * stats
  279. * (BTRFS_DEV_STATS_OBJECTID, BTRFS_DEV_STATS_KEY, 0)
  280. */
  281. #define BTRFS_PERSISTENT_ITEM_KEY 249
  282. /*
  283. * Persistently stores the device replace state in the device tree.
  284. * The key is built like this: (0, BTRFS_DEV_REPLACE_KEY, 0).
  285. */
  286. #define BTRFS_DEV_REPLACE_KEY 250
  287. /*
  288. * Stores items that allow to quickly map UUIDs to something else.
  289. * These items are part of the filesystem UUID tree.
  290. * The key is built like this:
  291. * (UUID_upper_64_bits, BTRFS_UUID_KEY*, UUID_lower_64_bits).
  292. */
  293. #if BTRFS_UUID_SIZE != 16
  294. #error "UUID items require BTRFS_UUID_SIZE == 16!"
  295. #endif
  296. #define BTRFS_UUID_KEY_SUBVOL 251 /* for UUIDs assigned to subvols */
  297. #define BTRFS_UUID_KEY_RECEIVED_SUBVOL 252 /* for UUIDs assigned to
  298. * received subvols */
  299. /*
  300. * string items are for debugging. They just store a short string of
  301. * data in the FS
  302. */
  303. #define BTRFS_STRING_ITEM_KEY 253
  304. /* Maximum metadata block size (nodesize) */
  305. #define BTRFS_MAX_METADATA_BLOCKSIZE 65536
  306. /* 32 bytes in various csum fields */
  307. #define BTRFS_CSUM_SIZE 32
  308. /* csum types */
  309. enum btrfs_csum_type {
  310. BTRFS_CSUM_TYPE_CRC32 = 0,
  311. BTRFS_CSUM_TYPE_XXHASH = 1,
  312. BTRFS_CSUM_TYPE_SHA256 = 2,
  313. BTRFS_CSUM_TYPE_BLAKE2 = 3,
  314. };
  315. /*
  316. * flags definitions for directory entry item type
  317. *
  318. * Used by:
  319. * struct btrfs_dir_item.type
  320. *
  321. * Values 0..7 must match common file type values in fs_types.h.
  322. */
  323. #define BTRFS_FT_UNKNOWN 0
  324. #define BTRFS_FT_REG_FILE 1
  325. #define BTRFS_FT_DIR 2
  326. #define BTRFS_FT_CHRDEV 3
  327. #define BTRFS_FT_BLKDEV 4
  328. #define BTRFS_FT_FIFO 5
  329. #define BTRFS_FT_SOCK 6
  330. #define BTRFS_FT_SYMLINK 7
  331. #define BTRFS_FT_XATTR 8
  332. #define BTRFS_FT_MAX 9
  333. /* Directory contains encrypted data */
  334. #define BTRFS_FT_ENCRYPTED 0x80
  335. static __inline__ __u8 btrfs_dir_flags_to_ftype(__u8 flags)
  336. {
  337. return flags & ~BTRFS_FT_ENCRYPTED;
  338. }
  339. /*
  340. * Inode flags
  341. */
  342. #define BTRFS_INODE_NODATASUM (1U << 0)
  343. #define BTRFS_INODE_NODATACOW (1U << 1)
  344. #define BTRFS_INODE_READONLY (1U << 2)
  345. #define BTRFS_INODE_NOCOMPRESS (1U << 3)
  346. #define BTRFS_INODE_PREALLOC (1U << 4)
  347. #define BTRFS_INODE_SYNC (1U << 5)
  348. #define BTRFS_INODE_IMMUTABLE (1U << 6)
  349. #define BTRFS_INODE_APPEND (1U << 7)
  350. #define BTRFS_INODE_NODUMP (1U << 8)
  351. #define BTRFS_INODE_NOATIME (1U << 9)
  352. #define BTRFS_INODE_DIRSYNC (1U << 10)
  353. #define BTRFS_INODE_COMPRESS (1U << 11)
  354. #define BTRFS_INODE_ROOT_ITEM_INIT (1U << 31)
  355. #define BTRFS_INODE_FLAG_MASK \
  356. (BTRFS_INODE_NODATASUM | \
  357. BTRFS_INODE_NODATACOW | \
  358. BTRFS_INODE_READONLY | \
  359. BTRFS_INODE_NOCOMPRESS | \
  360. BTRFS_INODE_PREALLOC | \
  361. BTRFS_INODE_SYNC | \
  362. BTRFS_INODE_IMMUTABLE | \
  363. BTRFS_INODE_APPEND | \
  364. BTRFS_INODE_NODUMP | \
  365. BTRFS_INODE_NOATIME | \
  366. BTRFS_INODE_DIRSYNC | \
  367. BTRFS_INODE_COMPRESS | \
  368. BTRFS_INODE_ROOT_ITEM_INIT)
  369. #define BTRFS_INODE_RO_VERITY (1U << 0)
  370. #define BTRFS_INODE_RO_FLAG_MASK (BTRFS_INODE_RO_VERITY)
  371. /*
  372. * The key defines the order in the tree, and so it also defines (optimal)
  373. * block layout.
  374. *
  375. * objectid corresponds to the inode number.
  376. *
  377. * type tells us things about the object, and is a kind of stream selector.
  378. * so for a given inode, keys with type of 1 might refer to the inode data,
  379. * type of 2 may point to file data in the btree and type == 3 may point to
  380. * extents.
  381. *
  382. * offset is the starting byte offset for this key in the stream.
  383. *
  384. * btrfs_disk_key is in disk byte order. struct btrfs_key is always
  385. * in cpu native order. Otherwise they are identical and their sizes
  386. * should be the same (ie both packed)
  387. */
  388. struct btrfs_disk_key {
  389. __le64 objectid;
  390. __u8 type;
  391. __le64 offset;
  392. } __attribute__ ((__packed__));
  393. struct btrfs_key {
  394. __u64 objectid;
  395. __u8 type;
  396. __u64 offset;
  397. } __attribute__ ((__packed__));
  398. /*
  399. * Every tree block (leaf or node) starts with this header.
  400. */
  401. struct btrfs_header {
  402. /* These first four must match the super block */
  403. __u8 csum[BTRFS_CSUM_SIZE];
  404. /* FS specific uuid */
  405. __u8 fsid[BTRFS_FSID_SIZE];
  406. /* Which block this node is supposed to live in */
  407. __le64 bytenr;
  408. __le64 flags;
  409. /* Allowed to be different from the super from here on down */
  410. __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
  411. __le64 generation;
  412. __le64 owner;
  413. __le32 nritems;
  414. __u8 level;
  415. } __attribute__ ((__packed__));
  416. /*
  417. * This is a very generous portion of the super block, giving us room to
  418. * translate 14 chunks with 3 stripes each.
  419. */
  420. #define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
  421. /*
  422. * Just in case we somehow lose the roots and are not able to mount, we store
  423. * an array of the roots from previous transactions in the super.
  424. */
  425. #define BTRFS_NUM_BACKUP_ROOTS 4
  426. struct btrfs_root_backup {
  427. __le64 tree_root;
  428. __le64 tree_root_gen;
  429. __le64 chunk_root;
  430. __le64 chunk_root_gen;
  431. __le64 extent_root;
  432. __le64 extent_root_gen;
  433. __le64 fs_root;
  434. __le64 fs_root_gen;
  435. __le64 dev_root;
  436. __le64 dev_root_gen;
  437. __le64 csum_root;
  438. __le64 csum_root_gen;
  439. __le64 total_bytes;
  440. __le64 bytes_used;
  441. __le64 num_devices;
  442. /* future */
  443. __le64 unused_64[4];
  444. __u8 tree_root_level;
  445. __u8 chunk_root_level;
  446. __u8 extent_root_level;
  447. __u8 fs_root_level;
  448. __u8 dev_root_level;
  449. __u8 csum_root_level;
  450. /* future and to align */
  451. __u8 unused_8[10];
  452. } __attribute__ ((__packed__));
  453. /*
  454. * A leaf is full of items. offset and size tell us where to find the item in
  455. * the leaf (relative to the start of the data area)
  456. */
  457. struct btrfs_item {
  458. struct btrfs_disk_key key;
  459. __le32 offset;
  460. __le32 size;
  461. } __attribute__ ((__packed__));
  462. /*
  463. * Leaves have an item area and a data area:
  464. * [item0, item1....itemN] [free space] [dataN...data1, data0]
  465. *
  466. * The data is separate from the items to get the keys closer together during
  467. * searches.
  468. */
  469. struct btrfs_leaf {
  470. struct btrfs_header header;
  471. struct btrfs_item items[];
  472. } __attribute__ ((__packed__));
  473. /*
  474. * All non-leaf blocks are nodes, they hold only keys and pointers to other
  475. * blocks.
  476. */
  477. struct btrfs_key_ptr {
  478. struct btrfs_disk_key key;
  479. __le64 blockptr;
  480. __le64 generation;
  481. } __attribute__ ((__packed__));
  482. struct btrfs_node {
  483. struct btrfs_header header;
  484. struct btrfs_key_ptr ptrs[];
  485. } __attribute__ ((__packed__));
  486. struct btrfs_dev_item {
  487. /* the internal btrfs device id */
  488. __le64 devid;
  489. /* size of the device */
  490. __le64 total_bytes;
  491. /* bytes used */
  492. __le64 bytes_used;
  493. /* optimal io alignment for this device */
  494. __le32 io_align;
  495. /* optimal io width for this device */
  496. __le32 io_width;
  497. /* minimal io size for this device */
  498. __le32 sector_size;
  499. /* type and info about this device */
  500. __le64 type;
  501. /* expected generation for this device */
  502. __le64 generation;
  503. /*
  504. * starting byte of this partition on the device,
  505. * to allow for stripe alignment in the future
  506. */
  507. __le64 start_offset;
  508. /* grouping information for allocation decisions */
  509. __le32 dev_group;
  510. /* seek speed 0-100 where 100 is fastest */
  511. __u8 seek_speed;
  512. /* bandwidth 0-100 where 100 is fastest */
  513. __u8 bandwidth;
  514. /* btrfs generated uuid for this device */
  515. __u8 uuid[BTRFS_UUID_SIZE];
  516. /* uuid of FS who owns this device */
  517. __u8 fsid[BTRFS_UUID_SIZE];
  518. } __attribute__ ((__packed__));
  519. struct btrfs_stripe {
  520. __le64 devid;
  521. __le64 offset;
  522. __u8 dev_uuid[BTRFS_UUID_SIZE];
  523. } __attribute__ ((__packed__));
  524. struct btrfs_chunk {
  525. /* size of this chunk in bytes */
  526. __le64 length;
  527. /* objectid of the root referencing this chunk */
  528. __le64 owner;
  529. __le64 stripe_len;
  530. __le64 type;
  531. /* optimal io alignment for this chunk */
  532. __le32 io_align;
  533. /* optimal io width for this chunk */
  534. __le32 io_width;
  535. /* minimal io size for this chunk */
  536. __le32 sector_size;
  537. /* 2^16 stripes is quite a lot, a second limit is the size of a single
  538. * item in the btree
  539. */
  540. __le16 num_stripes;
  541. /* sub stripes only matter for raid10 */
  542. __le16 sub_stripes;
  543. struct btrfs_stripe stripe;
  544. /* additional stripes go here */
  545. } __attribute__ ((__packed__));
  546. /*
  547. * The super block basically lists the main trees of the FS.
  548. */
  549. struct btrfs_super_block {
  550. /* The first 4 fields must match struct btrfs_header */
  551. __u8 csum[BTRFS_CSUM_SIZE];
  552. /* FS specific UUID, visible to user */
  553. __u8 fsid[BTRFS_FSID_SIZE];
  554. /* This block number */
  555. __le64 bytenr;
  556. __le64 flags;
  557. /* Allowed to be different from the btrfs_header from here own down */
  558. __le64 magic;
  559. __le64 generation;
  560. __le64 root;
  561. __le64 chunk_root;
  562. __le64 log_root;
  563. /*
  564. * This member has never been utilized since the very beginning, thus
  565. * it's always 0 regardless of kernel version. We always use
  566. * generation + 1 to read log tree root. So here we mark it deprecated.
  567. */
  568. __le64 __unused_log_root_transid;
  569. __le64 total_bytes;
  570. __le64 bytes_used;
  571. __le64 root_dir_objectid;
  572. __le64 num_devices;
  573. __le32 sectorsize;
  574. __le32 nodesize;
  575. __le32 __unused_leafsize;
  576. __le32 stripesize;
  577. __le32 sys_chunk_array_size;
  578. __le64 chunk_root_generation;
  579. __le64 compat_flags;
  580. __le64 compat_ro_flags;
  581. __le64 incompat_flags;
  582. __le16 csum_type;
  583. __u8 root_level;
  584. __u8 chunk_root_level;
  585. __u8 log_root_level;
  586. struct btrfs_dev_item dev_item;
  587. char label[BTRFS_LABEL_SIZE];
  588. __le64 cache_generation;
  589. __le64 uuid_tree_generation;
  590. /* The UUID written into btree blocks */
  591. __u8 metadata_uuid[BTRFS_FSID_SIZE];
  592. __u64 nr_global_roots;
  593. /* Future expansion */
  594. __le64 reserved[27];
  595. __u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE];
  596. struct btrfs_root_backup super_roots[BTRFS_NUM_BACKUP_ROOTS];
  597. /* Padded to 4096 bytes */
  598. __u8 padding[565];
  599. } __attribute__ ((__packed__));
  600. #define BTRFS_FREE_SPACE_EXTENT 1
  601. #define BTRFS_FREE_SPACE_BITMAP 2
  602. struct btrfs_free_space_entry {
  603. __le64 offset;
  604. __le64 bytes;
  605. __u8 type;
  606. } __attribute__ ((__packed__));
  607. struct btrfs_free_space_header {
  608. struct btrfs_disk_key location;
  609. __le64 generation;
  610. __le64 num_entries;
  611. __le64 num_bitmaps;
  612. } __attribute__ ((__packed__));
  613. struct btrfs_raid_stride {
  614. /* The id of device this raid extent lives on. */
  615. __le64 devid;
  616. /* The physical location on disk. */
  617. __le64 physical;
  618. } __attribute__ ((__packed__));
  619. struct btrfs_stripe_extent {
  620. /* An array of raid strides this stripe is composed of. */
  621. __DECLARE_FLEX_ARRAY(struct btrfs_raid_stride, strides);
  622. } __attribute__ ((__packed__));
  623. #define BTRFS_HEADER_FLAG_WRITTEN (1ULL << 0)
  624. #define BTRFS_HEADER_FLAG_RELOC (1ULL << 1)
  625. /* Super block flags */
  626. /* Errors detected */
  627. #define BTRFS_SUPER_FLAG_ERROR (1ULL << 2)
  628. #define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)
  629. #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)
  630. #define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)
  631. #define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)
  632. #define BTRFS_SUPER_FLAG_CHANGING_FSID_V2 (1ULL << 36)
  633. /*
  634. * Those are temporaray flags utilized by btrfs-progs to do offline conversion.
  635. * They are rejected by kernel.
  636. * But still keep them all here to avoid conflicts.
  637. */
  638. #define BTRFS_SUPER_FLAG_CHANGING_BG_TREE (1ULL << 38)
  639. #define BTRFS_SUPER_FLAG_CHANGING_DATA_CSUM (1ULL << 39)
  640. #define BTRFS_SUPER_FLAG_CHANGING_META_CSUM (1ULL << 40)
  641. /*
  642. * items in the extent btree are used to record the objectid of the
  643. * owner of the block and the number of references
  644. */
  645. struct btrfs_extent_item {
  646. __le64 refs;
  647. __le64 generation;
  648. __le64 flags;
  649. } __attribute__ ((__packed__));
  650. struct btrfs_extent_item_v0 {
  651. __le32 refs;
  652. } __attribute__ ((__packed__));
  653. #define BTRFS_EXTENT_FLAG_DATA (1ULL << 0)
  654. #define BTRFS_EXTENT_FLAG_TREE_BLOCK (1ULL << 1)
  655. /* following flags only apply to tree blocks */
  656. /* use full backrefs for extent pointers in the block */
  657. #define BTRFS_BLOCK_FLAG_FULL_BACKREF (1ULL << 8)
  658. #define BTRFS_BACKREF_REV_MAX 256
  659. #define BTRFS_BACKREF_REV_SHIFT 56
  660. #define BTRFS_BACKREF_REV_MASK (((u64)BTRFS_BACKREF_REV_MAX - 1) << \
  661. BTRFS_BACKREF_REV_SHIFT)
  662. #define BTRFS_OLD_BACKREF_REV 0
  663. #define BTRFS_MIXED_BACKREF_REV 1
  664. /*
  665. * this flag is only used internally by scrub and may be changed at any time
  666. * it is only declared here to avoid collisions
  667. */
  668. #define BTRFS_EXTENT_FLAG_SUPER (1ULL << 48)
  669. struct btrfs_tree_block_info {
  670. struct btrfs_disk_key key;
  671. __u8 level;
  672. } __attribute__ ((__packed__));
  673. struct btrfs_extent_data_ref {
  674. __le64 root;
  675. __le64 objectid;
  676. __le64 offset;
  677. __le32 count;
  678. } __attribute__ ((__packed__));
  679. struct btrfs_shared_data_ref {
  680. __le32 count;
  681. } __attribute__ ((__packed__));
  682. struct btrfs_extent_owner_ref {
  683. __le64 root_id;
  684. } __attribute__ ((__packed__));
  685. struct btrfs_extent_inline_ref {
  686. __u8 type;
  687. __le64 offset;
  688. } __attribute__ ((__packed__));
  689. /* dev extents record free space on individual devices. The owner
  690. * field points back to the chunk allocation mapping tree that allocated
  691. * the extent. The chunk tree uuid field is a way to double check the owner
  692. */
  693. struct btrfs_dev_extent {
  694. __le64 chunk_tree;
  695. __le64 chunk_objectid;
  696. __le64 chunk_offset;
  697. __le64 length;
  698. __u8 chunk_tree_uuid[BTRFS_UUID_SIZE];
  699. } __attribute__ ((__packed__));
  700. struct btrfs_inode_ref {
  701. __le64 index;
  702. __le16 name_len;
  703. /* name goes here */
  704. } __attribute__ ((__packed__));
  705. struct btrfs_inode_extref {
  706. __le64 parent_objectid;
  707. __le64 index;
  708. __le16 name_len;
  709. __u8 name[];
  710. /* name goes here */
  711. } __attribute__ ((__packed__));
  712. struct btrfs_timespec {
  713. __le64 sec;
  714. __le32 nsec;
  715. } __attribute__ ((__packed__));
  716. struct btrfs_inode_item {
  717. /* nfs style generation number */
  718. __le64 generation;
  719. /* transid that last touched this inode */
  720. __le64 transid;
  721. __le64 size;
  722. __le64 nbytes;
  723. __le64 block_group;
  724. __le32 nlink;
  725. __le32 uid;
  726. __le32 gid;
  727. __le32 mode;
  728. __le64 rdev;
  729. __le64 flags;
  730. /* modification sequence number for NFS */
  731. __le64 sequence;
  732. /*
  733. * a little future expansion, for more than this we can
  734. * just grow the inode item and version it
  735. */
  736. __le64 reserved[4];
  737. struct btrfs_timespec atime;
  738. struct btrfs_timespec ctime;
  739. struct btrfs_timespec mtime;
  740. struct btrfs_timespec otime;
  741. } __attribute__ ((__packed__));
  742. struct btrfs_dir_log_item {
  743. __le64 end;
  744. } __attribute__ ((__packed__));
  745. struct btrfs_dir_item {
  746. struct btrfs_disk_key location;
  747. __le64 transid;
  748. __le16 data_len;
  749. __le16 name_len;
  750. __u8 type;
  751. } __attribute__ ((__packed__));
  752. #define BTRFS_ROOT_SUBVOL_RDONLY (1ULL << 0)
  753. /*
  754. * Internal in-memory flag that a subvolume has been marked for deletion but
  755. * still visible as a directory
  756. */
  757. #define BTRFS_ROOT_SUBVOL_DEAD (1ULL << 48)
  758. struct btrfs_root_item {
  759. struct btrfs_inode_item inode;
  760. __le64 generation;
  761. __le64 root_dirid;
  762. __le64 bytenr;
  763. __le64 byte_limit;
  764. __le64 bytes_used;
  765. __le64 last_snapshot;
  766. __le64 flags;
  767. __le32 refs;
  768. struct btrfs_disk_key drop_progress;
  769. __u8 drop_level;
  770. __u8 level;
  771. /*
  772. * The following fields appear after subvol_uuids+subvol_times
  773. * were introduced.
  774. */
  775. /*
  776. * This generation number is used to test if the new fields are valid
  777. * and up to date while reading the root item. Every time the root item
  778. * is written out, the "generation" field is copied into this field. If
  779. * anyone ever mounted the fs with an older kernel, we will have
  780. * mismatching generation values here and thus must invalidate the
  781. * new fields. See btrfs_update_root and btrfs_find_last_root for
  782. * details.
  783. * the offset of generation_v2 is also used as the start for the memset
  784. * when invalidating the fields.
  785. */
  786. __le64 generation_v2;
  787. __u8 uuid[BTRFS_UUID_SIZE];
  788. __u8 parent_uuid[BTRFS_UUID_SIZE];
  789. __u8 received_uuid[BTRFS_UUID_SIZE];
  790. __le64 ctransid; /* updated when an inode changes */
  791. __le64 otransid; /* trans when created */
  792. __le64 stransid; /* trans when sent. non-zero for received subvol */
  793. __le64 rtransid; /* trans when received. non-zero for received subvol */
  794. struct btrfs_timespec ctime;
  795. struct btrfs_timespec otime;
  796. struct btrfs_timespec stime;
  797. struct btrfs_timespec rtime;
  798. __le64 reserved[8]; /* for future */
  799. } __attribute__ ((__packed__));
  800. /*
  801. * Btrfs root item used to be smaller than current size. The old format ends
  802. * at where member generation_v2 is.
  803. */
  804. static __inline__ __u32 btrfs_legacy_root_item_size(void)
  805. {
  806. return offsetof(struct btrfs_root_item, generation_v2);
  807. }
  808. /*
  809. * this is used for both forward and backward root refs
  810. */
  811. struct btrfs_root_ref {
  812. __le64 dirid;
  813. __le64 sequence;
  814. __le16 name_len;
  815. } __attribute__ ((__packed__));
  816. struct btrfs_disk_balance_args {
  817. /*
  818. * profiles to operate on, single is denoted by
  819. * BTRFS_AVAIL_ALLOC_BIT_SINGLE
  820. */
  821. __le64 profiles;
  822. /*
  823. * usage filter
  824. * BTRFS_BALANCE_ARGS_USAGE with a single value means '0..N'
  825. * BTRFS_BALANCE_ARGS_USAGE_RANGE - range syntax, min..max
  826. */
  827. union {
  828. __le64 usage;
  829. struct {
  830. __le32 usage_min;
  831. __le32 usage_max;
  832. };
  833. };
  834. /* devid filter */
  835. __le64 devid;
  836. /* devid subset filter [pstart..pend) */
  837. __le64 pstart;
  838. __le64 pend;
  839. /* btrfs virtual address space subset filter [vstart..vend) */
  840. __le64 vstart;
  841. __le64 vend;
  842. /*
  843. * profile to convert to, single is denoted by
  844. * BTRFS_AVAIL_ALLOC_BIT_SINGLE
  845. */
  846. __le64 target;
  847. /* BTRFS_BALANCE_ARGS_* */
  848. __le64 flags;
  849. /*
  850. * BTRFS_BALANCE_ARGS_LIMIT with value 'limit'
  851. * BTRFS_BALANCE_ARGS_LIMIT_RANGE - the extend version can use minimum
  852. * and maximum
  853. */
  854. union {
  855. __le64 limit;
  856. struct {
  857. __le32 limit_min;
  858. __le32 limit_max;
  859. };
  860. };
  861. /*
  862. * Process chunks that cross stripes_min..stripes_max devices,
  863. * BTRFS_BALANCE_ARGS_STRIPES_RANGE
  864. */
  865. __le32 stripes_min;
  866. __le32 stripes_max;
  867. __le64 unused[6];
  868. } __attribute__ ((__packed__));
  869. /*
  870. * store balance parameters to disk so that balance can be properly
  871. * resumed after crash or unmount
  872. */
  873. struct btrfs_balance_item {
  874. /* BTRFS_BALANCE_* */
  875. __le64 flags;
  876. struct btrfs_disk_balance_args data;
  877. struct btrfs_disk_balance_args meta;
  878. struct btrfs_disk_balance_args sys;
  879. __le64 unused[4];
  880. } __attribute__ ((__packed__));
  881. enum {
  882. BTRFS_FILE_EXTENT_INLINE = 0,
  883. BTRFS_FILE_EXTENT_REG = 1,
  884. BTRFS_FILE_EXTENT_PREALLOC = 2,
  885. BTRFS_NR_FILE_EXTENT_TYPES = 3,
  886. };
  887. struct btrfs_file_extent_item {
  888. /*
  889. * transaction id that created this extent
  890. */
  891. __le64 generation;
  892. /*
  893. * max number of bytes to hold this extent in ram
  894. * when we split a compressed extent we can't know how big
  895. * each of the resulting pieces will be. So, this is
  896. * an upper limit on the size of the extent in ram instead of
  897. * an exact limit.
  898. */
  899. __le64 ram_bytes;
  900. /*
  901. * 32 bits for the various ways we might encode the data,
  902. * including compression and encryption. If any of these
  903. * are set to something a given disk format doesn't understand
  904. * it is treated like an incompat flag for reading and writing,
  905. * but not for stat.
  906. */
  907. __u8 compression;
  908. __u8 encryption;
  909. __le16 other_encoding; /* spare for later use */
  910. /* are we __inline__ data or a real extent? */
  911. __u8 type;
  912. /*
  913. * disk space consumed by the extent, checksum blocks are included
  914. * in these numbers
  915. *
  916. * At this offset in the structure, the __inline__ extent data start.
  917. */
  918. __le64 disk_bytenr;
  919. __le64 disk_num_bytes;
  920. /*
  921. * the logical offset in file blocks (no csums)
  922. * this extent record is for. This allows a file extent to point
  923. * into the middle of an existing extent on disk, sharing it
  924. * between two snapshots (useful if some bytes in the middle of the
  925. * extent have changed
  926. */
  927. __le64 offset;
  928. /*
  929. * the logical number of file blocks (no csums included). This
  930. * always reflects the size uncompressed and without encoding.
  931. */
  932. __le64 num_bytes;
  933. } __attribute__ ((__packed__));
  934. struct btrfs_csum_item {
  935. __u8 csum;
  936. } __attribute__ ((__packed__));
  937. struct btrfs_dev_stats_item {
  938. /*
  939. * grow this item struct at the end for future enhancements and keep
  940. * the existing values unchanged
  941. */
  942. __le64 values[BTRFS_DEV_STAT_VALUES_MAX];
  943. } __attribute__ ((__packed__));
  944. #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_ALWAYS 0
  945. #define BTRFS_DEV_REPLACE_ITEM_CONT_READING_FROM_SRCDEV_MODE_AVOID 1
  946. struct btrfs_dev_replace_item {
  947. /*
  948. * grow this item struct at the end for future enhancements and keep
  949. * the existing values unchanged
  950. */
  951. __le64 src_devid;
  952. __le64 cursor_left;
  953. __le64 cursor_right;
  954. __le64 cont_reading_from_srcdev_mode;
  955. __le64 replace_state;
  956. __le64 time_started;
  957. __le64 time_stopped;
  958. __le64 num_write_errors;
  959. __le64 num_uncorrectable_read_errors;
  960. } __attribute__ ((__packed__));
  961. /* different types of block groups (and chunks) */
  962. #define BTRFS_BLOCK_GROUP_DATA (1ULL << 0)
  963. #define BTRFS_BLOCK_GROUP_SYSTEM (1ULL << 1)
  964. #define BTRFS_BLOCK_GROUP_METADATA (1ULL << 2)
  965. #define BTRFS_BLOCK_GROUP_RAID0 (1ULL << 3)
  966. #define BTRFS_BLOCK_GROUP_RAID1 (1ULL << 4)
  967. #define BTRFS_BLOCK_GROUP_DUP (1ULL << 5)
  968. #define BTRFS_BLOCK_GROUP_RAID10 (1ULL << 6)
  969. #define BTRFS_BLOCK_GROUP_RAID5 (1ULL << 7)
  970. #define BTRFS_BLOCK_GROUP_RAID6 (1ULL << 8)
  971. #define BTRFS_BLOCK_GROUP_RAID1C3 (1ULL << 9)
  972. #define BTRFS_BLOCK_GROUP_RAID1C4 (1ULL << 10)
  973. #define BTRFS_BLOCK_GROUP_RESERVED (BTRFS_AVAIL_ALLOC_BIT_SINGLE | \
  974. BTRFS_SPACE_INFO_GLOBAL_RSV)
  975. #define BTRFS_BLOCK_GROUP_TYPE_MASK (BTRFS_BLOCK_GROUP_DATA | \
  976. BTRFS_BLOCK_GROUP_SYSTEM | \
  977. BTRFS_BLOCK_GROUP_METADATA)
  978. #define BTRFS_BLOCK_GROUP_PROFILE_MASK (BTRFS_BLOCK_GROUP_RAID0 | \
  979. BTRFS_BLOCK_GROUP_RAID1 | \
  980. BTRFS_BLOCK_GROUP_RAID1C3 | \
  981. BTRFS_BLOCK_GROUP_RAID1C4 | \
  982. BTRFS_BLOCK_GROUP_RAID5 | \
  983. BTRFS_BLOCK_GROUP_RAID6 | \
  984. BTRFS_BLOCK_GROUP_DUP | \
  985. BTRFS_BLOCK_GROUP_RAID10)
  986. #define BTRFS_BLOCK_GROUP_RAID56_MASK (BTRFS_BLOCK_GROUP_RAID5 | \
  987. BTRFS_BLOCK_GROUP_RAID6)
  988. #define BTRFS_BLOCK_GROUP_RAID1_MASK (BTRFS_BLOCK_GROUP_RAID1 | \
  989. BTRFS_BLOCK_GROUP_RAID1C3 | \
  990. BTRFS_BLOCK_GROUP_RAID1C4)
  991. /*
  992. * We need a bit for restriper to be able to tell when chunks of type
  993. * SINGLE are available. This "extended" profile format is used in
  994. * fs_info->avail_*_alloc_bits (in-memory) and balance item fields
  995. * (on-disk). The corresponding on-disk bit in chunk.type is reserved
  996. * to avoid remappings between two formats in future.
  997. */
  998. #define BTRFS_AVAIL_ALLOC_BIT_SINGLE (1ULL << 48)
  999. /*
  1000. * A fake block group type that is used to communicate global block reserve
  1001. * size to userspace via the SPACE_INFO ioctl.
  1002. */
  1003. #define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49)
  1004. #define BTRFS_EXTENDED_PROFILE_MASK (BTRFS_BLOCK_GROUP_PROFILE_MASK | \
  1005. BTRFS_AVAIL_ALLOC_BIT_SINGLE)
  1006. static __inline__ __u64 chunk_to_extended(__u64 flags)
  1007. {
  1008. if ((flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0)
  1009. flags |= BTRFS_AVAIL_ALLOC_BIT_SINGLE;
  1010. return flags;
  1011. }
  1012. static __inline__ __u64 extended_to_chunk(__u64 flags)
  1013. {
  1014. return flags & ~BTRFS_AVAIL_ALLOC_BIT_SINGLE;
  1015. }
  1016. struct btrfs_block_group_item {
  1017. __le64 used;
  1018. __le64 chunk_objectid;
  1019. __le64 flags;
  1020. } __attribute__ ((__packed__));
  1021. struct btrfs_free_space_info {
  1022. __le32 extent_count;
  1023. __le32 flags;
  1024. } __attribute__ ((__packed__));
  1025. #define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
  1026. #define BTRFS_QGROUP_LEVEL_SHIFT 48
  1027. static __inline__ __u16 btrfs_qgroup_level(__u64 qgroupid)
  1028. {
  1029. return (__u16)(qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT);
  1030. }
  1031. /*
  1032. * is subvolume quota turned on?
  1033. */
  1034. #define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0)
  1035. /*
  1036. * RESCAN is set during the initialization phase
  1037. */
  1038. #define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1)
  1039. /*
  1040. * Some qgroup entries are known to be out of date,
  1041. * either because the configuration has changed in a way that
  1042. * makes a rescan necessary, or because the fs has been mounted
  1043. * with a non-qgroup-aware version.
  1044. * Turning qouta off and on again makes it inconsistent, too.
  1045. */
  1046. #define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2)
  1047. /*
  1048. * Whether or not this filesystem is using simple quotas. Not exactly the
  1049. * incompat bit, because we support using simple quotas, disabling it, then
  1050. * going back to full qgroup quotas.
  1051. */
  1052. #define BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE (1ULL << 3)
  1053. #define BTRFS_QGROUP_STATUS_FLAGS_MASK (BTRFS_QGROUP_STATUS_FLAG_ON | \
  1054. BTRFS_QGROUP_STATUS_FLAG_RESCAN | \
  1055. BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT | \
  1056. BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE)
  1057. #define BTRFS_QGROUP_STATUS_VERSION 1
  1058. struct btrfs_qgroup_status_item {
  1059. __le64 version;
  1060. /*
  1061. * the generation is updated during every commit. As older
  1062. * versions of btrfs are not aware of qgroups, it will be
  1063. * possible to detect inconsistencies by checking the
  1064. * generation on mount time
  1065. */
  1066. __le64 generation;
  1067. /* flag definitions see above */
  1068. __le64 flags;
  1069. /*
  1070. * only used during scanning to record the progress
  1071. * of the scan. It contains a logical address
  1072. */
  1073. __le64 rescan;
  1074. /*
  1075. * The generation when quotas were last enabled. Used by simple quotas to
  1076. * avoid decrementing when freeing an extent that was written before
  1077. * enable.
  1078. *
  1079. * Set only if flags contain BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE.
  1080. */
  1081. __le64 enable_gen;
  1082. } __attribute__ ((__packed__));
  1083. struct btrfs_qgroup_info_item {
  1084. __le64 generation;
  1085. __le64 rfer;
  1086. __le64 rfer_cmpr;
  1087. __le64 excl;
  1088. __le64 excl_cmpr;
  1089. } __attribute__ ((__packed__));
  1090. struct btrfs_qgroup_limit_item {
  1091. /*
  1092. * only updated when any of the other values change
  1093. */
  1094. __le64 flags;
  1095. __le64 max_rfer;
  1096. __le64 max_excl;
  1097. __le64 rsv_rfer;
  1098. __le64 rsv_excl;
  1099. } __attribute__ ((__packed__));
  1100. struct btrfs_verity_descriptor_item {
  1101. /* Size of the verity descriptor in bytes */
  1102. __le64 size;
  1103. /*
  1104. * When we implement support for fscrypt, we will need to encrypt the
  1105. * Merkle tree for encrypted verity files. These 128 bits are for the
  1106. * eventual storage of an fscrypt initialization vector.
  1107. */
  1108. __le64 reserved[2];
  1109. __u8 encryption;
  1110. } __attribute__ ((__packed__));
  1111. #endif /* _BTRFS_CTREE_H_ */