11 /* type that store on disk, but it is same as cpu type for i386 arch */
17 #define btrfs_crc32c crc32c_le
19 #define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
20 #define BTRFS_SUPER_INFO_SIZE 4096
21 #define BTRFS_MAX_LEAF_SIZE 4096
22 #define BTRFS_BLOCK_SHIFT 12
24 #define BTRFS_SUPER_MIRROR_MAX 3
25 #define BTRFS_SUPER_MIRROR_SHIFT 12
26 #define BTRFS_CSUM_SIZE 32
27 #define BTRFS_FSID_SIZE 16
28 #define BTRFS_LABEL_SIZE 256
29 #define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
30 #define BTRFS_UUID_SIZE 16
32 #define BTRFS_MAGIC "_BHRfS_M"
34 #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)
36 #define BTRFS_DEV_ITEM_KEY 216
37 #define BTRFS_CHUNK_ITEM_KEY 228
38 #define BTRFS_ROOT_REF_KEY 156
39 #define BTRFS_ROOT_ITEM_KEY 132
40 #define BTRFS_EXTENT_DATA_KEY 108
41 #define BTRFS_DIR_ITEM_KEY 84
42 #define BTRFS_INODE_ITEM_KEY 1
44 #define BTRFS_EXTENT_TREE_OBJECTID 2ULL
45 #define BTRFS_FS_TREE_OBJECTID 5ULL
47 #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
49 #define BTRFS_FILE_EXTENT_INLINE 0
50 #define BTRFS_FILE_EXTENT_REG 1
51 #define BTRFS_FILE_EXTENT_PREALLOC 2
53 #define BTRFS_MAX_LEVEL 8
54 #define BTRFS_MAX_CHUNK_ENTRIES 256
56 #define BTRFS_FT_REG_FILE 1
57 #define BTRFS_FT_DIR 2
58 #define BTRFS_FT_SYMLINK 7
60 #define ROOT_DIR_WORD 0x002f
62 struct btrfs_dev_item
{
75 u8 uuid
[BTRFS_UUID_SIZE
];
76 u8 fsid
[BTRFS_UUID_SIZE
];
77 } __attribute__ ((__packed__
));
79 struct btrfs_super_block
{
80 u8 csum
[BTRFS_CSUM_SIZE
];
81 /* the first 3 fields must match struct btrfs_header */
82 u8 fsid
[BTRFS_FSID_SIZE
]; /* FS specific uuid */
83 __le64 bytenr
; /* this block number */
86 /* allowed to be different from the btrfs_header from here own down */
93 /* this will help find the new super based on the log root */
94 __le64 log_root_transid
;
97 __le64 root_dir_objectid
;
103 __le32 sys_chunk_array_size
;
104 __le64 chunk_root_generation
;
106 __le64 compat_ro_flags
;
107 __le64 incompat_flags
;
112 struct btrfs_dev_item dev_item
;
114 char label
[BTRFS_LABEL_SIZE
];
116 /* future expansion */
118 u8 sys_chunk_array
[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE
];
119 } __attribute__ ((__packed__
));
121 struct btrfs_disk_key
{
125 } __attribute__ ((__packed__
));
127 struct btrfs_stripe
{
130 u8 dev_uuid
[BTRFS_UUID_SIZE
];
131 } __attribute__ ((__packed__
));
143 struct btrfs_stripe stripe
;
144 } __attribute__ ((__packed__
));
146 struct btrfs_header
{
147 /* these first four must match the super block */
148 u8 csum
[BTRFS_CSUM_SIZE
];
149 u8 fsid
[BTRFS_FSID_SIZE
]; /* FS specific uuid */
150 __le64 bytenr
; /* which block this node is supposed to live in */
153 /* allowed to be different from the super from here on down */
154 u8 chunk_tree_uuid
[BTRFS_UUID_SIZE
];
159 } __attribute__ ((__packed__
));
162 struct btrfs_disk_key key
;
165 } __attribute__ ((__packed__
));
168 struct btrfs_header header
;
169 struct btrfs_item items
[];
170 } __attribute__ ((__packed__
));
172 struct btrfs_key_ptr
{
173 struct btrfs_disk_key key
;
176 } __attribute__ ((__packed__
));
179 struct btrfs_header header
;
180 struct btrfs_key_ptr ptrs
[];
181 } __attribute__ ((__packed__
));
183 /* remember how we get to a node/leaf */
185 u64 offsets
[BTRFS_MAX_LEVEL
];
186 int itemsnr
[BTRFS_MAX_LEVEL
];
187 int slots
[BTRFS_MAX_LEVEL
];
188 /* remember last slot's item and data */
189 struct btrfs_item item
;
190 u8 data
[BTRFS_MAX_LEAF_SIZE
];
193 /* store logical offset to physical offset mapping */
194 struct btrfs_chunk_map_item
{
201 struct btrfs_chunk_map
{
202 struct btrfs_chunk_map_item
*map
;
207 struct btrfs_timespec
{
210 } __attribute__ ((__packed__
));
212 struct btrfs_inode_item
{
213 /* nfs style generation number */
215 /* transid that last touched this inode */
227 /* modification sequence number for NFS */
231 * a little future expansion, for more than this we can
232 * just grow the inode item and version it
235 struct btrfs_timespec atime
;
236 struct btrfs_timespec ctime
;
237 struct btrfs_timespec mtime
;
238 struct btrfs_timespec otime
;
239 } __attribute__ ((__packed__
));
241 struct btrfs_root_item
{
242 struct btrfs_inode_item inode
;
248 __le64 last_snapshot
;
251 struct btrfs_disk_key drop_progress
;
254 } __attribute__ ((__packed__
));
256 struct btrfs_dir_item
{
257 struct btrfs_disk_key location
;
262 } __attribute__ ((__packed__
));
264 struct btrfs_file_extent_item
{
269 __le16 other_encoding
; /* spare for later use */
272 __le64 disk_num_bytes
;
275 } __attribute__ ((__packed__
));
277 struct btrfs_root_ref
{
281 } __attribute__ ((__packed__
));
284 * btrfs private inode information
286 struct btrfs_pvt_inode
{
290 #define PVT(i) ((struct btrfs_pvt_inode *)((i)->pvt))