Commit 43d23f9039fc810ecd621f1e4f9d578eadce058a

Authored by Mingming Cao
Committed by Linus Torvalds
1 parent 1c2bf374a4

[PATCH] ext3_fsblk_t: the rest of in-kernel filesystem blocks conversion

Convert the ext3 in-kernel filesystem blocks to ext3_fsblk_t.  Convert the
rest of all unsigned long type in-kernel filesystem blocks to ext3_fsblk_t,
and replace the printk format string respondingly.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 8 changed files with 96 additions and 88 deletions Side-by-side Diff

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