aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commit725d26d3f09ccb5bac4b4293096b985a312a0d67 (patch)
tree1c49a07da252832fc6842c88a2359e8cd43af636 /fs
parenta72d7f834e1afa08421938d7eb06bd8e56b0e58c (diff)
ext4: Introduce ext4_lblk_t
This patch adds a new data type ext4_lblk_t to represent the logical file blocks. This is the preparatory patch to support large files in ext4 The follow up patch with convert the ext4_inode i_blocks to represent the number of blocks in file system block size. This changes makes it possible to have a block number 2**32 -1 which will result in overflow if the block number is represented by signed long. This patch convert all the block number to type ext4_lblk_t which is typedef to __u32 Also remove dead code ext4_ext_walk_space Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/dir.c2
-rw-r--r--fs/ext4/extents.c218
-rw-r--r--fs/ext4/inode.c34
-rw-r--r--fs/ext4/namei.c54
-rw-r--r--fs/ext4/super.c4
5 files changed, 116 insertions, 196 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 145a9c0c972d..33888bb58144 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -124,7 +124,7 @@ static int ext4_readdir(struct file * filp,
124 offset = filp->f_pos & (sb->s_blocksize - 1); 124 offset = filp->f_pos & (sb->s_blocksize - 1);
125 125
126 while (!error && !stored && filp->f_pos < inode->i_size) { 126 while (!error && !stored && filp->f_pos < inode->i_size) {
127 unsigned long blk = filp->f_pos >> EXT4_BLOCK_SIZE_BITS(sb); 127 ext4_lblk_t blk = filp->f_pos >> EXT4_BLOCK_SIZE_BITS(sb);
128 struct buffer_head map_bh; 128 struct buffer_head map_bh;
129 struct buffer_head *bh = NULL; 129 struct buffer_head *bh = NULL;
130 130
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 85287742f2ae..19d8059b58aa 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -144,7 +144,7 @@ static int ext4_ext_dirty(handle_t *handle, struct inode *inode,
144 144
145static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, 145static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode,
146 struct ext4_ext_path *path, 146 struct ext4_ext_path *path,
147 ext4_fsblk_t block) 147 ext4_lblk_t block)
148{ 148{
149 struct ext4_inode_info *ei = EXT4_I(inode); 149 struct ext4_inode_info *ei = EXT4_I(inode);
150 ext4_fsblk_t bg_start; 150 ext4_fsblk_t bg_start;
@@ -367,13 +367,14 @@ static void ext4_ext_drop_refs(struct ext4_ext_path *path)
367 * the header must be checked before calling this 367 * the header must be checked before calling this
368 */ 368 */
369static void 369static void
370ext4_ext_binsearch_idx(struct inode *inode, struct ext4_ext_path *path, int block) 370ext4_ext_binsearch_idx(struct inode *inode,
371 struct ext4_ext_path *path, ext4_lblk_t block)
371{ 372{
372 struct ext4_extent_header *eh = path->p_hdr; 373 struct ext4_extent_header *eh = path->p_hdr;
373 struct ext4_extent_idx *r, *l, *m; 374 struct ext4_extent_idx *r, *l, *m;
374 375
375 376
376 ext_debug("binsearch for %d(idx): ", block); 377 ext_debug("binsearch for %lu(idx): ", (unsigned long)block);
377 378
378 l = EXT_FIRST_INDEX(eh) + 1; 379 l = EXT_FIRST_INDEX(eh) + 1;
379 r = EXT_LAST_INDEX(eh); 380 r = EXT_LAST_INDEX(eh);
@@ -425,7 +426,8 @@ ext4_ext_binsearch_idx(struct inode *inode, struct ext4_ext_path *path, int bloc
425 * the header must be checked before calling this 426 * the header must be checked before calling this
426 */ 427 */
427static void 428static void
428ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, int block) 429ext4_ext_binsearch(struct inode *inode,
430 struct ext4_ext_path *path, ext4_lblk_t block)
429{ 431{
430 struct ext4_extent_header *eh = path->p_hdr; 432 struct ext4_extent_header *eh = path->p_hdr;
431 struct ext4_extent *r, *l, *m; 433 struct ext4_extent *r, *l, *m;
@@ -438,7 +440,7 @@ ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, int block)
438 return; 440 return;
439 } 441 }
440 442
441 ext_debug("binsearch for %d: ", block); 443 ext_debug("binsearch for %lu: ", (unsigned long)block);
442 444
443 l = EXT_FIRST_EXTENT(eh) + 1; 445 l = EXT_FIRST_EXTENT(eh) + 1;
444 r = EXT_LAST_EXTENT(eh); 446 r = EXT_LAST_EXTENT(eh);
@@ -494,7 +496,8 @@ int ext4_ext_tree_init(handle_t *handle, struct inode *inode)
494} 496}
495 497
496struct ext4_ext_path * 498struct ext4_ext_path *
497ext4_ext_find_extent(struct inode *inode, int block, struct ext4_ext_path *path) 499ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block,
500 struct ext4_ext_path *path)
498{ 501{
499 struct ext4_extent_header *eh; 502 struct ext4_extent_header *eh;
500 struct buffer_head *bh; 503 struct buffer_head *bh;
@@ -979,8 +982,8 @@ repeat:
979 /* refill path */ 982 /* refill path */
980 ext4_ext_drop_refs(path); 983 ext4_ext_drop_refs(path);
981 path = ext4_ext_find_extent(inode, 984 path = ext4_ext_find_extent(inode,
982 le32_to_cpu(newext->ee_block), 985 (ext4_lblk_t)le32_to_cpu(newext->ee_block),
983 path); 986 path);
984 if (IS_ERR(path)) 987 if (IS_ERR(path))
985 err = PTR_ERR(path); 988 err = PTR_ERR(path);
986 } else { 989 } else {
@@ -992,8 +995,8 @@ repeat:
992 /* refill path */ 995 /* refill path */
993 ext4_ext_drop_refs(path); 996 ext4_ext_drop_refs(path);
994 path = ext4_ext_find_extent(inode, 997 path = ext4_ext_find_extent(inode,
995 le32_to_cpu(newext->ee_block), 998 (ext4_lblk_t)le32_to_cpu(newext->ee_block),
996 path); 999 path);
997 if (IS_ERR(path)) { 1000 if (IS_ERR(path)) {
998 err = PTR_ERR(path); 1001 err = PTR_ERR(path);
999 goto out; 1002 goto out;
@@ -1021,7 +1024,7 @@ out:
1021 * allocated block. Thus, index entries have to be consistent 1024 * allocated block. Thus, index entries have to be consistent
1022 * with leaves. 1025 * with leaves.
1023 */ 1026 */
1024static unsigned long 1027static ext4_lblk_t
1025ext4_ext_next_allocated_block(struct ext4_ext_path *path) 1028ext4_ext_next_allocated_block(struct ext4_ext_path *path)
1026{ 1029{
1027 int depth; 1030 int depth;
@@ -1054,7 +1057,7 @@ ext4_ext_next_allocated_block(struct ext4_ext_path *path)
1054 * ext4_ext_next_leaf_block: 1057 * ext4_ext_next_leaf_block:
1055 * returns first allocated block from next leaf or EXT_MAX_BLOCK 1058 * returns first allocated block from next leaf or EXT_MAX_BLOCK
1056 */ 1059 */
1057static unsigned ext4_ext_next_leaf_block(struct inode *inode, 1060static ext4_lblk_t ext4_ext_next_leaf_block(struct inode *inode,
1058 struct ext4_ext_path *path) 1061 struct ext4_ext_path *path)
1059{ 1062{
1060 int depth; 1063 int depth;
@@ -1072,7 +1075,8 @@ static unsigned ext4_ext_next_leaf_block(struct inode *inode,
1072 while (depth >= 0) { 1075 while (depth >= 0) {
1073 if (path[depth].p_idx != 1076 if (path[depth].p_idx !=
1074 EXT_LAST_INDEX(path[depth].p_hdr)) 1077 EXT_LAST_INDEX(path[depth].p_hdr))
1075 return le32_to_cpu(path[depth].p_idx[1].ei_block); 1078 return (ext4_lblk_t)
1079 le32_to_cpu(path[depth].p_idx[1].ei_block);
1076 depth--; 1080 depth--;
1077 } 1081 }
1078 1082
@@ -1239,7 +1243,7 @@ unsigned int ext4_ext_check_overlap(struct inode *inode,
1239 struct ext4_extent *newext, 1243 struct ext4_extent *newext,
1240 struct ext4_ext_path *path) 1244 struct ext4_ext_path *path)
1241{ 1245{
1242 unsigned long b1, b2; 1246 ext4_lblk_t b1, b2;
1243 unsigned int depth, len1; 1247 unsigned int depth, len1;
1244 unsigned int ret = 0; 1248 unsigned int ret = 0;
1245 1249
@@ -1260,7 +1264,7 @@ unsigned int ext4_ext_check_overlap(struct inode *inode,
1260 goto out; 1264 goto out;
1261 } 1265 }
1262 1266
1263 /* check for wrap through zero */ 1267 /* check for wrap through zero on extent logical start block*/
1264 if (b1 + len1 < b1) { 1268 if (b1 + len1 < b1) {
1265 len1 = EXT_MAX_BLOCK - b1; 1269 len1 = EXT_MAX_BLOCK - b1;
1266 newext->ee_len = cpu_to_le16(len1); 1270 newext->ee_len = cpu_to_le16(len1);
@@ -1290,7 +1294,8 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
1290 struct ext4_extent *ex, *fex; 1294 struct ext4_extent *ex, *fex;
1291 struct ext4_extent *nearex; /* nearest extent */ 1295 struct ext4_extent *nearex; /* nearest extent */
1292 struct ext4_ext_path *npath = NULL; 1296 struct ext4_ext_path *npath = NULL;
1293 int depth, len, err, next; 1297 int depth, len, err;
1298 ext4_lblk_t next;
1294 unsigned uninitialized = 0; 1299 unsigned uninitialized = 0;
1295 1300
1296 BUG_ON(ext4_ext_get_actual_len(newext) == 0); 1301 BUG_ON(ext4_ext_get_actual_len(newext) == 0);
@@ -1435,114 +1440,8 @@ cleanup:
1435 return err; 1440 return err;
1436} 1441}
1437 1442
1438int ext4_ext_walk_space(struct inode *inode, unsigned long block,
1439 unsigned long num, ext_prepare_callback func,
1440 void *cbdata)
1441{
1442 struct ext4_ext_path *path = NULL;
1443 struct ext4_ext_cache cbex;
1444 struct ext4_extent *ex;
1445 unsigned long next, start = 0, end = 0;
1446 unsigned long last = block + num;
1447 int depth, exists, err = 0;
1448
1449 BUG_ON(func == NULL);
1450 BUG_ON(inode == NULL);
1451
1452 while (block < last && block != EXT_MAX_BLOCK) {
1453 num = last - block;
1454 /* find extent for this block */
1455 path = ext4_ext_find_extent(inode, block, path);
1456 if (IS_ERR(path)) {
1457 err = PTR_ERR(path);
1458 path = NULL;
1459 break;
1460 }
1461
1462 depth = ext_depth(inode);
1463 BUG_ON(path[depth].p_hdr == NULL);
1464 ex = path[depth].p_ext;
1465 next = ext4_ext_next_allocated_block(path);
1466
1467 exists = 0;
1468 if (!ex) {
1469 /* there is no extent yet, so try to allocate
1470 * all requested space */
1471 start = block;
1472 end = block + num;
1473 } else if (le32_to_cpu(ex->ee_block) > block) {
1474 /* need to allocate space before found extent */
1475 start = block;
1476 end = le32_to_cpu(ex->ee_block);
1477 if (block + num < end)
1478 end = block + num;
1479 } else if (block >= le32_to_cpu(ex->ee_block)
1480 + ext4_ext_get_actual_len(ex)) {
1481 /* need to allocate space after found extent */
1482 start = block;
1483 end = block + num;
1484 if (end >= next)
1485 end = next;
1486 } else if (block >= le32_to_cpu(ex->ee_block)) {
1487 /*
1488 * some part of requested space is covered
1489 * by found extent
1490 */
1491 start = block;
1492 end = le32_to_cpu(ex->ee_block)
1493 + ext4_ext_get_actual_len(ex);
1494 if (block + num < end)
1495 end = block + num;
1496 exists = 1;
1497 } else {
1498 BUG();
1499 }
1500 BUG_ON(end <= start);
1501
1502 if (!exists) {
1503 cbex.ec_block = start;
1504 cbex.ec_len = end - start;
1505 cbex.ec_start = 0;
1506 cbex.ec_type = EXT4_EXT_CACHE_GAP;
1507 } else {
1508 cbex.ec_block = le32_to_cpu(ex->ee_block);
1509 cbex.ec_len = ext4_ext_get_actual_len(ex);
1510 cbex.ec_start = ext_pblock(ex);
1511 cbex.ec_type = EXT4_EXT_CACHE_EXTENT;
1512 }
1513
1514 BUG_ON(cbex.ec_len == 0);
1515 err = func(inode, path, &cbex, cbdata);
1516 ext4_ext_drop_refs(path);
1517
1518 if (err < 0)
1519 break;
1520 if (err == EXT_REPEAT)
1521 continue;
1522 else if (err == EXT_BREAK) {
1523 err = 0;
1524 break;
1525 }
1526
1527 if (ext_depth(inode) != depth) {
1528 /* depth was changed. we have to realloc path */
1529 kfree(path);
1530 path = NULL;
1531 }
1532
1533 block = cbex.ec_block + cbex.ec_len;
1534 }
1535
1536 if (path) {
1537 ext4_ext_drop_refs(path);
1538 kfree(path);
1539 }
1540
1541 return err;
1542}
1543
1544static void 1443static void
1545ext4_ext_put_in_cache(struct inode *inode, __u32 block, 1444ext4_ext_put_in_cache(struct inode *inode, ext4_lblk_t block,
1546 __u32 len, ext4_fsblk_t start, int type) 1445 __u32 len, ext4_fsblk_t start, int type)
1547{ 1446{
1548 struct ext4_ext_cache *cex; 1447 struct ext4_ext_cache *cex;
@@ -1561,10 +1460,11 @@ ext4_ext_put_in_cache(struct inode *inode, __u32 block,
1561 */ 1460 */
1562static void 1461static void
1563ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path, 1462ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
1564 unsigned long block) 1463 ext4_lblk_t block)
1565{ 1464{
1566 int depth = ext_depth(inode); 1465 int depth = ext_depth(inode);
1567 unsigned long lblock, len; 1466 unsigned long len;
1467 ext4_lblk_t lblock;
1568 struct ext4_extent *ex; 1468 struct ext4_extent *ex;
1569 1469
1570 ex = path[depth].p_ext; 1470 ex = path[depth].p_ext;
@@ -1582,15 +1482,17 @@ ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
1582 (unsigned long) ext4_ext_get_actual_len(ex)); 1482 (unsigned long) ext4_ext_get_actual_len(ex));
1583 } else if (block >= le32_to_cpu(ex->ee_block) 1483 } else if (block >= le32_to_cpu(ex->ee_block)
1584 + ext4_ext_get_actual_len(ex)) { 1484 + ext4_ext_get_actual_len(ex)) {
1485 ext4_lblk_t next;
1585 lblock = le32_to_cpu(ex->ee_block) 1486 lblock = le32_to_cpu(ex->ee_block)
1586 + ext4_ext_get_actual_len(ex); 1487 + ext4_ext_get_actual_len(ex);
1587 len = ext4_ext_next_allocated_block(path); 1488
1489 next = ext4_ext_next_allocated_block(path);
1588 ext_debug("cache gap(after): [%lu:%lu] %lu", 1490 ext_debug("cache gap(after): [%lu:%lu] %lu",
1589 (unsigned long) le32_to_cpu(ex->ee_block), 1491 (unsigned long) le32_to_cpu(ex->ee_block),
1590 (unsigned long) ext4_ext_get_actual_len(ex), 1492 (unsigned long) ext4_ext_get_actual_len(ex),
1591 (unsigned long) block); 1493 (unsigned long) block);
1592 BUG_ON(len == lblock); 1494 BUG_ON(next == lblock);
1593 len = len - lblock; 1495 len = next - lblock;
1594 } else { 1496 } else {
1595 lblock = len = 0; 1497 lblock = len = 0;
1596 BUG(); 1498 BUG();
@@ -1601,7 +1503,7 @@ ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
1601} 1503}
1602 1504
1603static int 1505static int
1604ext4_ext_in_cache(struct inode *inode, unsigned long block, 1506ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block,
1605 struct ext4_extent *ex) 1507 struct ext4_extent *ex)
1606{ 1508{
1607 struct ext4_ext_cache *cex; 1509 struct ext4_ext_cache *cex;
@@ -1714,7 +1616,7 @@ int ext4_ext_calc_credits_for_insert(struct inode *inode,
1714 1616
1715static int ext4_remove_blocks(handle_t *handle, struct inode *inode, 1617static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
1716 struct ext4_extent *ex, 1618 struct ext4_extent *ex,
1717 unsigned long from, unsigned long to) 1619 ext4_lblk_t from, ext4_lblk_t to)
1718{ 1620{
1719 struct buffer_head *bh; 1621 struct buffer_head *bh;
1720 unsigned short ee_len = ext4_ext_get_actual_len(ex); 1622 unsigned short ee_len = ext4_ext_get_actual_len(ex);
@@ -1738,11 +1640,12 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
1738 if (from >= le32_to_cpu(ex->ee_block) 1640 if (from >= le32_to_cpu(ex->ee_block)
1739 && to == le32_to_cpu(ex->ee_block) + ee_len - 1) { 1641 && to == le32_to_cpu(ex->ee_block) + ee_len - 1) {
1740 /* tail removal */ 1642 /* tail removal */
1741 unsigned long num; 1643 ext4_lblk_t num;
1742 ext4_fsblk_t start; 1644 ext4_fsblk_t start;
1645
1743 num = le32_to_cpu(ex->ee_block) + ee_len - from; 1646 num = le32_to_cpu(ex->ee_block) + ee_len - from;
1744 start = ext_pblock(ex) + ee_len - num; 1647 start = ext_pblock(ex) + ee_len - num;
1745 ext_debug("free last %lu blocks starting %llu\n", num, start); 1648 ext_debug("free last %u blocks starting %llu\n", num, start);
1746 for (i = 0; i < num; i++) { 1649 for (i = 0; i < num; i++) {
1747 bh = sb_find_get_block(inode->i_sb, start + i); 1650 bh = sb_find_get_block(inode->i_sb, start + i);
1748 ext4_forget(handle, 0, inode, bh, start + i); 1651 ext4_forget(handle, 0, inode, bh, start + i);
@@ -1750,30 +1653,32 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
1750 ext4_free_blocks(handle, inode, start, num); 1653 ext4_free_blocks(handle, inode, start, num);
1751 } else if (from == le32_to_cpu(ex->ee_block) 1654 } else if (from == le32_to_cpu(ex->ee_block)
1752 && to <= le32_to_cpu(ex->ee_block) + ee_len - 1) { 1655 && to <= le32_to_cpu(ex->ee_block) + ee_len - 1) {
1753 printk("strange request: removal %lu-%lu from %u:%u\n", 1656 printk(KERN_INFO "strange request: removal %u-%u from %u:%u\n",
1754 from, to, le32_to_cpu(ex->ee_block), ee_len); 1657 from, to, le32_to_cpu(ex->ee_block), ee_len);
1755 } else { 1658 } else {
1756 printk("strange request: removal(2) %lu-%lu from %u:%u\n", 1659 printk(KERN_INFO "strange request: removal(2) "
1757 from, to, le32_to_cpu(ex->ee_block), ee_len); 1660 "%u-%u from %u:%u\n",
1661 from, to, le32_to_cpu(ex->ee_block), ee_len);
1758 } 1662 }
1759 return 0; 1663 return 0;
1760} 1664}
1761 1665
1762static int 1666static int
1763ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, 1667ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
1764 struct ext4_ext_path *path, unsigned long start) 1668 struct ext4_ext_path *path, ext4_lblk_t start)
1765{ 1669{
1766 int err = 0, correct_index = 0; 1670 int err = 0, correct_index = 0;
1767 int depth = ext_depth(inode), credits; 1671 int depth = ext_depth(inode), credits;
1768 struct ext4_extent_header *eh; 1672 struct ext4_extent_header *eh;
1769 unsigned a, b, block, num; 1673 ext4_lblk_t a, b, block;
1770 unsigned long ex_ee_block; 1674 unsigned num;
1675 ext4_lblk_t ex_ee_block;
1771 unsigned short ex_ee_len; 1676 unsigned short ex_ee_len;
1772 unsigned uninitialized = 0; 1677 unsigned uninitialized = 0;
1773 struct ext4_extent *ex; 1678 struct ext4_extent *ex;
1774 1679
1775 /* the header must be checked already in ext4_ext_remove_space() */ 1680 /* the header must be checked already in ext4_ext_remove_space() */
1776 ext_debug("truncate since %lu in leaf\n", start); 1681 ext_debug("truncate since %u in leaf\n", start);
1777 if (!path[depth].p_hdr) 1682 if (!path[depth].p_hdr)
1778 path[depth].p_hdr = ext_block_hdr(path[depth].p_bh); 1683 path[depth].p_hdr = ext_block_hdr(path[depth].p_bh);
1779 eh = path[depth].p_hdr; 1684 eh = path[depth].p_hdr;
@@ -1904,7 +1809,7 @@ ext4_ext_more_to_rm(struct ext4_ext_path *path)
1904 return 1; 1809 return 1;
1905} 1810}
1906 1811
1907int ext4_ext_remove_space(struct inode *inode, unsigned long start) 1812int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start)
1908{ 1813{
1909 struct super_block *sb = inode->i_sb; 1814 struct super_block *sb = inode->i_sb;
1910 int depth = ext_depth(inode); 1815 int depth = ext_depth(inode);
@@ -1912,7 +1817,7 @@ int ext4_ext_remove_space(struct inode *inode, unsigned long start)
1912 handle_t *handle; 1817 handle_t *handle;
1913 int i = 0, err = 0; 1818 int i = 0, err = 0;
1914 1819
1915 ext_debug("truncate since %lu\n", start); 1820 ext_debug("truncate since %u\n", start);
1916 1821
1917 /* probably first extent we're gonna free will be last in block */ 1822 /* probably first extent we're gonna free will be last in block */
1918 handle = ext4_journal_start(inode, depth + 1); 1823 handle = ext4_journal_start(inode, depth + 1);
@@ -2094,17 +1999,19 @@ void ext4_ext_release(struct super_block *sb)
2094 * b> Splits in two extents: Write is happening at either end of the extent 1999 * b> Splits in two extents: Write is happening at either end of the extent
2095 * c> Splits in three extents: Somone is writing in middle of the extent 2000 * c> Splits in three extents: Somone is writing in middle of the extent
2096 */ 2001 */
2097int ext4_ext_convert_to_initialized(handle_t *handle, struct inode *inode, 2002static int ext4_ext_convert_to_initialized(handle_t *handle,
2098 struct ext4_ext_path *path, 2003 struct inode *inode,
2099 ext4_fsblk_t iblock, 2004 struct ext4_ext_path *path,
2100 unsigned long max_blocks) 2005 ext4_lblk_t iblock,
2006 unsigned long max_blocks)
2101{ 2007{
2102 struct ext4_extent *ex, newex; 2008 struct ext4_extent *ex, newex;
2103 struct ext4_extent *ex1 = NULL; 2009 struct ext4_extent *ex1 = NULL;
2104 struct ext4_extent *ex2 = NULL; 2010 struct ext4_extent *ex2 = NULL;
2105 struct ext4_extent *ex3 = NULL; 2011 struct ext4_extent *ex3 = NULL;
2106 struct ext4_extent_header *eh; 2012 struct ext4_extent_header *eh;
2107 unsigned int allocated, ee_block, ee_len, depth; 2013 ext4_lblk_t ee_block;
2014 unsigned int allocated, ee_len, depth;
2108 ext4_fsblk_t newblock; 2015 ext4_fsblk_t newblock;
2109 int err = 0; 2016 int err = 0;
2110 int ret = 0; 2017 int ret = 0;
@@ -2226,7 +2133,7 @@ out:
2226} 2133}
2227 2134
2228int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 2135int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2229 ext4_fsblk_t iblock, 2136 ext4_lblk_t iblock,
2230 unsigned long max_blocks, struct buffer_head *bh_result, 2137 unsigned long max_blocks, struct buffer_head *bh_result,
2231 int create, int extend_disksize) 2138 int create, int extend_disksize)
2232{ 2139{
@@ -2238,8 +2145,9 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2238 unsigned long allocated = 0; 2145 unsigned long allocated = 0;
2239 2146
2240 __clear_bit(BH_New, &bh_result->b_state); 2147 __clear_bit(BH_New, &bh_result->b_state);
2241 ext_debug("blocks %d/%lu requested for inode %u\n", (int) iblock, 2148 ext_debug("blocks %lu/%lu requested for inode %u\n",
2242 max_blocks, (unsigned) inode->i_ino); 2149 (unsigned long) iblock, max_blocks,
2150 (unsigned) inode->i_ino);
2243 mutex_lock(&EXT4_I(inode)->truncate_mutex); 2151 mutex_lock(&EXT4_I(inode)->truncate_mutex);
2244 2152
2245 /* check in cache */ 2153 /* check in cache */
@@ -2288,7 +2196,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2288 2196
2289 ex = path[depth].p_ext; 2197 ex = path[depth].p_ext;
2290 if (ex) { 2198 if (ex) {
2291 unsigned long ee_block = le32_to_cpu(ex->ee_block); 2199 ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block);
2292 ext4_fsblk_t ee_start = ext_pblock(ex); 2200 ext4_fsblk_t ee_start = ext_pblock(ex);
2293 unsigned short ee_len; 2201 unsigned short ee_len;
2294 2202
@@ -2423,7 +2331,7 @@ void ext4_ext_truncate(struct inode * inode, struct page *page)
2423{ 2331{
2424 struct address_space *mapping = inode->i_mapping; 2332 struct address_space *mapping = inode->i_mapping;
2425 struct super_block *sb = inode->i_sb; 2333 struct super_block *sb = inode->i_sb;
2426 unsigned long last_block; 2334 ext4_lblk_t last_block;
2427 handle_t *handle; 2335 handle_t *handle;
2428 int err = 0; 2336 int err = 0;
2429 2337
@@ -2516,7 +2424,8 @@ int ext4_ext_writepage_trans_blocks(struct inode *inode, int num)
2516long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) 2424long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
2517{ 2425{
2518 handle_t *handle; 2426 handle_t *handle;
2519 ext4_fsblk_t block, max_blocks; 2427 ext4_lblk_t block;
2428 unsigned long max_blocks;
2520 ext4_fsblk_t nblocks = 0; 2429 ext4_fsblk_t nblocks = 0;
2521 int ret = 0; 2430 int ret = 0;
2522 int ret2 = 0; 2431 int ret2 = 0;
@@ -2561,8 +2470,9 @@ retry:
2561 if (!ret) { 2470 if (!ret) {
2562 ext4_error(inode->i_sb, "ext4_fallocate", 2471 ext4_error(inode->i_sb, "ext4_fallocate",
2563 "ext4_ext_get_blocks returned 0! inode#%lu" 2472 "ext4_ext_get_blocks returned 0! inode#%lu"
2564 ", block=%llu, max_blocks=%llu", 2473 ", block=%lu, max_blocks=%lu",
2565 inode->i_ino, block, max_blocks); 2474 inode->i_ino, (unsigned long)block,
2475 (unsigned long)max_blocks);
2566 ret = -EIO; 2476 ret = -EIO;
2567 ext4_mark_inode_dirty(handle, inode); 2477 ext4_mark_inode_dirty(handle, inode);
2568 ret2 = ext4_journal_stop(handle); 2478 ret2 = ext4_journal_stop(handle);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5489703d9573..488f829a8879 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -105,7 +105,7 @@ int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
105 */ 105 */
106static unsigned long blocks_for_truncate(struct inode *inode) 106static unsigned long blocks_for_truncate(struct inode *inode)
107{ 107{
108 unsigned long needed; 108 ext4_lblk_t needed;
109 109
110 needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9); 110 needed = inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9);
111 111
@@ -282,7 +282,8 @@ static int verify_chain(Indirect *from, Indirect *to)
282 */ 282 */
283 283
284static int ext4_block_to_path(struct inode *inode, 284static int ext4_block_to_path(struct inode *inode,
285 long i_block, int offsets[4], int *boundary) 285 ext4_lblk_t i_block,
286 ext4_lblk_t offsets[4], int *boundary)
286{ 287{
287 int ptrs = EXT4_ADDR_PER_BLOCK(inode->i_sb); 288 int ptrs = EXT4_ADDR_PER_BLOCK(inode->i_sb);
288 int ptrs_bits = EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb); 289 int ptrs_bits = EXT4_ADDR_PER_BLOCK_BITS(inode->i_sb);
@@ -349,7 +350,8 @@ static int ext4_block_to_path(struct inode *inode,
349 * or when it reads all @depth-1 indirect blocks successfully and finds 350 * or when it reads all @depth-1 indirect blocks successfully and finds
350 * the whole chain, all way to the data (returns %NULL, *err == 0). 351 * the whole chain, all way to the data (returns %NULL, *err == 0).
351 */ 352 */
352static Indirect *ext4_get_branch(struct inode *inode, int depth, int *offsets, 353static Indirect *ext4_get_branch(struct inode *inode, int depth,
354 ext4_lblk_t *offsets,
353 Indirect chain[4], int *err) 355 Indirect chain[4], int *err)
354{ 356{
355 struct super_block *sb = inode->i_sb; 357 struct super_block *sb = inode->i_sb;
@@ -445,7 +447,7 @@ static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind)
445 * stores it in *@goal and returns zero. 447 * stores it in *@goal and returns zero.
446 */ 448 */
447 449
448static ext4_fsblk_t ext4_find_goal(struct inode *inode, long block, 450static ext4_fsblk_t ext4_find_goal(struct inode *inode, ext4_lblk_t block,
449 Indirect chain[4], Indirect *partial) 451 Indirect chain[4], Indirect *partial)
450{ 452{
451 struct ext4_block_alloc_info *block_i; 453 struct ext4_block_alloc_info *block_i;
@@ -590,7 +592,7 @@ failed_out:
590 */ 592 */
591static int ext4_alloc_branch(handle_t *handle, struct inode *inode, 593static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
592 int indirect_blks, int *blks, ext4_fsblk_t goal, 594 int indirect_blks, int *blks, ext4_fsblk_t goal,
593 int *offsets, Indirect *branch) 595 ext4_lblk_t *offsets, Indirect *branch)
594{ 596{
595 int blocksize = inode->i_sb->s_blocksize; 597 int blocksize = inode->i_sb->s_blocksize;
596 int i, n = 0; 598 int i, n = 0;
@@ -680,7 +682,7 @@ failed:
680 * chain to new block and return 0. 682 * chain to new block and return 0.
681 */ 683 */
682static int ext4_splice_branch(handle_t *handle, struct inode *inode, 684static int ext4_splice_branch(handle_t *handle, struct inode *inode,
683 long block, Indirect *where, int num, int blks) 685 ext4_lblk_t block, Indirect *where, int num, int blks)
684{ 686{
685 int i; 687 int i;
686 int err = 0; 688 int err = 0;
@@ -784,12 +786,12 @@ err_out:
784 * return < 0, error case. 786 * return < 0, error case.
785 */ 787 */
786int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, 788int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
787 sector_t iblock, unsigned long maxblocks, 789 ext4_lblk_t iblock, unsigned long maxblocks,
788 struct buffer_head *bh_result, 790 struct buffer_head *bh_result,
789 int create, int extend_disksize) 791 int create, int extend_disksize)
790{ 792{
791 int err = -EIO; 793 int err = -EIO;
792 int offsets[4]; 794 ext4_lblk_t offsets[4];
793 Indirect chain[4]; 795 Indirect chain[4];
794 Indirect *partial; 796 Indirect *partial;
795 ext4_fsblk_t goal; 797 ext4_fsblk_t goal;
@@ -803,7 +805,8 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
803 805
804 J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)); 806 J_ASSERT(!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL));
805 J_ASSERT(handle != NULL || create == 0); 807 J_ASSERT(handle != NULL || create == 0);
806 depth = ext4_block_to_path(inode,iblock,offsets,&blocks_to_boundary); 808 depth = ext4_block_to_path(inode, iblock, offsets,
809 &blocks_to_boundary);
807 810
808 if (depth == 0) 811 if (depth == 0)
809 goto out; 812 goto out;
@@ -996,7 +999,7 @@ get_block:
996 * `handle' can be NULL if create is zero 999 * `handle' can be NULL if create is zero
997 */ 1000 */
998struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode, 1001struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
999 long block, int create, int *errp) 1002 ext4_lblk_t block, int create, int *errp)
1000{ 1003{
1001 struct buffer_head dummy; 1004 struct buffer_head dummy;
1002 int fatal = 0, err; 1005 int fatal = 0, err;
@@ -1063,7 +1066,7 @@ err:
1063} 1066}
1064 1067
1065struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode, 1068struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
1066 int block, int create, int *err) 1069 ext4_lblk_t block, int create, int *err)
1067{ 1070{
1068 struct buffer_head * bh; 1071 struct buffer_head * bh;
1069 1072
@@ -1828,7 +1831,8 @@ int ext4_block_truncate_page(handle_t *handle, struct page *page,
1828{ 1831{
1829 ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT; 1832 ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT;
1830 unsigned offset = from & (PAGE_CACHE_SIZE-1); 1833 unsigned offset = from & (PAGE_CACHE_SIZE-1);
1831 unsigned blocksize, iblock, length, pos; 1834 unsigned blocksize, length, pos;
1835 ext4_lblk_t iblock;
1832 struct inode *inode = mapping->host; 1836 struct inode *inode = mapping->host;
1833 struct buffer_head *bh; 1837 struct buffer_head *bh;
1834 int err = 0; 1838 int err = 0;
@@ -1964,7 +1968,7 @@ static inline int all_zeroes(__le32 *p, __le32 *q)
1964 * (no partially truncated stuff there). */ 1968 * (no partially truncated stuff there). */
1965 1969
1966static Indirect *ext4_find_shared(struct inode *inode, int depth, 1970static Indirect *ext4_find_shared(struct inode *inode, int depth,
1967 int offsets[4], Indirect chain[4], __le32 *top) 1971 ext4_lblk_t offsets[4], Indirect chain[4], __le32 *top)
1968{ 1972{
1969 Indirect *partial, *p; 1973 Indirect *partial, *p;
1970 int k, err; 1974 int k, err;
@@ -2289,12 +2293,12 @@ void ext4_truncate(struct inode *inode)
2289 __le32 *i_data = ei->i_data; 2293 __le32 *i_data = ei->i_data;
2290 int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb); 2294 int addr_per_block = EXT4_ADDR_PER_BLOCK(inode->i_sb);
2291 struct address_space *mapping = inode->i_mapping; 2295 struct address_space *mapping = inode->i_mapping;
2292 int offsets[4]; 2296 ext4_lblk_t offsets[4];
2293 Indirect chain[4]; 2297 Indirect chain[4];
2294 Indirect *partial; 2298 Indirect *partial;
2295 __le32 nr = 0; 2299 __le32 nr = 0;
2296 int n; 2300 int n;
2297 long last_block; 2301 ext4_lblk_t last_block;
2298 unsigned blocksize = inode->i_sb->s_blocksize; 2302 unsigned blocksize = inode->i_sb->s_blocksize;
2299 struct page *page; 2303 struct page *page;
2300 2304
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index d9a3a2fc5b0d..fb673b14ccd5 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -51,7 +51,7 @@
51 51
52static struct buffer_head *ext4_append(handle_t *handle, 52static struct buffer_head *ext4_append(handle_t *handle,
53 struct inode *inode, 53 struct inode *inode,
54 u32 *block, int *err) 54 ext4_lblk_t *block, int *err)
55{ 55{
56 struct buffer_head *bh; 56 struct buffer_head *bh;
57 57
@@ -144,8 +144,8 @@ struct dx_map_entry
144 u16 size; 144 u16 size;
145}; 145};
146 146
147static inline unsigned dx_get_block (struct dx_entry *entry); 147static inline ext4_lblk_t dx_get_block(struct dx_entry *entry);
148static void dx_set_block (struct dx_entry *entry, unsigned value); 148static void dx_set_block(struct dx_entry *entry, ext4_lblk_t value);
149static inline unsigned dx_get_hash (struct dx_entry *entry); 149static inline unsigned dx_get_hash (struct dx_entry *entry);
150static void dx_set_hash (struct dx_entry *entry, unsigned value); 150static void dx_set_hash (struct dx_entry *entry, unsigned value);
151static unsigned dx_get_count (struct dx_entry *entries); 151static unsigned dx_get_count (struct dx_entry *entries);
@@ -166,7 +166,8 @@ static void dx_sort_map(struct dx_map_entry *map, unsigned count);
166static struct ext4_dir_entry_2 *dx_move_dirents (char *from, char *to, 166static struct ext4_dir_entry_2 *dx_move_dirents (char *from, char *to,
167 struct dx_map_entry *offsets, int count); 167 struct dx_map_entry *offsets, int count);
168static struct ext4_dir_entry_2* dx_pack_dirents (char *base, int size); 168static struct ext4_dir_entry_2* dx_pack_dirents (char *base, int size);
169static void dx_insert_block (struct dx_frame *frame, u32 hash, u32 block); 169static void dx_insert_block(struct dx_frame *frame,
170 u32 hash, ext4_lblk_t block);
170static int ext4_htree_next_block(struct inode *dir, __u32 hash, 171static int ext4_htree_next_block(struct inode *dir, __u32 hash,
171 struct dx_frame *frame, 172 struct dx_frame *frame,
172 struct dx_frame *frames, 173 struct dx_frame *frames,
@@ -181,12 +182,12 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
181 * Mask them off for now. 182 * Mask them off for now.
182 */ 183 */
183 184
184static inline unsigned dx_get_block (struct dx_entry *entry) 185static inline ext4_lblk_t dx_get_block(struct dx_entry *entry)
185{ 186{
186 return le32_to_cpu(entry->block) & 0x00ffffff; 187 return le32_to_cpu(entry->block) & 0x00ffffff;
187} 188}
188 189
189static inline void dx_set_block (struct dx_entry *entry, unsigned value) 190static inline void dx_set_block(struct dx_entry *entry, ext4_lblk_t value)
190{ 191{
191 entry->block = cpu_to_le32(value); 192 entry->block = cpu_to_le32(value);
192} 193}
@@ -243,8 +244,8 @@ static void dx_show_index (char * label, struct dx_entry *entries)
243 int i, n = dx_get_count (entries); 244 int i, n = dx_get_count (entries);
244 printk("%s index ", label); 245 printk("%s index ", label);
245 for (i = 0; i < n; i++) { 246 for (i = 0; i < n; i++) {
246 printk("%x->%u ", i? dx_get_hash(entries + i) : 247 printk("%x->%lu ", i? dx_get_hash(entries + i) :
247 0, dx_get_block(entries + i)); 248 0, (unsigned long)dx_get_block(entries + i));
248 } 249 }
249 printk("\n"); 250 printk("\n");
250} 251}
@@ -297,7 +298,8 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
297 printk("%i indexed blocks...\n", count); 298 printk("%i indexed blocks...\n", count);
298 for (i = 0; i < count; i++, entries++) 299 for (i = 0; i < count; i++, entries++)
299 { 300 {
300 u32 block = dx_get_block(entries), hash = i? dx_get_hash(entries): 0; 301 ext4_lblk_t block = dx_get_block(entries);
302 ext4_lblk_t hash = i ? dx_get_hash(entries): 0;
301 u32 range = i < count - 1? (dx_get_hash(entries + 1) - hash): ~hash; 303 u32 range = i < count - 1? (dx_get_hash(entries + 1) - hash): ~hash;
302 struct stats stats; 304 struct stats stats;
303 printk("%s%3u:%03u hash %8x/%8x ",levels?"":" ", i, block, hash, range); 305 printk("%s%3u:%03u hash %8x/%8x ",levels?"":" ", i, block, hash, range);
@@ -561,7 +563,7 @@ static inline struct ext4_dir_entry_2 *ext4_next_entry(struct ext4_dir_entry_2 *
561 * into the tree. If there is an error it is returned in err. 563 * into the tree. If there is an error it is returned in err.
562 */ 564 */
563static int htree_dirblock_to_tree(struct file *dir_file, 565static int htree_dirblock_to_tree(struct file *dir_file,
564 struct inode *dir, int block, 566 struct inode *dir, ext4_lblk_t block,
565 struct dx_hash_info *hinfo, 567 struct dx_hash_info *hinfo,
566 __u32 start_hash, __u32 start_minor_hash) 568 __u32 start_hash, __u32 start_minor_hash)
567{ 569{
@@ -569,7 +571,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
569 struct ext4_dir_entry_2 *de, *top; 571 struct ext4_dir_entry_2 *de, *top;
570 int err, count = 0; 572 int err, count = 0;
571 573
572 dxtrace(printk("In htree dirblock_to_tree: block %d\n", block)); 574 dxtrace(printk(KERN_INFO "In htree dirblock_to_tree: block %lu\n",
575 (unsigned long)block));
573 if (!(bh = ext4_bread (NULL, dir, block, 0, &err))) 576 if (!(bh = ext4_bread (NULL, dir, block, 0, &err)))
574 return err; 577 return err;
575 578
@@ -621,9 +624,9 @@ int ext4_htree_fill_tree(struct file *dir_file, __u32 start_hash,
621 struct ext4_dir_entry_2 *de; 624 struct ext4_dir_entry_2 *de;
622 struct dx_frame frames[2], *frame; 625 struct dx_frame frames[2], *frame;
623 struct inode *dir; 626 struct inode *dir;
624 int block, err; 627 ext4_lblk_t block;
625 int count = 0; 628 int count = 0;
626 int ret; 629 int ret, err;
627 __u32 hashval; 630 __u32 hashval;
628 631
629 dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash, 632 dxtrace(printk("In htree_fill_tree, start hash: %x:%x\n", start_hash,
@@ -753,7 +756,7 @@ static void dx_sort_map (struct dx_map_entry *map, unsigned count)
753 } while(more); 756 } while(more);
754} 757}
755 758
756static void dx_insert_block(struct dx_frame *frame, u32 hash, u32 block) 759static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block)
757{ 760{
758 struct dx_entry *entries = frame->entries; 761 struct dx_entry *entries = frame->entries;
759 struct dx_entry *old = frame->at, *new = old + 1; 762 struct dx_entry *old = frame->at, *new = old + 1;
@@ -848,13 +851,14 @@ static struct buffer_head * ext4_find_entry (struct dentry *dentry,
848 struct super_block * sb; 851 struct super_block * sb;
849 struct buffer_head * bh_use[NAMEI_RA_SIZE]; 852 struct buffer_head * bh_use[NAMEI_RA_SIZE];
850 struct buffer_head * bh, *ret = NULL; 853 struct buffer_head * bh, *ret = NULL;
851 unsigned long start, block, b; 854 ext4_lblk_t start, block, b;
852 int ra_max = 0; /* Number of bh's in the readahead 855 int ra_max = 0; /* Number of bh's in the readahead
853 buffer, bh_use[] */ 856 buffer, bh_use[] */
854 int ra_ptr = 0; /* Current index into readahead 857 int ra_ptr = 0; /* Current index into readahead
855 buffer */ 858 buffer */
856 int num = 0; 859 int num = 0;
857 int nblocks, i, err; 860 ext4_lblk_t nblocks;
861 int i, err;
858 struct inode *dir = dentry->d_parent->d_inode; 862 struct inode *dir = dentry->d_parent->d_inode;
859 int namelen; 863 int namelen;
860 const u8 *name; 864 const u8 *name;
@@ -915,7 +919,8 @@ restart:
915 if (!buffer_uptodate(bh)) { 919 if (!buffer_uptodate(bh)) {
916 /* read error, skip block & hope for the best */ 920 /* read error, skip block & hope for the best */
917 ext4_error(sb, __FUNCTION__, "reading directory #%lu " 921 ext4_error(sb, __FUNCTION__, "reading directory #%lu "
918 "offset %lu", dir->i_ino, block); 922 "offset %lu", dir->i_ino,
923 (unsigned long)block);
919 brelse(bh); 924 brelse(bh);
920 goto next; 925 goto next;
921 } 926 }
@@ -962,7 +967,7 @@ static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry,
962 struct dx_frame frames[2], *frame; 967 struct dx_frame frames[2], *frame;
963 struct ext4_dir_entry_2 *de, *top; 968 struct ext4_dir_entry_2 *de, *top;
964 struct buffer_head *bh; 969 struct buffer_head *bh;
965 unsigned long block; 970 ext4_lblk_t block;
966 int retval; 971 int retval;
967 int namelen = dentry->d_name.len; 972 int namelen = dentry->d_name.len;
968 const u8 *name = dentry->d_name.name; 973 const u8 *name = dentry->d_name.name;
@@ -1174,7 +1179,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1174 unsigned blocksize = dir->i_sb->s_blocksize; 1179 unsigned blocksize = dir->i_sb->s_blocksize;
1175 unsigned count, continued; 1180 unsigned count, continued;
1176 struct buffer_head *bh2; 1181 struct buffer_head *bh2;
1177 u32 newblock; 1182 ext4_lblk_t newblock;
1178 u32 hash2; 1183 u32 hash2;
1179 struct dx_map_entry *map; 1184 struct dx_map_entry *map;
1180 char *data1 = (*bh)->b_data, *data2; 1185 char *data1 = (*bh)->b_data, *data2;
@@ -1221,8 +1226,9 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
1221 split = count - move; 1226 split = count - move;
1222 hash2 = map[split].hash; 1227 hash2 = map[split].hash;
1223 continued = hash2 == map[split - 1].hash; 1228 continued = hash2 == map[split - 1].hash;
1224 dxtrace(printk("Split block %i at %x, %i/%i\n", 1229 dxtrace(printk(KERN_INFO "Split block %lu at %x, %i/%i\n",
1225 dx_get_block(frame->at), hash2, split, count-split)); 1230 (unsigned long)dx_get_block(frame->at),
1231 hash2, split, count-split));
1226 1232
1227 /* Fancy dance to stay within two buffers */ 1233 /* Fancy dance to stay within two buffers */
1228 de2 = dx_move_dirents(data1, data2, map + split, count - split); 1234 de2 = dx_move_dirents(data1, data2, map + split, count - split);
@@ -1374,7 +1380,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1374 int retval; 1380 int retval;
1375 unsigned blocksize; 1381 unsigned blocksize;
1376 struct dx_hash_info hinfo; 1382 struct dx_hash_info hinfo;
1377 u32 block; 1383 ext4_lblk_t block;
1378 struct fake_dirent *fde; 1384 struct fake_dirent *fde;
1379 1385
1380 blocksize = dir->i_sb->s_blocksize; 1386 blocksize = dir->i_sb->s_blocksize;
@@ -1455,7 +1461,7 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1455 int retval; 1461 int retval;
1456 int dx_fallback=0; 1462 int dx_fallback=0;
1457 unsigned blocksize; 1463 unsigned blocksize;
1458 u32 block, blocks; 1464 ext4_lblk_t block, blocks;
1459 1465
1460 sb = dir->i_sb; 1466 sb = dir->i_sb;
1461 blocksize = sb->s_blocksize; 1467 blocksize = sb->s_blocksize;
@@ -1532,7 +1538,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1532 dx_get_count(entries), dx_get_limit(entries))); 1538 dx_get_count(entries), dx_get_limit(entries)));
1533 /* Need to split index? */ 1539 /* Need to split index? */
1534 if (dx_get_count(entries) == dx_get_limit(entries)) { 1540 if (dx_get_count(entries) == dx_get_limit(entries)) {
1535 u32 newblock; 1541 ext4_lblk_t newblock;
1536 unsigned icount = dx_get_count(entries); 1542 unsigned icount = dx_get_count(entries);
1537 int levels = frame - frames; 1543 int levels = frame - frames;
1538 struct dx_entry *entries2; 1544 struct dx_entry *entries2;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ab7010dde1b5..6302b036c121 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2914,7 +2914,7 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
2914 size_t len, loff_t off) 2914 size_t len, loff_t off)
2915{ 2915{
2916 struct inode *inode = sb_dqopt(sb)->files[type]; 2916 struct inode *inode = sb_dqopt(sb)->files[type];
2917 sector_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); 2917 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb);
2918 int err = 0; 2918 int err = 0;
2919 int offset = off & (sb->s_blocksize - 1); 2919 int offset = off & (sb->s_blocksize - 1);
2920 int tocopy; 2920 int tocopy;
@@ -2952,7 +2952,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
2952 const char *data, size_t len, loff_t off) 2952 const char *data, size_t len, loff_t off)
2953{ 2953{
2954 struct inode *inode = sb_dqopt(sb)->files[type]; 2954 struct inode *inode = sb_dqopt(sb)->files[type];
2955 sector_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); 2955 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb);
2956 int err = 0; 2956 int err = 0;
2957 int offset = off & (sb->s_blocksize - 1); 2957 int offset = off & (sb->s_blocksize - 1);
2958 int tocopy; 2958 int tocopy;