diff options
Diffstat (limited to 'fs/ext4/ext4_extents.h')
-rw-r--r-- | fs/ext4/ext4_extents.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index 0f58b86e3a0..cb1b2c91996 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h | |||
@@ -63,9 +63,22 @@ | |||
63 | * ext4_inode has i_block array (60 bytes total). | 63 | * ext4_inode has i_block array (60 bytes total). |
64 | * The first 12 bytes store ext4_extent_header; | 64 | * The first 12 bytes store ext4_extent_header; |
65 | * the remainder stores an array of ext4_extent. | 65 | * the remainder stores an array of ext4_extent. |
66 | * For non-inode extent blocks, ext4_extent_tail | ||
67 | * follows the array. | ||
66 | */ | 68 | */ |
67 | 69 | ||
68 | /* | 70 | /* |
71 | * This is the extent tail on-disk structure. | ||
72 | * All other extent structures are 12 bytes long. It turns out that | ||
73 | * block_size % 12 >= 4 for at least all powers of 2 greater than 512, which | ||
74 | * covers all valid ext4 block sizes. Therefore, this tail structure can be | ||
75 | * crammed into the end of the block without having to rebalance the tree. | ||
76 | */ | ||
77 | struct ext4_extent_tail { | ||
78 | __le32 et_checksum; /* crc32c(uuid+inum+extent_block) */ | ||
79 | }; | ||
80 | |||
81 | /* | ||
69 | * This is the extent on-disk structure. | 82 | * This is the extent on-disk structure. |
70 | * It's used at the bottom of the tree. | 83 | * It's used at the bottom of the tree. |
71 | */ | 84 | */ |
@@ -101,6 +114,17 @@ struct ext4_extent_header { | |||
101 | 114 | ||
102 | #define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) | 115 | #define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) |
103 | 116 | ||
117 | #define EXT4_EXTENT_TAIL_OFFSET(hdr) \ | ||
118 | (sizeof(struct ext4_extent_header) + \ | ||
119 | (sizeof(struct ext4_extent) * le16_to_cpu((hdr)->eh_max))) | ||
120 | |||
121 | static inline struct ext4_extent_tail * | ||
122 | find_ext4_extent_tail(struct ext4_extent_header *eh) | ||
123 | { | ||
124 | return (struct ext4_extent_tail *)(((void *)eh) + | ||
125 | EXT4_EXTENT_TAIL_OFFSET(eh)); | ||
126 | } | ||
127 | |||
104 | /* | 128 | /* |
105 | * Array of ext4_ext_path contains path to some extent. | 129 | * Array of ext4_ext_path contains path to some extent. |
106 | * Creation/lookup routines use it for traversal/splitting/etc. | 130 | * Creation/lookup routines use it for traversal/splitting/etc. |