aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext3/balloc.c29
-rw-r--r--fs/ext3/inode.c55
-rw-r--r--fs/ext3/ioctl.c2
-rw-r--r--fs/ext3/resize.c34
-rw-r--r--fs/ext3/super.c32
-rw-r--r--fs/ext3/xattr.c12
-rw-r--r--include/linux/ext3_fs.h12
-rw-r--r--include/linux/ext3_fs_i.h8
8 files changed, 96 insertions, 88 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c
index b1633cd28ec..96172e89ddc 100644
--- a/fs/ext3/balloc.c
+++ b/fs/ext3/balloc.c
@@ -168,8 +168,7 @@ goal_in_my_reservation(struct ext3_reserve_window *rsv, ext3_grpblk_t grp_goal,
168{ 168{
169 ext3_fsblk_t group_first_block, group_last_block; 169 ext3_fsblk_t group_first_block, group_last_block;
170 170
171 group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + 171 group_first_block = ext3_group_first_block_no(sb, group);
172 group * EXT3_BLOCKS_PER_GROUP(sb);
173 group_last_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1; 172 group_last_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1;
174 173
175 if ((rsv->_rsv_start > group_last_block) || 174 if ((rsv->_rsv_start > group_last_block) ||
@@ -664,9 +663,7 @@ ext3_try_to_allocate(struct super_block *sb, handle_t *handle, int group,
664 663
665 /* we do allocation within the reservation window if we have a window */ 664 /* we do allocation within the reservation window if we have a window */
666 if (my_rsv) { 665 if (my_rsv) {
667 group_first_block = 666 group_first_block = ext3_group_first_block_no(sb, group);
668 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) +
669 group * EXT3_BLOCKS_PER_GROUP(sb);
670 if (my_rsv->_rsv_start >= group_first_block) 667 if (my_rsv->_rsv_start >= group_first_block)
671 start = my_rsv->_rsv_start - group_first_block; 668 start = my_rsv->_rsv_start - group_first_block;
672 else 669 else
@@ -900,8 +897,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
900 int ret; 897 int ret;
901 spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; 898 spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock;
902 899
903 group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + 900 group_first_block = ext3_group_first_block_no(sb, group);
904 group * EXT3_BLOCKS_PER_GROUP(sb);
905 group_end_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1; 901 group_end_block = group_first_block + EXT3_BLOCKS_PER_GROUP(sb) - 1;
906 902
907 if (grp_goal < 0) 903 if (grp_goal < 0)
@@ -1104,8 +1100,7 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
1104 * first block is a filesystem wide block number 1100 * first block is a filesystem wide block number
1105 * first block is the block number of the first block in this group 1101 * first block is the block number of the first block in this group
1106 */ 1102 */
1107 group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + 1103 group_first_block = ext3_group_first_block_no(sb, group);
1108 group * EXT3_BLOCKS_PER_GROUP(sb);
1109 1104
1110 /* 1105 /*
1111 * Basically we will allocate a new block from inode's reservation 1106 * Basically we will allocate a new block from inode's reservation
@@ -1371,8 +1366,7 @@ allocated:
1371 if (fatal) 1366 if (fatal)
1372 goto out; 1367 goto out;
1373 1368
1374 ret_block = grp_alloc_blk + group_no * EXT3_BLOCKS_PER_GROUP(sb) 1369 ret_block = grp_alloc_blk + ext3_group_first_block_no(sb, group_no);
1375 + le32_to_cpu(es->s_first_data_block);
1376 1370
1377 if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) || 1371 if (in_range(le32_to_cpu(gdp->bg_block_bitmap), ret_block, num) ||
1378 in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) || 1372 in_range(le32_to_cpu(gdp->bg_inode_bitmap), ret_block, num) ||
@@ -1478,15 +1472,16 @@ ext3_fsblk_t ext3_new_block(handle_t *handle, struct inode *inode,
1478 return ext3_new_blocks(handle, inode, goal, &count, errp); 1472 return ext3_new_blocks(handle, inode, goal, &count, errp);
1479} 1473}
1480 1474
1481unsigned long ext3_count_free_blocks(struct super_block *sb) 1475ext3_fsblk_t ext3_count_free_blocks(struct super_block *sb)
1482{ 1476{
1483 unsigned long desc_count; 1477 ext3_fsblk_t desc_count;
1484 struct ext3_group_desc *gdp; 1478 struct ext3_group_desc *gdp;
1485 int i; 1479 int i;
1486 unsigned long ngroups = EXT3_SB(sb)->s_groups_count; 1480 unsigned long ngroups = EXT3_SB(sb)->s_groups_count;
1487#ifdef EXT3FS_DEBUG 1481#ifdef EXT3FS_DEBUG
1488 struct ext3_super_block *es; 1482 struct ext3_super_block *es;
1489 unsigned long bitmap_count, x; 1483 ext3_fsblk_t bitmap_count;
1484 unsigned long x;
1490 struct buffer_head *bitmap_bh = NULL; 1485 struct buffer_head *bitmap_bh = NULL;
1491 1486
1492 es = EXT3_SB(sb)->s_es; 1487 es = EXT3_SB(sb)->s_es;
@@ -1511,8 +1506,10 @@ unsigned long ext3_count_free_blocks(struct super_block *sb)
1511 bitmap_count += x; 1506 bitmap_count += x;
1512 } 1507 }
1513 brelse(bitmap_bh); 1508 brelse(bitmap_bh);
1514 printk("ext3_count_free_blocks: stored = %u, computed = %lu, %lu\n", 1509 printk("ext3_count_free_blocks: stored = "E3FSBLK
1515 le32_to_cpu(es->s_free_blocks_count), desc_count, bitmap_count); 1510 ", computed = "E3FSBLK", "E3FSBLK"\n",
1511 le32_to_cpu(es->s_free_blocks_count),
1512 desc_count, bitmap_count);
1516 return bitmap_count; 1513 return bitmap_count;
1517#else 1514#else
1518 desc_count = 0; 1515 desc_count = 0;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index b02bc32c57a..0321e1b9034 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -407,13 +407,13 @@ no_block:
407 * 407 *
408 * Caller must make sure that @ind is valid and will stay that way. 408 * Caller must make sure that @ind is valid and will stay that way.
409 */ 409 */
410static unsigned long ext3_find_near(struct inode *inode, Indirect *ind) 410static ext3_fsblk_t ext3_find_near(struct inode *inode, Indirect *ind)
411{ 411{
412 struct ext3_inode_info *ei = EXT3_I(inode); 412 struct ext3_inode_info *ei = EXT3_I(inode);
413 __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; 413 __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data;
414 __le32 *p; 414 __le32 *p;
415 unsigned long bg_start; 415 ext3_fsblk_t bg_start;
416 unsigned long colour; 416 ext3_grpblk_t colour;
417 417
418 /* Try to find previous block */ 418 /* Try to find previous block */
419 for (p = ind->p - 1; p >= start; p--) { 419 for (p = ind->p - 1; p >= start; p--) {
@@ -429,8 +429,7 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
429 * It is going to be referred to from the inode itself? OK, just put it 429 * It is going to be referred to from the inode itself? OK, just put it
430 * into the same cylinder group then. 430 * into the same cylinder group then.
431 */ 431 */
432 bg_start = (ei->i_block_group * EXT3_BLOCKS_PER_GROUP(inode->i_sb)) + 432 bg_start = ext3_group_first_block_no(inode->i_sb, ei->i_block_group);
433 le32_to_cpu(EXT3_SB(inode->i_sb)->s_es->s_first_data_block);
434 colour = (current->pid % 16) * 433 colour = (current->pid % 16) *
435 (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16); 434 (EXT3_BLOCKS_PER_GROUP(inode->i_sb) / 16);
436 return bg_start + colour; 435 return bg_start + colour;
@@ -448,7 +447,7 @@ static unsigned long ext3_find_near(struct inode *inode, Indirect *ind)
448 * stores it in *@goal and returns zero. 447 * stores it in *@goal and returns zero.
449 */ 448 */
450 449
451static unsigned long ext3_find_goal(struct inode *inode, long block, 450static ext3_fsblk_t ext3_find_goal(struct inode *inode, long block,
452 Indirect chain[4], Indirect *partial) 451 Indirect chain[4], Indirect *partial)
453{ 452{
454 struct ext3_block_alloc_info *block_i; 453 struct ext3_block_alloc_info *block_i;
@@ -516,13 +515,13 @@ static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks,
516 * direct blocks 515 * direct blocks
517 */ 516 */
518static int ext3_alloc_blocks(handle_t *handle, struct inode *inode, 517static int ext3_alloc_blocks(handle_t *handle, struct inode *inode,
519 unsigned long goal, int indirect_blks, int blks, 518 ext3_fsblk_t goal, int indirect_blks, int blks,
520 unsigned long long new_blocks[4], int *err) 519 ext3_fsblk_t new_blocks[4], int *err)
521{ 520{
522 int target, i; 521 int target, i;
523 unsigned long count = 0; 522 unsigned long count = 0;
524 int index = 0; 523 int index = 0;
525 unsigned long current_block = 0; 524 ext3_fsblk_t current_block = 0;
526 int ret = 0; 525 int ret = 0;
527 526
528 /* 527 /*
@@ -592,7 +591,7 @@ failed_out:
592 * as described above and return 0. 591 * as described above and return 0.
593 */ 592 */
594static int ext3_alloc_branch(handle_t *handle, struct inode *inode, 593static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
595 int indirect_blks, int *blks, unsigned long goal, 594 int indirect_blks, int *blks, ext3_fsblk_t goal,
596 int *offsets, Indirect *branch) 595 int *offsets, Indirect *branch)
597{ 596{
598 int blocksize = inode->i_sb->s_blocksize; 597 int blocksize = inode->i_sb->s_blocksize;
@@ -600,8 +599,8 @@ static int ext3_alloc_branch(handle_t *handle, struct inode *inode,
600 int err = 0; 599 int err = 0;
601 struct buffer_head *bh; 600 struct buffer_head *bh;
602 int num; 601 int num;
603 unsigned long long new_blocks[4]; 602 ext3_fsblk_t new_blocks[4];
604 unsigned long long current_block; 603 ext3_fsblk_t current_block;
605 604
606 num = ext3_alloc_blocks(handle, inode, goal, indirect_blks, 605 num = ext3_alloc_blocks(handle, inode, goal, indirect_blks,
607 *blks, new_blocks, &err); 606 *blks, new_blocks, &err);
@@ -688,7 +687,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
688 int i; 687 int i;
689 int err = 0; 688 int err = 0;
690 struct ext3_block_alloc_info *block_i; 689 struct ext3_block_alloc_info *block_i;
691 unsigned long current_block; 690 ext3_fsblk_t current_block;
692 691
693 block_i = EXT3_I(inode)->i_block_alloc_info; 692 block_i = EXT3_I(inode)->i_block_alloc_info;
694 /* 693 /*
@@ -795,13 +794,13 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
795 int offsets[4]; 794 int offsets[4];
796 Indirect chain[4]; 795 Indirect chain[4];
797 Indirect *partial; 796 Indirect *partial;
798 unsigned long goal; 797 ext3_fsblk_t goal;
799 int indirect_blks; 798 int indirect_blks;
800 int blocks_to_boundary = 0; 799 int blocks_to_boundary = 0;
801 int depth; 800 int depth;
802 struct ext3_inode_info *ei = EXT3_I(inode); 801 struct ext3_inode_info *ei = EXT3_I(inode);
803 int count = 0; 802 int count = 0;
804 unsigned long first_block = 0; 803 ext3_fsblk_t first_block = 0;
805 804
806 805
807 J_ASSERT(handle != NULL || create == 0); 806 J_ASSERT(handle != NULL || create == 0);
@@ -819,7 +818,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
819 count++; 818 count++;
820 /*map more blocks*/ 819 /*map more blocks*/
821 while (count < maxblocks && count <= blocks_to_boundary) { 820 while (count < maxblocks && count <= blocks_to_boundary) {
822 unsigned long blk; 821 ext3_fsblk_t blk;
823 822
824 if (!verify_chain(chain, partial)) { 823 if (!verify_chain(chain, partial)) {
825 /* 824 /*
@@ -1759,7 +1758,7 @@ void ext3_set_aops(struct inode *inode)
1759static int ext3_block_truncate_page(handle_t *handle, struct page *page, 1758static int ext3_block_truncate_page(handle_t *handle, struct page *page,
1760 struct address_space *mapping, loff_t from) 1759 struct address_space *mapping, loff_t from)
1761{ 1760{
1762 unsigned long index = from >> PAGE_CACHE_SHIFT; 1761 ext3_fsblk_t index = from >> PAGE_CACHE_SHIFT;
1763 unsigned offset = from & (PAGE_CACHE_SIZE-1); 1762 unsigned offset = from & (PAGE_CACHE_SIZE-1);
1764 unsigned blocksize, iblock, length, pos; 1763 unsigned blocksize, iblock, length, pos;
1765 struct inode *inode = mapping->host; 1764 struct inode *inode = mapping->host;
@@ -1960,7 +1959,7 @@ no_top:
1960 * than `count' because there can be holes in there. 1959 * than `count' because there can be holes in there.
1961 */ 1960 */
1962static void ext3_clear_blocks(handle_t *handle, struct inode *inode, 1961static void ext3_clear_blocks(handle_t *handle, struct inode *inode,
1963 struct buffer_head *bh, unsigned long block_to_free, 1962 struct buffer_head *bh, ext3_fsblk_t block_to_free,
1964 unsigned long count, __le32 *first, __le32 *last) 1963 unsigned long count, __le32 *first, __le32 *last)
1965{ 1964{
1966 __le32 *p; 1965 __le32 *p;
@@ -2022,12 +2021,12 @@ static void ext3_free_data(handle_t *handle, struct inode *inode,
2022 struct buffer_head *this_bh, 2021 struct buffer_head *this_bh,
2023 __le32 *first, __le32 *last) 2022 __le32 *first, __le32 *last)
2024{ 2023{
2025 unsigned long block_to_free = 0; /* Starting block # of a run */ 2024 ext3_fsblk_t block_to_free = 0; /* Starting block # of a run */
2026 unsigned long count = 0; /* Number of blocks in the run */ 2025 unsigned long count = 0; /* Number of blocks in the run */
2027 __le32 *block_to_free_p = NULL; /* Pointer into inode/ind 2026 __le32 *block_to_free_p = NULL; /* Pointer into inode/ind
2028 corresponding to 2027 corresponding to
2029 block_to_free */ 2028 block_to_free */
2030 unsigned long nr; /* Current block # */ 2029 ext3_fsblk_t nr; /* Current block # */
2031 __le32 *p; /* Pointer into inode/ind 2030 __le32 *p; /* Pointer into inode/ind
2032 for current block */ 2031 for current block */
2033 int err; 2032 int err;
@@ -2089,7 +2088,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2089 struct buffer_head *parent_bh, 2088 struct buffer_head *parent_bh,
2090 __le32 *first, __le32 *last, int depth) 2089 __le32 *first, __le32 *last, int depth)
2091{ 2090{
2092 unsigned long nr; 2091 ext3_fsblk_t nr;
2093 __le32 *p; 2092 __le32 *p;
2094 2093
2095 if (is_handle_aborted(handle)) 2094 if (is_handle_aborted(handle))
@@ -2113,7 +2112,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2113 */ 2112 */
2114 if (!bh) { 2113 if (!bh) {
2115 ext3_error(inode->i_sb, "ext3_free_branches", 2114 ext3_error(inode->i_sb, "ext3_free_branches",
2116 "Read failure, inode=%ld, block=%ld", 2115 "Read failure, inode=%ld, block="E3FSBLK,
2117 inode->i_ino, nr); 2116 inode->i_ino, nr);
2118 continue; 2117 continue;
2119 } 2118 }
@@ -2394,11 +2393,12 @@ out_stop:
2394 ext3_journal_stop(handle); 2393 ext3_journal_stop(handle);
2395} 2394}
2396 2395
2397static unsigned long ext3_get_inode_block(struct super_block *sb, 2396static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2398 unsigned long ino, struct ext3_iloc *iloc) 2397 unsigned long ino, struct ext3_iloc *iloc)
2399{ 2398{
2400 unsigned long desc, group_desc, block_group; 2399 unsigned long desc, group_desc, block_group;
2401 unsigned long offset, block; 2400 unsigned long offset;
2401 ext3_fsblk_t block;
2402 struct buffer_head *bh; 2402 struct buffer_head *bh;
2403 struct ext3_group_desc * gdp; 2403 struct ext3_group_desc * gdp;
2404 2404
@@ -2448,7 +2448,7 @@ static unsigned long ext3_get_inode_block(struct super_block *sb,
2448static int __ext3_get_inode_loc(struct inode *inode, 2448static int __ext3_get_inode_loc(struct inode *inode,
2449 struct ext3_iloc *iloc, int in_mem) 2449 struct ext3_iloc *iloc, int in_mem)
2450{ 2450{
2451 unsigned long block; 2451 ext3_fsblk_t block;
2452 struct buffer_head *bh; 2452 struct buffer_head *bh;
2453 2453
2454 block = ext3_get_inode_block(inode->i_sb, inode->i_ino, iloc); 2454 block = ext3_get_inode_block(inode->i_sb, inode->i_ino, iloc);
@@ -2459,7 +2459,8 @@ static int __ext3_get_inode_loc(struct inode *inode,
2459 if (!bh) { 2459 if (!bh) {
2460 ext3_error (inode->i_sb, "ext3_get_inode_loc", 2460 ext3_error (inode->i_sb, "ext3_get_inode_loc",
2461 "unable to read inode block - " 2461 "unable to read inode block - "
2462 "inode=%lu, block=%lu", inode->i_ino, block); 2462 "inode=%lu, block="E3FSBLK,
2463 inode->i_ino, block);
2463 return -EIO; 2464 return -EIO;
2464 } 2465 }
2465 if (!buffer_uptodate(bh)) { 2466 if (!buffer_uptodate(bh)) {
@@ -2540,7 +2541,7 @@ make_io:
2540 if (!buffer_uptodate(bh)) { 2541 if (!buffer_uptodate(bh)) {
2541 ext3_error(inode->i_sb, "ext3_get_inode_loc", 2542 ext3_error(inode->i_sb, "ext3_get_inode_loc",
2542 "unable to read inode block - " 2543 "unable to read inode block - "
2543 "inode=%lu, block=%lu", 2544 "inode=%lu, block="E3FSBLK,
2544 inode->i_ino, block); 2545 inode->i_ino, block);
2545 brelse(bh); 2546 brelse(bh);
2546 return -EIO; 2547 return -EIO;
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
index 8c22aa9a7fb..3a6b012d120 100644
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -204,7 +204,7 @@ flags_err:
204 return 0; 204 return 0;
205 } 205 }
206 case EXT3_IOC_GROUP_EXTEND: { 206 case EXT3_IOC_GROUP_EXTEND: {
207 unsigned long n_blocks_count; 207 ext3_fsblk_t n_blocks_count;
208 struct super_block *sb = inode->i_sb; 208 struct super_block *sb = inode->i_sb;
209 int err; 209 int err;
210 210
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 82c678e9268..dfd811895d8 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -116,7 +116,7 @@ static int verify_group_input(struct super_block *sb,
116} 116}
117 117
118static struct buffer_head *bclean(handle_t *handle, struct super_block *sb, 118static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
119 unsigned long blk) 119 ext3_fsblk_t blk)
120{ 120{
121 struct buffer_head *bh; 121 struct buffer_head *bh;
122 int err; 122 int err;
@@ -167,14 +167,13 @@ static int setup_new_group_blocks(struct super_block *sb,
167 struct ext3_new_group_data *input) 167 struct ext3_new_group_data *input)
168{ 168{
169 struct ext3_sb_info *sbi = EXT3_SB(sb); 169 struct ext3_sb_info *sbi = EXT3_SB(sb);
170 unsigned long start = input->group * sbi->s_blocks_per_group + 170 ext3_fsblk_t start = ext3_group_first_block_no(sb, input->group);
171 le32_to_cpu(sbi->s_es->s_first_data_block);
172 int reserved_gdb = ext3_bg_has_super(sb, input->group) ? 171 int reserved_gdb = ext3_bg_has_super(sb, input->group) ?
173 le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0; 172 le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0;
174 unsigned long gdblocks = ext3_bg_num_gdb(sb, input->group); 173 unsigned long gdblocks = ext3_bg_num_gdb(sb, input->group);
175 struct buffer_head *bh; 174 struct buffer_head *bh;
176 handle_t *handle; 175 handle_t *handle;
177 unsigned long block; 176 ext3_fsblk_t block;
178 ext3_grpblk_t bit; 177 ext3_grpblk_t bit;
179 int i; 178 int i;
180 int err = 0, err2; 179 int err = 0, err2;
@@ -332,7 +331,7 @@ static unsigned ext3_list_backups(struct super_block *sb, unsigned *three,
332static int verify_reserved_gdb(struct super_block *sb, 331static int verify_reserved_gdb(struct super_block *sb,
333 struct buffer_head *primary) 332 struct buffer_head *primary)
334{ 333{
335 const unsigned long blk = primary->b_blocknr; 334 const ext3_fsblk_t blk = primary->b_blocknr;
336 const unsigned long end = EXT3_SB(sb)->s_groups_count; 335 const unsigned long end = EXT3_SB(sb)->s_groups_count;
337 unsigned three = 1; 336 unsigned three = 1;
338 unsigned five = 5; 337 unsigned five = 5;
@@ -344,7 +343,8 @@ static int verify_reserved_gdb(struct super_block *sb,
344 while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) { 343 while ((grp = ext3_list_backups(sb, &three, &five, &seven)) < end) {
345 if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){ 344 if (le32_to_cpu(*p++) != grp * EXT3_BLOCKS_PER_GROUP(sb) + blk){
346 ext3_warning(sb, __FUNCTION__, 345 ext3_warning(sb, __FUNCTION__,
347 "reserved GDT %lu missing grp %d (%lu)", 346 "reserved GDT "E3FSBLK
347 " missing grp %d ("E3FSBLK")",
348 blk, grp, 348 blk, grp,
349 grp * EXT3_BLOCKS_PER_GROUP(sb) + blk); 349 grp * EXT3_BLOCKS_PER_GROUP(sb) + blk);
350 return -EINVAL; 350 return -EINVAL;
@@ -376,7 +376,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
376 struct super_block *sb = inode->i_sb; 376 struct super_block *sb = inode->i_sb;
377 struct ext3_super_block *es = EXT3_SB(sb)->s_es; 377 struct ext3_super_block *es = EXT3_SB(sb)->s_es;
378 unsigned long gdb_num = input->group / EXT3_DESC_PER_BLOCK(sb); 378 unsigned long gdb_num = input->group / EXT3_DESC_PER_BLOCK(sb);
379 unsigned long gdblock = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num; 379 ext3_fsblk_t gdblock = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num;
380 struct buffer_head **o_group_desc, **n_group_desc; 380 struct buffer_head **o_group_desc, **n_group_desc;
381 struct buffer_head *dind; 381 struct buffer_head *dind;
382 int gdbackups; 382 int gdbackups;
@@ -421,7 +421,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
421 data = (__u32 *)dind->b_data; 421 data = (__u32 *)dind->b_data;
422 if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) { 422 if (le32_to_cpu(data[gdb_num % EXT3_ADDR_PER_BLOCK(sb)]) != gdblock) {
423 ext3_warning(sb, __FUNCTION__, 423 ext3_warning(sb, __FUNCTION__,
424 "new group %u GDT block %lu not reserved", 424 "new group %u GDT block "E3FSBLK" not reserved",
425 input->group, gdblock); 425 input->group, gdblock);
426 err = -EINVAL; 426 err = -EINVAL;
427 goto exit_dind; 427 goto exit_dind;
@@ -519,7 +519,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
519 struct buffer_head **primary; 519 struct buffer_head **primary;
520 struct buffer_head *dind; 520 struct buffer_head *dind;
521 struct ext3_iloc iloc; 521 struct ext3_iloc iloc;
522 unsigned long blk; 522 ext3_fsblk_t blk;
523 __u32 *data, *end; 523 __u32 *data, *end;
524 int gdbackups = 0; 524 int gdbackups = 0;
525 int res, i; 525 int res, i;
@@ -544,7 +544,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
544 for (res = 0; res < reserved_gdb; res++, blk++) { 544 for (res = 0; res < reserved_gdb; res++, blk++) {
545 if (le32_to_cpu(*data) != blk) { 545 if (le32_to_cpu(*data) != blk) {
546 ext3_warning(sb, __FUNCTION__, 546 ext3_warning(sb, __FUNCTION__,
547 "reserved block %lu not at offset %ld", 547 "reserved block "E3FSBLK
548 " not at offset %ld",
548 blk, (long)(data - (__u32 *)dind->b_data)); 549 blk, (long)(data - (__u32 *)dind->b_data));
549 err = -EINVAL; 550 err = -EINVAL;
550 goto exit_bh; 551 goto exit_bh;
@@ -906,9 +907,9 @@ exit_put:
906 * GDT blocks are reserved to grow to the desired size. 907 * GDT blocks are reserved to grow to the desired size.
907 */ 908 */
908int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es, 909int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
909 unsigned long n_blocks_count) 910 ext3_fsblk_t n_blocks_count)
910{ 911{
911 unsigned long o_blocks_count; 912 ext3_fsblk_t o_blocks_count;
912 unsigned long o_groups_count; 913 unsigned long o_groups_count;
913 ext3_grpblk_t last; 914 ext3_grpblk_t last;
914 ext3_grpblk_t add; 915 ext3_grpblk_t add;
@@ -924,7 +925,7 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
924 o_groups_count = EXT3_SB(sb)->s_groups_count; 925 o_groups_count = EXT3_SB(sb)->s_groups_count;
925 926
926 if (test_opt(sb, DEBUG)) 927 if (test_opt(sb, DEBUG))
927 printk(KERN_DEBUG "EXT3-fs: extending last group from %lu to %lu blocks\n", 928 printk(KERN_DEBUG "EXT3-fs: extending last group from "E3FSBLK" uto "E3FSBLK" blocks\n",
928 o_blocks_count, n_blocks_count); 929 o_blocks_count, n_blocks_count);
929 930
930 if (n_blocks_count == 0 || n_blocks_count == o_blocks_count) 931 if (n_blocks_count == 0 || n_blocks_count == o_blocks_count)
@@ -963,7 +964,8 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
963 964
964 if (o_blocks_count + add < n_blocks_count) 965 if (o_blocks_count + add < n_blocks_count)
965 ext3_warning(sb, __FUNCTION__, 966 ext3_warning(sb, __FUNCTION__,
966 "will only finish group (%lu blocks, %u new)", 967 "will only finish group ("E3FSBLK
968 " blocks, %u new)",
967 o_blocks_count + add, add); 969 o_blocks_count + add, add);
968 970
969 /* See if the device is actually as big as what was requested */ 971 /* See if the device is actually as big as what was requested */
@@ -1006,10 +1008,10 @@ int ext3_group_extend(struct super_block *sb, struct ext3_super_block *es,
1006 ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); 1008 ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
1007 sb->s_dirt = 1; 1009 sb->s_dirt = 1;
1008 unlock_super(sb); 1010 unlock_super(sb);
1009 ext3_debug("freeing blocks %lu through %lu\n", o_blocks_count, 1011 ext3_debug("freeing blocks %lu through "E3FSBLK"\n", o_blocks_count,
1010 o_blocks_count + add); 1012 o_blocks_count + add);
1011 ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks); 1013 ext3_free_blocks_sb(handle, sb, o_blocks_count, add, &freed_blocks);
1012 ext3_debug("freed blocks %lu through %lu\n", o_blocks_count, 1014 ext3_debug("freed blocks "E3FSBLK" through "E3FSBLK"\n", o_blocks_count,
1013 o_blocks_count + add); 1015 o_blocks_count + add);
1014 if ((err = ext3_journal_stop(handle))) 1016 if ((err = ext3_journal_stop(handle)))
1015 goto exit_put; 1017 goto exit_put;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 94113500fc5..b2891cc29db 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -689,14 +689,15 @@ static match_table_t tokens = {
689 {Opt_resize, "resize"}, 689 {Opt_resize, "resize"},
690}; 690};
691 691
692static unsigned long get_sb_block(void **data) 692static ext3_fsblk_t get_sb_block(void **data)
693{ 693{
694 unsigned long sb_block; 694 ext3_fsblk_t sb_block;
695 char *options = (char *) *data; 695 char *options = (char *) *data;
696 696
697 if (!options || strncmp(options, "sb=", 3) != 0) 697 if (!options || strncmp(options, "sb=", 3) != 0)
698 return 1; /* Default location */ 698 return 1; /* Default location */
699 options += 3; 699 options += 3;
700 /*todo: use simple_strtoll with >32bit ext3 */
700 sb_block = simple_strtoul(options, &options, 0); 701 sb_block = simple_strtoul(options, &options, 0);
701 if (*options && *options != ',') { 702 if (*options && *options != ',') {
702 printk("EXT3-fs: Invalid sb specification: %s\n", 703 printk("EXT3-fs: Invalid sb specification: %s\n",
@@ -711,7 +712,7 @@ static unsigned long get_sb_block(void **data)
711 712
712static int parse_options (char *options, struct super_block *sb, 713static int parse_options (char *options, struct super_block *sb,
713 unsigned long *inum, unsigned long *journal_devnum, 714 unsigned long *inum, unsigned long *journal_devnum,
714 unsigned long *n_blocks_count, int is_remount) 715 ext3_fsblk_t *n_blocks_count, int is_remount)
715{ 716{
716 struct ext3_sb_info *sbi = EXT3_SB(sb); 717 struct ext3_sb_info *sbi = EXT3_SB(sb);
717 char * p; 718 char * p;
@@ -1128,7 +1129,7 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
1128static int ext3_check_descriptors (struct super_block * sb) 1129static int ext3_check_descriptors (struct super_block * sb)
1129{ 1130{
1130 struct ext3_sb_info *sbi = EXT3_SB(sb); 1131 struct ext3_sb_info *sbi = EXT3_SB(sb);
1131 unsigned long block = le32_to_cpu(sbi->s_es->s_first_data_block); 1132 ext3_fsblk_t block = le32_to_cpu(sbi->s_es->s_first_data_block);
1132 struct ext3_group_desc * gdp = NULL; 1133 struct ext3_group_desc * gdp = NULL;
1133 int desc_block = 0; 1134 int desc_block = 0;
1134 int i; 1135 int i;
@@ -1315,15 +1316,14 @@ static loff_t ext3_max_size(int bits)
1315 return res; 1316 return res;
1316} 1317}
1317 1318
1318static unsigned long descriptor_loc(struct super_block *sb, 1319static ext3_fsblk_t descriptor_loc(struct super_block *sb,
1319 unsigned long logic_sb_block, 1320 ext3_fsblk_t logic_sb_block,
1320 int nr) 1321 int nr)
1321{ 1322{
1322 struct ext3_sb_info *sbi = EXT3_SB(sb); 1323 struct ext3_sb_info *sbi = EXT3_SB(sb);
1323 unsigned long bg, first_data_block, first_meta_bg; 1324 unsigned long bg, first_meta_bg;
1324 int has_super = 0; 1325 int has_super = 0;
1325 1326
1326 first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block);
1327 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); 1327 first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg);
1328 1328
1329 if (!EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_META_BG) || 1329 if (!EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_META_BG) ||
@@ -1332,7 +1332,7 @@ static unsigned long descriptor_loc(struct super_block *sb,
1332 bg = sbi->s_desc_per_block * nr; 1332 bg = sbi->s_desc_per_block * nr;
1333 if (ext3_bg_has_super(sb, bg)) 1333 if (ext3_bg_has_super(sb, bg))
1334 has_super = 1; 1334 has_super = 1;
1335 return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); 1335 return (has_super + ext3_group_first_block_no(sb, bg));
1336} 1336}
1337 1337
1338 1338
@@ -1341,9 +1341,9 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1341 struct buffer_head * bh; 1341 struct buffer_head * bh;
1342 struct ext3_super_block *es = NULL; 1342 struct ext3_super_block *es = NULL;
1343 struct ext3_sb_info *sbi; 1343 struct ext3_sb_info *sbi;
1344 unsigned long block; 1344 ext3_fsblk_t block;
1345 unsigned long sb_block = get_sb_block(&data); 1345 ext3_fsblk_t sb_block = get_sb_block(&data);
1346 unsigned long logic_sb_block; 1346 ext3_fsblk_t logic_sb_block;
1347 unsigned long offset = 0; 1347 unsigned long offset = 0;
1348 unsigned long journal_inum = 0; 1348 unsigned long journal_inum = 0;
1349 unsigned long journal_devnum = 0; 1349 unsigned long journal_devnum = 0;
@@ -1840,10 +1840,10 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
1840{ 1840{
1841 struct buffer_head * bh; 1841 struct buffer_head * bh;
1842 journal_t *journal; 1842 journal_t *journal;
1843 int start; 1843 ext3_fsblk_t start;
1844 ext3_fsblk_t len; 1844 ext3_fsblk_t len;
1845 int hblock, blocksize; 1845 int hblock, blocksize;
1846 unsigned long sb_block; 1846 ext3_fsblk_t sb_block;
1847 unsigned long offset; 1847 unsigned long offset;
1848 struct ext3_super_block * es; 1848 struct ext3_super_block * es;
1849 struct block_device *bdev; 1849 struct block_device *bdev;
@@ -2216,7 +2216,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2216{ 2216{
2217 struct ext3_super_block * es; 2217 struct ext3_super_block * es;
2218 struct ext3_sb_info *sbi = EXT3_SB(sb); 2218 struct ext3_sb_info *sbi = EXT3_SB(sb);
2219 unsigned long n_blocks_count = 0; 2219 ext3_fsblk_t n_blocks_count = 0;
2220 unsigned long old_sb_flags; 2220 unsigned long old_sb_flags;
2221 struct ext3_mount_options old_opts; 2221 struct ext3_mount_options old_opts;
2222 int err; 2222 int err;
@@ -2336,7 +2336,7 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
2336 struct super_block *sb = dentry->d_sb; 2336 struct super_block *sb = dentry->d_sb;
2337 struct ext3_sb_info *sbi = EXT3_SB(sb); 2337 struct ext3_sb_info *sbi = EXT3_SB(sb);
2338 struct ext3_super_block *es = sbi->s_es; 2338 struct ext3_super_block *es = sbi->s_es;
2339 unsigned long overhead; 2339 ext3_fsblk_t overhead;
2340 int i; 2340 int i;
2341 2341
2342 if (test_opt (sb, MINIX_DF)) 2342 if (test_opt (sb, MINIX_DF))
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 1ba515de5a7..a44a0562203 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -233,7 +233,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
233 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); 233 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
234 if (ext3_xattr_check_block(bh)) { 234 if (ext3_xattr_check_block(bh)) {
235bad_block: ext3_error(inode->i_sb, __FUNCTION__, 235bad_block: ext3_error(inode->i_sb, __FUNCTION__,
236 "inode %ld: bad block %u", inode->i_ino, 236 "inode %ld: bad block "E3FSBLK, inode->i_ino,
237 EXT3_I(inode)->i_file_acl); 237 EXT3_I(inode)->i_file_acl);
238 error = -EIO; 238 error = -EIO;
239 goto cleanup; 239 goto cleanup;
@@ -375,7 +375,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
375 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); 375 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
376 if (ext3_xattr_check_block(bh)) { 376 if (ext3_xattr_check_block(bh)) {
377 ext3_error(inode->i_sb, __FUNCTION__, 377 ext3_error(inode->i_sb, __FUNCTION__,
378 "inode %ld: bad block %u", inode->i_ino, 378 "inode %ld: bad block "E3FSBLK, inode->i_ino,
379 EXT3_I(inode)->i_file_acl); 379 EXT3_I(inode)->i_file_acl);
380 error = -EIO; 380 error = -EIO;
381 goto cleanup; 381 goto cleanup;
@@ -647,7 +647,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i,
647 le32_to_cpu(BHDR(bs->bh)->h_refcount)); 647 le32_to_cpu(BHDR(bs->bh)->h_refcount));
648 if (ext3_xattr_check_block(bs->bh)) { 648 if (ext3_xattr_check_block(bs->bh)) {
649 ext3_error(sb, __FUNCTION__, 649 ext3_error(sb, __FUNCTION__,
650 "inode %ld: bad block %u", inode->i_ino, 650 "inode %ld: bad block "E3FSBLK, inode->i_ino,
651 EXT3_I(inode)->i_file_acl); 651 EXT3_I(inode)->i_file_acl);
652 error = -EIO; 652 error = -EIO;
653 goto cleanup; 653 goto cleanup;
@@ -848,7 +848,7 @@ cleanup_dquot:
848 848
849bad_block: 849bad_block:
850 ext3_error(inode->i_sb, __FUNCTION__, 850 ext3_error(inode->i_sb, __FUNCTION__,
851 "inode %ld: bad block %u", inode->i_ino, 851 "inode %ld: bad block "E3FSBLK, inode->i_ino,
852 EXT3_I(inode)->i_file_acl); 852 EXT3_I(inode)->i_file_acl);
853 goto cleanup; 853 goto cleanup;
854 854
@@ -1077,14 +1077,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
1077 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); 1077 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
1078 if (!bh) { 1078 if (!bh) {
1079 ext3_error(inode->i_sb, __FUNCTION__, 1079 ext3_error(inode->i_sb, __FUNCTION__,
1080 "inode %ld: block %u read error", inode->i_ino, 1080 "inode %ld: block "E3FSBLK" read error", inode->i_ino,
1081 EXT3_I(inode)->i_file_acl); 1081 EXT3_I(inode)->i_file_acl);
1082 goto cleanup; 1082 goto cleanup;
1083 } 1083 }
1084 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || 1084 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
1085 BHDR(bh)->h_blocks != cpu_to_le32(1)) { 1085 BHDR(bh)->h_blocks != cpu_to_le32(1)) {
1086 ext3_error(inode->i_sb, __FUNCTION__, 1086 ext3_error(inode->i_sb, __FUNCTION__,
1087 "inode %ld: bad block %u", inode->i_ino, 1087 "inode %ld: bad block "E3FSBLK, inode->i_ino,
1088 EXT3_I(inode)->i_file_acl); 1088 EXT3_I(inode)->i_file_acl);
1089 goto cleanup; 1089 goto cleanup;
1090 } 1090 }
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 34136ff02ac..5607e6457a6 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -710,6 +710,14 @@ struct dir_private_info {
710 __u32 next_hash; 710 __u32 next_hash;
711}; 711};
712 712
713/* calculate the first block number of the group */
714static inline ext3_fsblk_t
715ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
716{
717 return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
718 le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
719}
720
713/* 721/*
714 * Special error return code only used by dx_probe() and its callers. 722 * Special error return code only used by dx_probe() and its callers.
715 */ 723 */
@@ -739,7 +747,7 @@ extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
739extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb, 747extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
740 ext3_fsblk_t block, unsigned long count, 748 ext3_fsblk_t block, unsigned long count,
741 unsigned long *pdquot_freed_blocks); 749 unsigned long *pdquot_freed_blocks);
742extern unsigned long ext3_count_free_blocks (struct super_block *); 750extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
743extern void ext3_check_blocks_bitmap (struct super_block *); 751extern void ext3_check_blocks_bitmap (struct super_block *);
744extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb, 752extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
745 unsigned int block_group, 753 unsigned int block_group,
@@ -811,7 +819,7 @@ extern int ext3_group_add(struct super_block *sb,
811 struct ext3_new_group_data *input); 819 struct ext3_new_group_data *input);
812extern int ext3_group_extend(struct super_block *sb, 820extern int ext3_group_extend(struct super_block *sb,
813 struct ext3_super_block *es, 821 struct ext3_super_block *es,
814 unsigned long n_blocks_count); 822 ext3_fsblk_t n_blocks_count);
815 823
816/* super.c */ 824/* super.c */
817extern void ext3_error (struct super_block *, const char *, const char *, ...) 825extern void ext3_error (struct super_block *, const char *, const char *, ...)
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h
index e1c7509c0c9..2f18b9511f2 100644
--- a/include/linux/ext3_fs_i.h
+++ b/include/linux/ext3_fs_i.h
@@ -30,8 +30,8 @@ typedef unsigned long ext3_fsblk_t;
30#define E3FSBLK "%lu" 30#define E3FSBLK "%lu"
31 31
32struct ext3_reserve_window { 32struct ext3_reserve_window {
33 __u32 _rsv_start; /* First byte reserved */ 33 ext3_fsblk_t _rsv_start; /* First byte reserved */
34 __u32 _rsv_end; /* Last byte reserved or 0 */ 34 ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */
35}; 35};
36 36
37struct ext3_reserve_window_node { 37struct ext3_reserve_window_node {
@@ -58,7 +58,7 @@ struct ext3_block_alloc_info {
58 * allocated to this file. This give us the goal (target) for the next 58 * allocated to this file. This give us the goal (target) for the next
59 * allocation when we detect linearly ascending requests. 59 * allocation when we detect linearly ascending requests.
60 */ 60 */
61 __u32 last_alloc_physical_block; 61 ext3_fsblk_t last_alloc_physical_block;
62}; 62};
63 63
64#define rsv_start rsv_window._rsv_start 64#define rsv_start rsv_window._rsv_start
@@ -75,7 +75,7 @@ struct ext3_inode_info {
75 __u8 i_frag_no; 75 __u8 i_frag_no;
76 __u8 i_frag_size; 76 __u8 i_frag_size;
77#endif 77#endif
78 __u32 i_file_acl; 78 ext3_fsblk_t i_file_acl;
79 __u32 i_dir_acl; 79 __u32 i_dir_acl;
80 __u32 i_dtime; 80 __u32 i_dtime;
81 81