Commit bf89d16f6ef5389f1b9d8046e838ec87b9b3f8b9
1 parent
1f109d5a17
Exists in
master
and in
7 other branches
ext4: rename {ext,idx}_pblock and inline small extent functions
Cleanup namespace leaks from fs/ext4 and the inline trivial functions ext4_{ext,idx}_pblock() and ext4_{ext,idx}_store_pblock() since the code size actually shrinks when we make these functions inline, they're so trivial. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Showing 4 changed files with 121 additions and 118 deletions Side-by-side Diff
fs/ext4/ext4_extents.h
... | ... | @@ -225,11 +225,60 @@ |
225 | 225 | ext->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ext)); |
226 | 226 | } |
227 | 227 | |
228 | +/* | |
229 | + * ext4_ext_pblock: | |
230 | + * combine low and high parts of physical block number into ext4_fsblk_t | |
231 | + */ | |
232 | +static inline ext4_fsblk_t ext4_ext_pblock(struct ext4_extent *ex) | |
233 | +{ | |
234 | + ext4_fsblk_t block; | |
235 | + | |
236 | + block = le32_to_cpu(ex->ee_start_lo); | |
237 | + block |= ((ext4_fsblk_t) le16_to_cpu(ex->ee_start_hi) << 31) << 1; | |
238 | + return block; | |
239 | +} | |
240 | + | |
241 | +/* | |
242 | + * ext4_idx_pblock: | |
243 | + * combine low and high parts of a leaf physical block number into ext4_fsblk_t | |
244 | + */ | |
245 | +static inline ext4_fsblk_t ext4_idx_pblock(struct ext4_extent_idx *ix) | |
246 | +{ | |
247 | + ext4_fsblk_t block; | |
248 | + | |
249 | + block = le32_to_cpu(ix->ei_leaf_lo); | |
250 | + block |= ((ext4_fsblk_t) le16_to_cpu(ix->ei_leaf_hi) << 31) << 1; | |
251 | + return block; | |
252 | +} | |
253 | + | |
254 | +/* | |
255 | + * ext4_ext_store_pblock: | |
256 | + * stores a large physical block number into an extent struct, | |
257 | + * breaking it into parts | |
258 | + */ | |
259 | +static inline void ext4_ext_store_pblock(struct ext4_extent *ex, | |
260 | + ext4_fsblk_t pb) | |
261 | +{ | |
262 | + ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff)); | |
263 | + ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & | |
264 | + 0xffff); | |
265 | +} | |
266 | + | |
267 | +/* | |
268 | + * ext4_idx_store_pblock: | |
269 | + * stores a large physical block number into an index struct, | |
270 | + * breaking it into parts | |
271 | + */ | |
272 | +static inline void ext4_idx_store_pblock(struct ext4_extent_idx *ix, | |
273 | + ext4_fsblk_t pb) | |
274 | +{ | |
275 | + ix->ei_leaf_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff)); | |
276 | + ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & | |
277 | + 0xffff); | |
278 | +} | |
279 | + | |
228 | 280 | extern int ext4_ext_calc_metadata_amount(struct inode *inode, |
229 | 281 | sector_t lblocks); |
230 | -extern ext4_fsblk_t ext_pblock(struct ext4_extent *ex); | |
231 | -extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); | |
232 | -extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); | |
233 | 282 | extern int ext4_extent_tree_init(handle_t *, struct inode *); |
234 | 283 | extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode, |
235 | 284 | int num, |
fs/ext4/extents.c
... | ... | @@ -44,55 +44,6 @@ |
44 | 44 | #include "ext4_jbd2.h" |
45 | 45 | #include "ext4_extents.h" |
46 | 46 | |
47 | - | |
48 | -/* | |
49 | - * ext_pblock: | |
50 | - * combine low and high parts of physical block number into ext4_fsblk_t | |
51 | - */ | |
52 | -ext4_fsblk_t ext_pblock(struct ext4_extent *ex) | |
53 | -{ | |
54 | - ext4_fsblk_t block; | |
55 | - | |
56 | - block = le32_to_cpu(ex->ee_start_lo); | |
57 | - block |= ((ext4_fsblk_t) le16_to_cpu(ex->ee_start_hi) << 31) << 1; | |
58 | - return block; | |
59 | -} | |
60 | - | |
61 | -/* | |
62 | - * idx_pblock: | |
63 | - * combine low and high parts of a leaf physical block number into ext4_fsblk_t | |
64 | - */ | |
65 | -ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix) | |
66 | -{ | |
67 | - ext4_fsblk_t block; | |
68 | - | |
69 | - block = le32_to_cpu(ix->ei_leaf_lo); | |
70 | - block |= ((ext4_fsblk_t) le16_to_cpu(ix->ei_leaf_hi) << 31) << 1; | |
71 | - return block; | |
72 | -} | |
73 | - | |
74 | -/* | |
75 | - * ext4_ext_store_pblock: | |
76 | - * stores a large physical block number into an extent struct, | |
77 | - * breaking it into parts | |
78 | - */ | |
79 | -void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb) | |
80 | -{ | |
81 | - ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff)); | |
82 | - ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff); | |
83 | -} | |
84 | - | |
85 | -/* | |
86 | - * ext4_idx_store_pblock: | |
87 | - * stores a large physical block number into an index struct, | |
88 | - * breaking it into parts | |
89 | - */ | |
90 | -static void ext4_idx_store_pblock(struct ext4_extent_idx *ix, ext4_fsblk_t pb) | |
91 | -{ | |
92 | - ix->ei_leaf_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff)); | |
93 | - ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff); | |
94 | -} | |
95 | - | |
96 | 47 | static int ext4_ext_truncate_extend_restart(handle_t *handle, |
97 | 48 | struct inode *inode, |
98 | 49 | int needed) |
... | ... | @@ -169,7 +120,8 @@ |
169 | 120 | /* try to predict block placement */ |
170 | 121 | ex = path[depth].p_ext; |
171 | 122 | if (ex) |
172 | - return ext_pblock(ex)+(block-le32_to_cpu(ex->ee_block)); | |
123 | + return (ext4_ext_pblock(ex) + | |
124 | + (block - le32_to_cpu(ex->ee_block))); | |
173 | 125 | |
174 | 126 | /* it looks like index is empty; |
175 | 127 | * try to find starting block from index itself */ |
... | ... | @@ -354,7 +306,7 @@ |
354 | 306 | |
355 | 307 | static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) |
356 | 308 | { |
357 | - ext4_fsblk_t block = ext_pblock(ext); | |
309 | + ext4_fsblk_t block = ext4_ext_pblock(ext); | |
358 | 310 | int len = ext4_ext_get_actual_len(ext); |
359 | 311 | |
360 | 312 | return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); |
... | ... | @@ -363,7 +315,7 @@ |
363 | 315 | static int ext4_valid_extent_idx(struct inode *inode, |
364 | 316 | struct ext4_extent_idx *ext_idx) |
365 | 317 | { |
366 | - ext4_fsblk_t block = idx_pblock(ext_idx); | |
318 | + ext4_fsblk_t block = ext4_idx_pblock(ext_idx); | |
367 | 319 | |
368 | 320 | return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, 1); |
369 | 321 | } |
370 | 322 | |
... | ... | @@ -463,13 +415,13 @@ |
463 | 415 | for (k = 0; k <= l; k++, path++) { |
464 | 416 | if (path->p_idx) { |
465 | 417 | ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block), |
466 | - idx_pblock(path->p_idx)); | |
418 | + ext4_idx_pblock(path->p_idx)); | |
467 | 419 | } else if (path->p_ext) { |
468 | 420 | ext_debug(" %d:[%d]%d:%llu ", |
469 | 421 | le32_to_cpu(path->p_ext->ee_block), |
470 | 422 | ext4_ext_is_uninitialized(path->p_ext), |
471 | 423 | ext4_ext_get_actual_len(path->p_ext), |
472 | - ext_pblock(path->p_ext)); | |
424 | + ext4_ext_pblock(path->p_ext)); | |
473 | 425 | } else |
474 | 426 | ext_debug(" []"); |
475 | 427 | } |
... | ... | @@ -494,7 +446,7 @@ |
494 | 446 | for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) { |
495 | 447 | ext_debug("%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block), |
496 | 448 | ext4_ext_is_uninitialized(ex), |
497 | - ext4_ext_get_actual_len(ex), ext_pblock(ex)); | |
449 | + ext4_ext_get_actual_len(ex), ext4_ext_pblock(ex)); | |
498 | 450 | } |
499 | 451 | ext_debug("\n"); |
500 | 452 | } |
... | ... | @@ -545,7 +497,7 @@ |
545 | 497 | |
546 | 498 | path->p_idx = l - 1; |
547 | 499 | ext_debug(" -> %d->%lld ", le32_to_cpu(path->p_idx->ei_block), |
548 | - idx_pblock(path->p_idx)); | |
500 | + ext4_idx_pblock(path->p_idx)); | |
549 | 501 | |
550 | 502 | #ifdef CHECK_BINSEARCH |
551 | 503 | { |
... | ... | @@ -614,7 +566,7 @@ |
614 | 566 | path->p_ext = l - 1; |
615 | 567 | ext_debug(" -> %d:%llu:[%d]%d ", |
616 | 568 | le32_to_cpu(path->p_ext->ee_block), |
617 | - ext_pblock(path->p_ext), | |
569 | + ext4_ext_pblock(path->p_ext), | |
618 | 570 | ext4_ext_is_uninitialized(path->p_ext), |
619 | 571 | ext4_ext_get_actual_len(path->p_ext)); |
620 | 572 | |
... | ... | @@ -682,7 +634,7 @@ |
682 | 634 | ppos, le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max)); |
683 | 635 | |
684 | 636 | ext4_ext_binsearch_idx(inode, path + ppos, block); |
685 | - path[ppos].p_block = idx_pblock(path[ppos].p_idx); | |
637 | + path[ppos].p_block = ext4_idx_pblock(path[ppos].p_idx); | |
686 | 638 | path[ppos].p_depth = i; |
687 | 639 | path[ppos].p_ext = NULL; |
688 | 640 | |
... | ... | @@ -721,7 +673,7 @@ |
721 | 673 | ext4_ext_binsearch(inode, path + ppos, block); |
722 | 674 | /* if not an empty leaf */ |
723 | 675 | if (path[ppos].p_ext) |
724 | - path[ppos].p_block = ext_pblock(path[ppos].p_ext); | |
676 | + path[ppos].p_block = ext4_ext_pblock(path[ppos].p_ext); | |
725 | 677 | |
726 | 678 | ext4_ext_show_path(inode, path); |
727 | 679 | |
... | ... | @@ -917,7 +869,7 @@ |
917 | 869 | EXT_MAX_EXTENT(path[depth].p_hdr)) { |
918 | 870 | ext_debug("move %d:%llu:[%d]%d in new leaf %llu\n", |
919 | 871 | le32_to_cpu(path[depth].p_ext->ee_block), |
920 | - ext_pblock(path[depth].p_ext), | |
872 | + ext4_ext_pblock(path[depth].p_ext), | |
921 | 873 | ext4_ext_is_uninitialized(path[depth].p_ext), |
922 | 874 | ext4_ext_get_actual_len(path[depth].p_ext), |
923 | 875 | newblock); |
... | ... | @@ -1007,7 +959,7 @@ |
1007 | 959 | while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) { |
1008 | 960 | ext_debug("%d: move %d:%llu in new index %llu\n", i, |
1009 | 961 | le32_to_cpu(path[i].p_idx->ei_block), |
1010 | - idx_pblock(path[i].p_idx), | |
962 | + ext4_idx_pblock(path[i].p_idx), | |
1011 | 963 | newblock); |
1012 | 964 | /*memmove(++fidx, path[i].p_idx++, |
1013 | 965 | sizeof(struct ext4_extent_idx)); |
... | ... | @@ -1146,7 +1098,7 @@ |
1146 | 1098 | ext_debug("new root: num %d(%d), lblock %d, ptr %llu\n", |
1147 | 1099 | le16_to_cpu(neh->eh_entries), le16_to_cpu(neh->eh_max), |
1148 | 1100 | le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block), |
1149 | - idx_pblock(EXT_FIRST_INDEX(neh))); | |
1101 | + ext4_idx_pblock(EXT_FIRST_INDEX(neh))); | |
1150 | 1102 | |
1151 | 1103 | neh->eh_depth = cpu_to_le16(path->p_depth + 1); |
1152 | 1104 | err = ext4_ext_dirty(handle, inode, curp); |
... | ... | @@ -1286,7 +1238,7 @@ |
1286 | 1238 | } |
1287 | 1239 | |
1288 | 1240 | *logical = le32_to_cpu(ex->ee_block) + ee_len - 1; |
1289 | - *phys = ext_pblock(ex) + ee_len - 1; | |
1241 | + *phys = ext4_ext_pblock(ex) + ee_len - 1; | |
1290 | 1242 | return 0; |
1291 | 1243 | } |
1292 | 1244 | |
... | ... | @@ -1342,7 +1294,7 @@ |
1342 | 1294 | } |
1343 | 1295 | } |
1344 | 1296 | *logical = le32_to_cpu(ex->ee_block); |
1345 | - *phys = ext_pblock(ex); | |
1297 | + *phys = ext4_ext_pblock(ex); | |
1346 | 1298 | return 0; |
1347 | 1299 | } |
1348 | 1300 | |
... | ... | @@ -1357,7 +1309,7 @@ |
1357 | 1309 | /* next allocated block in this leaf */ |
1358 | 1310 | ex++; |
1359 | 1311 | *logical = le32_to_cpu(ex->ee_block); |
1360 | - *phys = ext_pblock(ex); | |
1312 | + *phys = ext4_ext_pblock(ex); | |
1361 | 1313 | return 0; |
1362 | 1314 | } |
1363 | 1315 | |
... | ... | @@ -1376,7 +1328,7 @@ |
1376 | 1328 | * follow it and find the closest allocated |
1377 | 1329 | * block to the right */ |
1378 | 1330 | ix++; |
1379 | - block = idx_pblock(ix); | |
1331 | + block = ext4_idx_pblock(ix); | |
1380 | 1332 | while (++depth < path->p_depth) { |
1381 | 1333 | bh = sb_bread(inode->i_sb, block); |
1382 | 1334 | if (bh == NULL) |
... | ... | @@ -1388,7 +1340,7 @@ |
1388 | 1340 | return -EIO; |
1389 | 1341 | } |
1390 | 1342 | ix = EXT_FIRST_INDEX(eh); |
1391 | - block = idx_pblock(ix); | |
1343 | + block = ext4_idx_pblock(ix); | |
1392 | 1344 | put_bh(bh); |
1393 | 1345 | } |
1394 | 1346 | |
... | ... | @@ -1402,7 +1354,7 @@ |
1402 | 1354 | } |
1403 | 1355 | ex = EXT_FIRST_EXTENT(eh); |
1404 | 1356 | *logical = le32_to_cpu(ex->ee_block); |
1405 | - *phys = ext_pblock(ex); | |
1357 | + *phys = ext4_ext_pblock(ex); | |
1406 | 1358 | put_bh(bh); |
1407 | 1359 | return 0; |
1408 | 1360 | } |
... | ... | @@ -1573,7 +1525,7 @@ |
1573 | 1525 | return 0; |
1574 | 1526 | #endif |
1575 | 1527 | |
1576 | - if (ext_pblock(ex1) + ext1_ee_len == ext_pblock(ex2)) | |
1528 | + if (ext4_ext_pblock(ex1) + ext1_ee_len == ext4_ext_pblock(ex2)) | |
1577 | 1529 | return 1; |
1578 | 1530 | return 0; |
1579 | 1531 | } |
... | ... | @@ -1706,11 +1658,12 @@ |
1706 | 1658 | if (ex && !(flag & EXT4_GET_BLOCKS_PRE_IO) |
1707 | 1659 | && ext4_can_extents_be_merged(inode, ex, newext)) { |
1708 | 1660 | ext_debug("append [%d]%d block to %d:[%d]%d (from %llu)\n", |
1709 | - ext4_ext_is_uninitialized(newext), | |
1710 | - ext4_ext_get_actual_len(newext), | |
1711 | - le32_to_cpu(ex->ee_block), | |
1712 | - ext4_ext_is_uninitialized(ex), | |
1713 | - ext4_ext_get_actual_len(ex), ext_pblock(ex)); | |
1661 | + ext4_ext_is_uninitialized(newext), | |
1662 | + ext4_ext_get_actual_len(newext), | |
1663 | + le32_to_cpu(ex->ee_block), | |
1664 | + ext4_ext_is_uninitialized(ex), | |
1665 | + ext4_ext_get_actual_len(ex), | |
1666 | + ext4_ext_pblock(ex)); | |
1714 | 1667 | err = ext4_ext_get_access(handle, inode, path + depth); |
1715 | 1668 | if (err) |
1716 | 1669 | return err; |
... | ... | @@ -1780,7 +1733,7 @@ |
1780 | 1733 | /* there is no extent in this leaf, create first one */ |
1781 | 1734 | ext_debug("first extent in the leaf: %d:%llu:[%d]%d\n", |
1782 | 1735 | le32_to_cpu(newext->ee_block), |
1783 | - ext_pblock(newext), | |
1736 | + ext4_ext_pblock(newext), | |
1784 | 1737 | ext4_ext_is_uninitialized(newext), |
1785 | 1738 | ext4_ext_get_actual_len(newext)); |
1786 | 1739 | path[depth].p_ext = EXT_FIRST_EXTENT(eh); |
... | ... | @@ -1794,7 +1747,7 @@ |
1794 | 1747 | ext_debug("insert %d:%llu:[%d]%d after: nearest 0x%p, " |
1795 | 1748 | "move %d from 0x%p to 0x%p\n", |
1796 | 1749 | le32_to_cpu(newext->ee_block), |
1797 | - ext_pblock(newext), | |
1750 | + ext4_ext_pblock(newext), | |
1798 | 1751 | ext4_ext_is_uninitialized(newext), |
1799 | 1752 | ext4_ext_get_actual_len(newext), |
1800 | 1753 | nearex, len, nearex + 1, nearex + 2); |
... | ... | @@ -1808,7 +1761,7 @@ |
1808 | 1761 | ext_debug("insert %d:%llu:[%d]%d before: nearest 0x%p, " |
1809 | 1762 | "move %d from 0x%p to 0x%p\n", |
1810 | 1763 | le32_to_cpu(newext->ee_block), |
1811 | - ext_pblock(newext), | |
1764 | + ext4_ext_pblock(newext), | |
1812 | 1765 | ext4_ext_is_uninitialized(newext), |
1813 | 1766 | ext4_ext_get_actual_len(newext), |
1814 | 1767 | nearex, len, nearex + 1, nearex + 2); |
... | ... | @@ -1819,7 +1772,7 @@ |
1819 | 1772 | le16_add_cpu(&eh->eh_entries, 1); |
1820 | 1773 | nearex = path[depth].p_ext; |
1821 | 1774 | nearex->ee_block = newext->ee_block; |
1822 | - ext4_ext_store_pblock(nearex, ext_pblock(newext)); | |
1775 | + ext4_ext_store_pblock(nearex, ext4_ext_pblock(newext)); | |
1823 | 1776 | nearex->ee_len = newext->ee_len; |
1824 | 1777 | |
1825 | 1778 | merge: |
... | ... | @@ -1923,7 +1876,7 @@ |
1923 | 1876 | } else { |
1924 | 1877 | cbex.ec_block = le32_to_cpu(ex->ee_block); |
1925 | 1878 | cbex.ec_len = ext4_ext_get_actual_len(ex); |
1926 | - cbex.ec_start = ext_pblock(ex); | |
1879 | + cbex.ec_start = ext4_ext_pblock(ex); | |
1927 | 1880 | cbex.ec_type = EXT4_EXT_CACHE_EXTENT; |
1928 | 1881 | } |
1929 | 1882 | |
... | ... | @@ -2073,7 +2026,7 @@ |
2073 | 2026 | |
2074 | 2027 | /* free index block */ |
2075 | 2028 | path--; |
2076 | - leaf = idx_pblock(path->p_idx); | |
2029 | + leaf = ext4_idx_pblock(path->p_idx); | |
2077 | 2030 | if (unlikely(path->p_hdr->eh_entries == 0)) { |
2078 | 2031 | EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); |
2079 | 2032 | return -EIO; |
... | ... | @@ -2181,7 +2134,7 @@ |
2181 | 2134 | ext4_fsblk_t start; |
2182 | 2135 | |
2183 | 2136 | num = le32_to_cpu(ex->ee_block) + ee_len - from; |
2184 | - start = ext_pblock(ex) + ee_len - num; | |
2137 | + start = ext4_ext_pblock(ex) + ee_len - num; | |
2185 | 2138 | ext_debug("free last %u blocks starting %llu\n", num, start); |
2186 | 2139 | ext4_free_blocks(handle, inode, 0, start, num, flags); |
2187 | 2140 | } else if (from == le32_to_cpu(ex->ee_block) |
... | ... | @@ -2310,7 +2263,7 @@ |
2310 | 2263 | goto out; |
2311 | 2264 | |
2312 | 2265 | ext_debug("new extent: %u:%u:%llu\n", block, num, |
2313 | - ext_pblock(ex)); | |
2266 | + ext4_ext_pblock(ex)); | |
2314 | 2267 | ex--; |
2315 | 2268 | ex_ee_block = le32_to_cpu(ex->ee_block); |
2316 | 2269 | ex_ee_len = ext4_ext_get_actual_len(ex); |
2317 | 2270 | |
... | ... | @@ -2421,9 +2374,9 @@ |
2421 | 2374 | struct buffer_head *bh; |
2422 | 2375 | /* go to the next level */ |
2423 | 2376 | ext_debug("move to level %d (block %llu)\n", |
2424 | - i + 1, idx_pblock(path[i].p_idx)); | |
2377 | + i + 1, ext4_idx_pblock(path[i].p_idx)); | |
2425 | 2378 | memset(path + i + 1, 0, sizeof(*path)); |
2426 | - bh = sb_bread(sb, idx_pblock(path[i].p_idx)); | |
2379 | + bh = sb_bread(sb, ext4_idx_pblock(path[i].p_idx)); | |
2427 | 2380 | if (!bh) { |
2428 | 2381 | /* should we reset i_size? */ |
2429 | 2382 | err = -EIO; |
... | ... | @@ -2543,7 +2496,7 @@ |
2543 | 2496 | int ret; |
2544 | 2497 | |
2545 | 2498 | ee_len = ext4_ext_get_actual_len(ex); |
2546 | - ee_pblock = ext_pblock(ex); | |
2499 | + ee_pblock = ext4_ext_pblock(ex); | |
2547 | 2500 | |
2548 | 2501 | ret = sb_issue_zeroout(inode->i_sb, ee_pblock, ee_len, |
2549 | 2502 | GFP_NOFS, BLKDEV_IFL_WAIT); |
2550 | 2503 | |
... | ... | @@ -2596,12 +2549,12 @@ |
2596 | 2549 | ee_block = le32_to_cpu(ex->ee_block); |
2597 | 2550 | ee_len = ext4_ext_get_actual_len(ex); |
2598 | 2551 | allocated = ee_len - (map->m_lblk - ee_block); |
2599 | - newblock = map->m_lblk - ee_block + ext_pblock(ex); | |
2552 | + newblock = map->m_lblk - ee_block + ext4_ext_pblock(ex); | |
2600 | 2553 | |
2601 | 2554 | ex2 = ex; |
2602 | 2555 | orig_ex.ee_block = ex->ee_block; |
2603 | 2556 | orig_ex.ee_len = cpu_to_le16(ee_len); |
2604 | - ext4_ext_store_pblock(&orig_ex, ext_pblock(ex)); | |
2557 | + ext4_ext_store_pblock(&orig_ex, ext4_ext_pblock(ex)); | |
2605 | 2558 | |
2606 | 2559 | /* |
2607 | 2560 | * It is safe to convert extent to initialized via explicit |
... | ... | @@ -2620,7 +2573,7 @@ |
2620 | 2573 | /* update the extent length and mark as initialized */ |
2621 | 2574 | ex->ee_block = orig_ex.ee_block; |
2622 | 2575 | ex->ee_len = orig_ex.ee_len; |
2623 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2576 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2624 | 2577 | ext4_ext_dirty(handle, inode, path + depth); |
2625 | 2578 | /* zeroed the full extent */ |
2626 | 2579 | return allocated; |
... | ... | @@ -2655,7 +2608,7 @@ |
2655 | 2608 | ex->ee_block = orig_ex.ee_block; |
2656 | 2609 | ex->ee_len = cpu_to_le16(ee_len - allocated); |
2657 | 2610 | ext4_ext_mark_uninitialized(ex); |
2658 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2611 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2659 | 2612 | ext4_ext_dirty(handle, inode, path + depth); |
2660 | 2613 | |
2661 | 2614 | ex3 = &newex; |
... | ... | @@ -2670,7 +2623,8 @@ |
2670 | 2623 | goto fix_extent_len; |
2671 | 2624 | ex->ee_block = orig_ex.ee_block; |
2672 | 2625 | ex->ee_len = orig_ex.ee_len; |
2673 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2626 | + ext4_ext_store_pblock(ex, | |
2627 | + ext4_ext_pblock(&orig_ex)); | |
2674 | 2628 | ext4_ext_dirty(handle, inode, path + depth); |
2675 | 2629 | /* blocks available from map->m_lblk */ |
2676 | 2630 | return allocated; |
... | ... | @@ -2727,7 +2681,7 @@ |
2727 | 2681 | /* update the extent length and mark as initialized */ |
2728 | 2682 | ex->ee_block = orig_ex.ee_block; |
2729 | 2683 | ex->ee_len = orig_ex.ee_len; |
2730 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2684 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2731 | 2685 | ext4_ext_dirty(handle, inode, path + depth); |
2732 | 2686 | /* zeroed the full extent */ |
2733 | 2687 | /* blocks available from map->m_lblk */ |
... | ... | @@ -2778,7 +2732,7 @@ |
2778 | 2732 | /* update the extent length and mark as initialized */ |
2779 | 2733 | ex->ee_block = orig_ex.ee_block; |
2780 | 2734 | ex->ee_len = orig_ex.ee_len; |
2781 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2735 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2782 | 2736 | ext4_ext_dirty(handle, inode, path + depth); |
2783 | 2737 | /* zero out the first half */ |
2784 | 2738 | /* blocks available from map->m_lblk */ |
... | ... | @@ -2847,7 +2801,7 @@ |
2847 | 2801 | /* update the extent length and mark as initialized */ |
2848 | 2802 | ex->ee_block = orig_ex.ee_block; |
2849 | 2803 | ex->ee_len = orig_ex.ee_len; |
2850 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2804 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2851 | 2805 | ext4_ext_dirty(handle, inode, path + depth); |
2852 | 2806 | /* zero out the first half */ |
2853 | 2807 | return allocated; |
... | ... | @@ -2860,7 +2814,7 @@ |
2860 | 2814 | fix_extent_len: |
2861 | 2815 | ex->ee_block = orig_ex.ee_block; |
2862 | 2816 | ex->ee_len = orig_ex.ee_len; |
2863 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2817 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2864 | 2818 | ext4_ext_mark_uninitialized(ex); |
2865 | 2819 | ext4_ext_dirty(handle, inode, path + depth); |
2866 | 2820 | return err; |
2867 | 2821 | |
... | ... | @@ -2918,12 +2872,12 @@ |
2918 | 2872 | ee_block = le32_to_cpu(ex->ee_block); |
2919 | 2873 | ee_len = ext4_ext_get_actual_len(ex); |
2920 | 2874 | allocated = ee_len - (map->m_lblk - ee_block); |
2921 | - newblock = map->m_lblk - ee_block + ext_pblock(ex); | |
2875 | + newblock = map->m_lblk - ee_block + ext4_ext_pblock(ex); | |
2922 | 2876 | |
2923 | 2877 | ex2 = ex; |
2924 | 2878 | orig_ex.ee_block = ex->ee_block; |
2925 | 2879 | orig_ex.ee_len = cpu_to_le16(ee_len); |
2926 | - ext4_ext_store_pblock(&orig_ex, ext_pblock(ex)); | |
2880 | + ext4_ext_store_pblock(&orig_ex, ext4_ext_pblock(ex)); | |
2927 | 2881 | |
2928 | 2882 | /* |
2929 | 2883 | * It is safe to convert extent to initialized via explicit |
... | ... | @@ -2972,7 +2926,7 @@ |
2972 | 2926 | /* update the extent length and mark as initialized */ |
2973 | 2927 | ex->ee_block = orig_ex.ee_block; |
2974 | 2928 | ex->ee_len = orig_ex.ee_len; |
2975 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
2929 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
2976 | 2930 | ext4_ext_dirty(handle, inode, path + depth); |
2977 | 2931 | /* zeroed the full extent */ |
2978 | 2932 | /* blocks available from map->m_lblk */ |
... | ... | @@ -3044,7 +2998,7 @@ |
3044 | 2998 | /* update the extent length and mark as initialized */ |
3045 | 2999 | ex->ee_block = orig_ex.ee_block; |
3046 | 3000 | ex->ee_len = orig_ex.ee_len; |
3047 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
3001 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
3048 | 3002 | ext4_ext_dirty(handle, inode, path + depth); |
3049 | 3003 | /* zero out the first half */ |
3050 | 3004 | return allocated; |
... | ... | @@ -3057,7 +3011,7 @@ |
3057 | 3011 | fix_extent_len: |
3058 | 3012 | ex->ee_block = orig_ex.ee_block; |
3059 | 3013 | ex->ee_len = orig_ex.ee_len; |
3060 | - ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); | |
3014 | + ext4_ext_store_pblock(ex, ext4_ext_pblock(&orig_ex)); | |
3061 | 3015 | ext4_ext_mark_uninitialized(ex); |
3062 | 3016 | ext4_ext_dirty(handle, inode, path + depth); |
3063 | 3017 | return err; |
... | ... | @@ -3347,7 +3301,7 @@ |
3347 | 3301 | /* block is already allocated */ |
3348 | 3302 | newblock = map->m_lblk |
3349 | 3303 | - le32_to_cpu(newex.ee_block) |
3350 | - + ext_pblock(&newex); | |
3304 | + + ext4_ext_pblock(&newex); | |
3351 | 3305 | /* number of remaining blocks in the extent */ |
3352 | 3306 | allocated = ext4_ext_get_actual_len(&newex) - |
3353 | 3307 | (map->m_lblk - le32_to_cpu(newex.ee_block)); |
... | ... | @@ -3385,7 +3339,7 @@ |
3385 | 3339 | ex = path[depth].p_ext; |
3386 | 3340 | if (ex) { |
3387 | 3341 | ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block); |
3388 | - ext4_fsblk_t ee_start = ext_pblock(ex); | |
3342 | + ext4_fsblk_t ee_start = ext4_ext_pblock(ex); | |
3389 | 3343 | unsigned short ee_len; |
3390 | 3344 | |
3391 | 3345 | /* |
3392 | 3346 | |
... | ... | @@ -3513,13 +3467,13 @@ |
3513 | 3467 | /* not a good idea to call discard here directly, |
3514 | 3468 | * but otherwise we'd need to call it every free() */ |
3515 | 3469 | ext4_discard_preallocations(inode); |
3516 | - ext4_free_blocks(handle, inode, 0, ext_pblock(&newex), | |
3470 | + ext4_free_blocks(handle, inode, 0, ext4_ext_pblock(&newex), | |
3517 | 3471 | ext4_ext_get_actual_len(&newex), 0); |
3518 | 3472 | goto out2; |
3519 | 3473 | } |
3520 | 3474 | |
3521 | 3475 | /* previous routine could use block we allocated */ |
3522 | - newblock = ext_pblock(&newex); | |
3476 | + newblock = ext4_ext_pblock(&newex); | |
3523 | 3477 | allocated = ext4_ext_get_actual_len(&newex); |
3524 | 3478 | if (allocated > map->m_len) |
3525 | 3479 | allocated = map->m_len; |
fs/ext4/migrate.c
fs/ext4/move_extent.c
... | ... | @@ -85,7 +85,7 @@ |
85 | 85 | if (EXT_LAST_EXTENT(path[ppos].p_hdr) > path[ppos].p_ext) { |
86 | 86 | /* leaf block */ |
87 | 87 | *extent = ++path[ppos].p_ext; |
88 | - path[ppos].p_block = ext_pblock(path[ppos].p_ext); | |
88 | + path[ppos].p_block = ext4_ext_pblock(path[ppos].p_ext); | |
89 | 89 | return 0; |
90 | 90 | } |
91 | 91 | |
... | ... | @@ -96,7 +96,7 @@ |
96 | 96 | |
97 | 97 | /* index block */ |
98 | 98 | path[ppos].p_idx++; |
99 | - path[ppos].p_block = idx_pblock(path[ppos].p_idx); | |
99 | + path[ppos].p_block = ext4_idx_pblock(path[ppos].p_idx); | |
100 | 100 | if (path[ppos+1].p_bh) |
101 | 101 | brelse(path[ppos+1].p_bh); |
102 | 102 | path[ppos+1].p_bh = |
... | ... | @@ -111,7 +111,7 @@ |
111 | 111 | path[cur_ppos].p_idx = |
112 | 112 | EXT_FIRST_INDEX(path[cur_ppos].p_hdr); |
113 | 113 | path[cur_ppos].p_block = |
114 | - idx_pblock(path[cur_ppos].p_idx); | |
114 | + ext4_idx_pblock(path[cur_ppos].p_idx); | |
115 | 115 | if (path[cur_ppos+1].p_bh) |
116 | 116 | brelse(path[cur_ppos+1].p_bh); |
117 | 117 | path[cur_ppos+1].p_bh = sb_bread(inode->i_sb, |
... | ... | @@ -133,7 +133,7 @@ |
133 | 133 | path[leaf_ppos].p_ext = *extent = |
134 | 134 | EXT_FIRST_EXTENT(path[leaf_ppos].p_hdr); |
135 | 135 | path[leaf_ppos].p_block = |
136 | - ext_pblock(path[leaf_ppos].p_ext); | |
136 | + ext4_ext_pblock(path[leaf_ppos].p_ext); | |
137 | 137 | return 0; |
138 | 138 | } |
139 | 139 | } |
... | ... | @@ -249,7 +249,7 @@ |
249 | 249 | */ |
250 | 250 | o_end->ee_block = end_ext->ee_block; |
251 | 251 | o_end->ee_len = end_ext->ee_len; |
252 | - ext4_ext_store_pblock(o_end, ext_pblock(end_ext)); | |
252 | + ext4_ext_store_pblock(o_end, ext4_ext_pblock(end_ext)); | |
253 | 253 | } |
254 | 254 | |
255 | 255 | o_start->ee_len = start_ext->ee_len; |
... | ... | @@ -276,7 +276,7 @@ |
276 | 276 | */ |
277 | 277 | o_end->ee_block = end_ext->ee_block; |
278 | 278 | o_end->ee_len = end_ext->ee_len; |
279 | - ext4_ext_store_pblock(o_end, ext_pblock(end_ext)); | |
279 | + ext4_ext_store_pblock(o_end, ext4_ext_pblock(end_ext)); | |
280 | 280 | |
281 | 281 | /* |
282 | 282 | * Set 0 to the extent block if new_ext was |
... | ... | @@ -361,7 +361,7 @@ |
361 | 361 | /* Insert new entry */ |
362 | 362 | if (new_ext->ee_len) { |
363 | 363 | o_start[i] = *new_ext; |
364 | - ext4_ext_store_pblock(&o_start[i++], ext_pblock(new_ext)); | |
364 | + ext4_ext_store_pblock(&o_start[i++], ext4_ext_pblock(new_ext)); | |
365 | 365 | } |
366 | 366 | |
367 | 367 | /* Insert end entry */ |
... | ... | @@ -488,7 +488,7 @@ |
488 | 488 | start_ext.ee_len = end_ext.ee_len = 0; |
489 | 489 | |
490 | 490 | new_ext.ee_block = cpu_to_le32(*from); |
491 | - ext4_ext_store_pblock(&new_ext, ext_pblock(dext)); | |
491 | + ext4_ext_store_pblock(&new_ext, ext4_ext_pblock(dext)); | |
492 | 492 | new_ext.ee_len = dext->ee_len; |
493 | 493 | new_ext_alen = ext4_ext_get_actual_len(&new_ext); |
494 | 494 | new_ext_end = le32_to_cpu(new_ext.ee_block) + new_ext_alen - 1; |
... | ... | @@ -553,7 +553,7 @@ |
553 | 553 | copy_extent_status(oext, &end_ext); |
554 | 554 | end_ext_alen = ext4_ext_get_actual_len(&end_ext); |
555 | 555 | ext4_ext_store_pblock(&end_ext, |
556 | - (ext_pblock(o_end) + oext_alen - end_ext_alen)); | |
556 | + (ext4_ext_pblock(o_end) + oext_alen - end_ext_alen)); | |
557 | 557 | end_ext.ee_block = |
558 | 558 | cpu_to_le32(le32_to_cpu(o_end->ee_block) + |
559 | 559 | oext_alen - end_ext_alen); |
... | ... | @@ -604,7 +604,7 @@ |
604 | 604 | /* When tmp_dext is too large, pick up the target range. */ |
605 | 605 | diff = donor_off - le32_to_cpu(tmp_dext->ee_block); |
606 | 606 | |
607 | - ext4_ext_store_pblock(tmp_dext, ext_pblock(tmp_dext) + diff); | |
607 | + ext4_ext_store_pblock(tmp_dext, ext4_ext_pblock(tmp_dext) + diff); | |
608 | 608 | tmp_dext->ee_block = |
609 | 609 | cpu_to_le32(le32_to_cpu(tmp_dext->ee_block) + diff); |
610 | 610 | tmp_dext->ee_len = cpu_to_le16(le16_to_cpu(tmp_dext->ee_len) - diff); |
... | ... | @@ -613,7 +613,7 @@ |
613 | 613 | tmp_dext->ee_len = cpu_to_le16(max_count); |
614 | 614 | |
615 | 615 | orig_diff = orig_off - le32_to_cpu(tmp_oext->ee_block); |
616 | - ext4_ext_store_pblock(tmp_oext, ext_pblock(tmp_oext) + orig_diff); | |
616 | + ext4_ext_store_pblock(tmp_oext, ext4_ext_pblock(tmp_oext) + orig_diff); | |
617 | 617 | |
618 | 618 | /* Adjust extent length if donor extent is larger than orig */ |
619 | 619 | if (ext4_ext_get_actual_len(tmp_dext) > |