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