btrfs_tree.h 32 KB

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