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
23 #define BTRFS_BLOCK_SIZE (1 << BTRFS_BLOCK_SHIFT)
25 #define BTRFS_SUPER_MIRROR_MAX 3
26 #define BTRFS_SUPER_MIRROR_SHIFT 12
27 #define BTRFS_CSUM_SIZE 32
28 #define BTRFS_FSID_SIZE 16
29 #define BTRFS_LABEL_SIZE 256
30 #define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048
31 #define BTRFS_UUID_SIZE 16
33 #define BTRFS_MAGIC "_BHRfS_M"
35 #define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)
37 #define BTRFS_DEV_ITEM_KEY 216
38 #define BTRFS_CHUNK_ITEM_KEY 228
39 #define BTRFS_ROOT_REF_KEY 156
40 #define BTRFS_ROOT_ITEM_KEY 132
41 #define BTRFS_EXTENT_DATA_KEY 108
42 #define BTRFS_DIR_ITEM_KEY 84
43 #define BTRFS_INODE_ITEM_KEY 1
45 #define BTRFS_EXTENT_TREE_OBJECTID 2ULL
46 #define BTRFS_FS_TREE_OBJECTID 5ULL
48 #define BTRFS_FIRST_CHUNK_TREE_OBJECTID 256ULL
50 #define BTRFS_FILE_EXTENT_INLINE 0
51 #define BTRFS_FILE_EXTENT_REG 1
52 #define BTRFS_FILE_EXTENT_PREALLOC 2
54 #define BTRFS_MAX_LEVEL 8
55 #define BTRFS_MAX_CHUNK_ENTRIES 256
57 #define BTRFS_FT_REG_FILE 1
58 #define BTRFS_FT_DIR 2
59 #define BTRFS_FT_SYMLINK 7
61 #define ROOT_DIR_WORD 0x002f
63 struct btrfs_dev_item
{
76 u8 uuid
[BTRFS_UUID_SIZE
];
77 u8 fsid
[BTRFS_UUID_SIZE
];
78 } __attribute__ ((__packed__
));
80 struct btrfs_super_block
{
81 u8 csum
[BTRFS_CSUM_SIZE
];
82 /* the first 3 fields must match struct btrfs_header */
83 u8 fsid
[BTRFS_FSID_SIZE
]; /* FS specific uuid */
84 __le64 bytenr
; /* this block number */
87 /* allowed to be different from the btrfs_header from here own down */
94 /* this will help find the new super based on the log root */
95 __le64 log_root_transid
;
98 __le64 root_dir_objectid
;
104 __le32 sys_chunk_array_size
;
105 __le64 chunk_root_generation
;
107 __le64 compat_ro_flags
;
108 __le64 incompat_flags
;
113 struct btrfs_dev_item dev_item
;
115 char label
[BTRFS_LABEL_SIZE
];
117 /* future expansion */
119 u8 sys_chunk_array
[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE
];
120 } __attribute__ ((__packed__
));
122 struct btrfs_disk_key
{
126 } __attribute__ ((__packed__
));
128 struct btrfs_stripe
{
131 u8 dev_uuid
[BTRFS_UUID_SIZE
];
132 } __attribute__ ((__packed__
));
144 struct btrfs_stripe stripe
;
145 } __attribute__ ((__packed__
));
147 struct btrfs_header
{
148 /* these first four must match the super block */
149 u8 csum
[BTRFS_CSUM_SIZE
];
150 u8 fsid
[BTRFS_FSID_SIZE
]; /* FS specific uuid */
151 __le64 bytenr
; /* which block this node is supposed to live in */
154 /* allowed to be different from the super from here on down */
155 u8 chunk_tree_uuid
[BTRFS_UUID_SIZE
];
160 } __attribute__ ((__packed__
));
163 struct btrfs_disk_key key
;
166 } __attribute__ ((__packed__
));
169 struct btrfs_header header
;
170 struct btrfs_item items
[];
171 } __attribute__ ((__packed__
));
173 struct btrfs_key_ptr
{
174 struct btrfs_disk_key key
;
177 } __attribute__ ((__packed__
));
180 struct btrfs_header header
;
181 struct btrfs_key_ptr ptrs
[];
182 } __attribute__ ((__packed__
));
184 /* remember how we get to a node/leaf */
186 u64 offsets
[BTRFS_MAX_LEVEL
];
187 int itemsnr
[BTRFS_MAX_LEVEL
];
188 int slots
[BTRFS_MAX_LEVEL
];
189 /* remember last slot's item and data */
190 struct btrfs_item item
;
191 u8 data
[BTRFS_MAX_LEAF_SIZE
];
194 /* store logical offset to physical offset mapping */
195 struct btrfs_chunk_map_item
{
202 struct btrfs_chunk_map
{
203 struct btrfs_chunk_map_item
*map
;
208 struct btrfs_timespec
{
211 } __attribute__ ((__packed__
));
213 struct btrfs_inode_item
{
214 /* nfs style generation number */
216 /* transid that last touched this inode */
228 /* modification sequence number for NFS */
232 * a little future expansion, for more than this we can
233 * just grow the inode item and version it
236 struct btrfs_timespec atime
;
237 struct btrfs_timespec ctime
;
238 struct btrfs_timespec mtime
;
239 struct btrfs_timespec otime
;
240 } __attribute__ ((__packed__
));
242 struct btrfs_root_item
{
243 struct btrfs_inode_item inode
;
249 __le64 last_snapshot
;
252 struct btrfs_disk_key drop_progress
;
255 } __attribute__ ((__packed__
));
257 struct btrfs_dir_item
{
258 struct btrfs_disk_key location
;
263 } __attribute__ ((__packed__
));
265 struct btrfs_file_extent_item
{
270 __le16 other_encoding
; /* spare for later use */
273 __le64 disk_num_bytes
;
276 } __attribute__ ((__packed__
));
278 struct btrfs_root_ref
{
282 } __attribute__ ((__packed__
));
285 * btrfs private inode information
287 struct btrfs_pvt_inode
{
291 #define PVT(i) ((struct btrfs_pvt_inode *)((i)->pvt))