diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/ext4/ext4_extents.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'fs/ext4/ext4_extents.h')
-rw-r--r-- | fs/ext4/ext4_extents.h | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index 487fda12bc0..095c36f3b61 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h | |||
@@ -43,6 +43,16 @@ | |||
43 | #define CHECK_BINSEARCH__ | 43 | #define CHECK_BINSEARCH__ |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Turn on EXT_DEBUG to get lots of info about extents operations. | ||
47 | */ | ||
48 | #define EXT_DEBUG__ | ||
49 | #ifdef EXT_DEBUG | ||
50 | #define ext_debug(a...) printk(a) | ||
51 | #else | ||
52 | #define ext_debug(a...) | ||
53 | #endif | ||
54 | |||
55 | /* | ||
46 | * If EXT_STATS is defined then stats numbers are collected. | 56 | * If EXT_STATS is defined then stats numbers are collected. |
47 | * These number will be displayed at umount time. | 57 | * These number will be displayed at umount time. |
48 | */ | 58 | */ |
@@ -53,20 +63,7 @@ | |||
53 | * ext4_inode has i_block array (60 bytes total). | 63 | * ext4_inode has i_block array (60 bytes total). |
54 | * The first 12 bytes store ext4_extent_header; | 64 | * The first 12 bytes store ext4_extent_header; |
55 | * the remainder stores an array of ext4_extent. | 65 | * the remainder stores an array of ext4_extent. |
56 | * For non-inode extent blocks, ext4_extent_tail | ||
57 | * follows the array. | ||
58 | */ | ||
59 | |||
60 | /* | ||
61 | * This is the extent tail on-disk structure. | ||
62 | * All other extent structures are 12 bytes long. It turns out that | ||
63 | * block_size % 12 >= 4 for at least all powers of 2 greater than 512, which | ||
64 | * covers all valid ext4 block sizes. Therefore, this tail structure can be | ||
65 | * crammed into the end of the block without having to rebalance the tree. | ||
66 | */ | 66 | */ |
67 | struct ext4_extent_tail { | ||
68 | __le32 et_checksum; /* crc32c(uuid+inum+extent_block) */ | ||
69 | }; | ||
70 | 67 | ||
71 | /* | 68 | /* |
72 | * This is the extent on-disk structure. | 69 | * This is the extent on-disk structure. |
@@ -104,17 +101,6 @@ struct ext4_extent_header { | |||
104 | 101 | ||
105 | #define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) | 102 | #define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) |
106 | 103 | ||
107 | #define EXT4_EXTENT_TAIL_OFFSET(hdr) \ | ||
108 | (sizeof(struct ext4_extent_header) + \ | ||
109 | (sizeof(struct ext4_extent) * le16_to_cpu((hdr)->eh_max))) | ||
110 | |||
111 | static inline struct ext4_extent_tail * | ||
112 | find_ext4_extent_tail(struct ext4_extent_header *eh) | ||
113 | { | ||
114 | return (struct ext4_extent_tail *)(((void *)eh) + | ||
115 | EXT4_EXTENT_TAIL_OFFSET(eh)); | ||
116 | } | ||
117 | |||
118 | /* | 104 | /* |
119 | * Array of ext4_ext_path contains path to some extent. | 105 | * Array of ext4_ext_path contains path to some extent. |
120 | * Creation/lookup routines use it for traversal/splitting/etc. | 106 | * Creation/lookup routines use it for traversal/splitting/etc. |
@@ -134,6 +120,20 @@ struct ext4_ext_path { | |||
134 | */ | 120 | */ |
135 | 121 | ||
136 | /* | 122 | /* |
123 | * to be called by ext4_ext_walk_space() | ||
124 | * negative retcode - error | ||
125 | * positive retcode - signal for ext4_ext_walk_space(), see below | ||
126 | * callback must return valid extent (passed or newly created) | ||
127 | */ | ||
128 | typedef int (*ext_prepare_callback)(struct inode *, ext4_lblk_t, | ||
129 | struct ext4_ext_cache *, | ||
130 | struct ext4_extent *, void *); | ||
131 | |||
132 | #define EXT_CONTINUE 0 | ||
133 | #define EXT_BREAK 1 | ||
134 | #define EXT_REPEAT 2 | ||
135 | |||
136 | /* | ||
137 | * Maximum number of logical blocks in a file; ext4_extent's ee_block is | 137 | * Maximum number of logical blocks in a file; ext4_extent's ee_block is |
138 | * __le32. | 138 | * __le32. |
139 | */ | 139 | */ |
@@ -276,5 +276,19 @@ static inline void ext4_idx_store_pblock(struct ext4_extent_idx *ix, | |||
276 | 0xffff); | 276 | 0xffff); |
277 | } | 277 | } |
278 | 278 | ||
279 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, | ||
280 | ext4_lblk_t lblocks); | ||
281 | extern int ext4_extent_tree_init(handle_t *, struct inode *); | ||
282 | extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, | ||
283 | int num, | ||
284 | struct ext4_ext_path *path); | ||
285 | extern int ext4_can_extents_be_merged(struct inode *inode, | ||
286 | struct ext4_extent *ex1, | ||
287 | struct ext4_extent *ex2); | ||
288 | extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *, int); | ||
289 | extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t, | ||
290 | struct ext4_ext_path *); | ||
291 | extern void ext4_ext_drop_refs(struct ext4_ext_path *); | ||
292 | extern int ext4_ext_check_inode(struct inode *inode); | ||
279 | #endif /* _EXT4_EXTENTS */ | 293 | #endif /* _EXT4_EXTENTS */ |
280 | 294 | ||