aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <esandeen@redhat.com>2006-09-27 04:49:30 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:09 -0400
commit41f04d852e359582518f950d12b2287766613022 (patch)
tree3c4431dda993a930acd64b45e8df14564c61920f /fs
parent855565e81ad8940cc645b5110ec2c7f124a76d23 (diff)
[PATCH] ext2: fix mounts at 16T
Signed-off-by: Eric Sandeen <esandeen@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/super.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 4286ff6330b6..d978d3febb8c 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -544,17 +544,24 @@ static int ext2_check_descriptors (struct super_block * sb)
544 int i; 544 int i;
545 int desc_block = 0; 545 int desc_block = 0;
546 struct ext2_sb_info *sbi = EXT2_SB(sb); 546 struct ext2_sb_info *sbi = EXT2_SB(sb);
547 unsigned long block = le32_to_cpu(sbi->s_es->s_first_data_block); 547 unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block);
548 unsigned long last_block;
548 struct ext2_group_desc * gdp = NULL; 549 struct ext2_group_desc * gdp = NULL;
549 550
550 ext2_debug ("Checking group descriptors"); 551 ext2_debug ("Checking group descriptors");
551 552
552 for (i = 0; i < sbi->s_groups_count; i++) 553 for (i = 0; i < sbi->s_groups_count; i++)
553 { 554 {
555 if (i == sbi->s_groups_count - 1)
556 last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1;
557 else
558 last_block = first_block +
559 (EXT2_BLOCKS_PER_GROUP(sb) - 1);
560
554 if ((i % EXT2_DESC_PER_BLOCK(sb)) == 0) 561 if ((i % EXT2_DESC_PER_BLOCK(sb)) == 0)
555 gdp = (struct ext2_group_desc *) sbi->s_group_desc[desc_block++]->b_data; 562 gdp = (struct ext2_group_desc *) sbi->s_group_desc[desc_block++]->b_data;
556 if (le32_to_cpu(gdp->bg_block_bitmap) < block || 563 if (le32_to_cpu(gdp->bg_block_bitmap) < first_block ||
557 le32_to_cpu(gdp->bg_block_bitmap) >= block + EXT2_BLOCKS_PER_GROUP(sb)) 564 le32_to_cpu(gdp->bg_block_bitmap) > last_block)
558 { 565 {
559 ext2_error (sb, "ext2_check_descriptors", 566 ext2_error (sb, "ext2_check_descriptors",
560 "Block bitmap for group %d" 567 "Block bitmap for group %d"
@@ -562,8 +569,8 @@ static int ext2_check_descriptors (struct super_block * sb)
562 i, (unsigned long) le32_to_cpu(gdp->bg_block_bitmap)); 569 i, (unsigned long) le32_to_cpu(gdp->bg_block_bitmap));
563 return 0; 570 return 0;
564 } 571 }
565 if (le32_to_cpu(gdp->bg_inode_bitmap) < block || 572 if (le32_to_cpu(gdp->bg_inode_bitmap) < first_block ||
566 le32_to_cpu(gdp->bg_inode_bitmap) >= block + EXT2_BLOCKS_PER_GROUP(sb)) 573 le32_to_cpu(gdp->bg_inode_bitmap) > last_block)
567 { 574 {
568 ext2_error (sb, "ext2_check_descriptors", 575 ext2_error (sb, "ext2_check_descriptors",
569 "Inode bitmap for group %d" 576 "Inode bitmap for group %d"
@@ -571,9 +578,9 @@ static int ext2_check_descriptors (struct super_block * sb)
571 i, (unsigned long) le32_to_cpu(gdp->bg_inode_bitmap)); 578 i, (unsigned long) le32_to_cpu(gdp->bg_inode_bitmap));
572 return 0; 579 return 0;
573 } 580 }
574 if (le32_to_cpu(gdp->bg_inode_table) < block || 581 if (le32_to_cpu(gdp->bg_inode_table) < first_block ||
575 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group >= 582 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group >
576 block + EXT2_BLOCKS_PER_GROUP(sb)) 583 last_block)
577 { 584 {
578 ext2_error (sb, "ext2_check_descriptors", 585 ext2_error (sb, "ext2_check_descriptors",
579 "Inode table for group %d" 586 "Inode table for group %d"
@@ -581,7 +588,7 @@ static int ext2_check_descriptors (struct super_block * sb)
581 i, (unsigned long) le32_to_cpu(gdp->bg_inode_table)); 588 i, (unsigned long) le32_to_cpu(gdp->bg_inode_table));
582 return 0; 589 return 0;
583 } 590 }
584 block += EXT2_BLOCKS_PER_GROUP(sb); 591 first_block += EXT2_BLOCKS_PER_GROUP(sb);
585 gdp++; 592 gdp++;
586 } 593 }
587 return 1; 594 return 1;
@@ -861,10 +868,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
861 868
862 if (EXT2_BLOCKS_PER_GROUP(sb) == 0) 869 if (EXT2_BLOCKS_PER_GROUP(sb) == 0)
863 goto cantfind_ext2; 870 goto cantfind_ext2;
864 sbi->s_groups_count = (le32_to_cpu(es->s_blocks_count) - 871 sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) -
865 le32_to_cpu(es->s_first_data_block) + 872 le32_to_cpu(es->s_first_data_block) - 1)
866 EXT2_BLOCKS_PER_GROUP(sb) - 1) / 873 / EXT2_BLOCKS_PER_GROUP(sb)) + 1;
867 EXT2_BLOCKS_PER_GROUP(sb);
868 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / 874 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) /
869 EXT2_DESC_PER_BLOCK(sb); 875 EXT2_DESC_PER_BLOCK(sb);
870 sbi->s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL); 876 sbi->s_group_desc = kmalloc (db_count * sizeof (struct buffer_head *), GFP_KERNEL);