diff options
-rw-r--r-- | fs/ext2/inode.c | 3 | ||||
-rw-r--r-- | fs/ext2/super.c | 11 | ||||
-rw-r--r-- | fs/ext2/xattr.c | 6 |
3 files changed, 8 insertions, 12 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 687023bdfd1e..be0d02ac7ac4 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -275,8 +275,7 @@ static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) | |||
275 | * It is going to be refered from inode itself? OK, just put it into | 275 | * It is going to be refered from inode itself? OK, just put it into |
276 | * the same cylinder group then. | 276 | * the same cylinder group then. |
277 | */ | 277 | */ |
278 | bg_start = (ei->i_block_group * EXT2_BLOCKS_PER_GROUP(inode->i_sb)) + | 278 | bg_start = ext2_group_first_block_no(inode->i_sb, ei->i_block_group); |
279 | le32_to_cpu(EXT2_SB(inode->i_sb)->s_es->s_first_data_block); | ||
280 | colour = (current->pid % 16) * | 279 | colour = (current->pid % 16) * |
281 | (EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16); | 280 | (EXT2_BLOCKS_PER_GROUP(inode->i_sb) / 16); |
282 | return bg_start + colour; | 281 | return bg_start + colour; |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 7e6867329220..3f745fb5fff3 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -621,13 +621,13 @@ static int ext2_check_descriptors(struct super_block *sb) | |||
621 | { | 621 | { |
622 | int i; | 622 | int i; |
623 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 623 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
624 | unsigned long first_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
625 | unsigned long last_block; | ||
626 | 624 | ||
627 | ext2_debug ("Checking group descriptors"); | 625 | ext2_debug ("Checking group descriptors"); |
628 | 626 | ||
629 | for (i = 0; i < sbi->s_groups_count; i++) { | 627 | for (i = 0; i < sbi->s_groups_count; i++) { |
630 | struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); | 628 | struct ext2_group_desc *gdp = ext2_get_group_desc(sb, i, NULL); |
629 | ext2_fsblk_t first_block = ext2_group_first_block_no(sb, i); | ||
630 | ext2_fsblk_t last_block; | ||
631 | 631 | ||
632 | if (i == sbi->s_groups_count - 1) | 632 | if (i == sbi->s_groups_count - 1) |
633 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; | 633 | last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1; |
@@ -663,7 +663,6 @@ static int ext2_check_descriptors(struct super_block *sb) | |||
663 | i, (unsigned long) le32_to_cpu(gdp->bg_inode_table)); | 663 | i, (unsigned long) le32_to_cpu(gdp->bg_inode_table)); |
664 | return 0; | 664 | return 0; |
665 | } | 665 | } |
666 | first_block += EXT2_BLOCKS_PER_GROUP(sb); | ||
667 | } | 666 | } |
668 | return 1; | 667 | return 1; |
669 | } | 668 | } |
@@ -720,10 +719,9 @@ static unsigned long descriptor_loc(struct super_block *sb, | |||
720 | int nr) | 719 | int nr) |
721 | { | 720 | { |
722 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 721 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
723 | unsigned long bg, first_data_block, first_meta_bg; | 722 | unsigned long bg, first_meta_bg; |
724 | int has_super = 0; | 723 | int has_super = 0; |
725 | 724 | ||
726 | first_data_block = le32_to_cpu(sbi->s_es->s_first_data_block); | ||
727 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); | 725 | first_meta_bg = le32_to_cpu(sbi->s_es->s_first_meta_bg); |
728 | 726 | ||
729 | if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_META_BG) || | 727 | if (!EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_META_BG) || |
@@ -732,7 +730,8 @@ static unsigned long descriptor_loc(struct super_block *sb, | |||
732 | bg = sbi->s_desc_per_block * nr; | 730 | bg = sbi->s_desc_per_block * nr; |
733 | if (ext2_bg_has_super(sb, bg)) | 731 | if (ext2_bg_has_super(sb, bg)) |
734 | has_super = 1; | 732 | has_super = 1; |
735 | return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); | 733 | |
734 | return ext2_group_first_block_no(sb, bg) + has_super; | ||
736 | } | 735 | } |
737 | 736 | ||
738 | static int ext2_fill_super(struct super_block *sb, void *data, int silent) | 737 | static int ext2_fill_super(struct super_block *sb, void *data, int silent) |
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index b86f02747eaf..987a5261cc2e 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
@@ -659,10 +659,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
659 | ext2_xattr_cache_insert(new_bh); | 659 | ext2_xattr_cache_insert(new_bh); |
660 | } else { | 660 | } else { |
661 | /* We need to allocate a new block */ | 661 | /* We need to allocate a new block */ |
662 | int goal = le32_to_cpu(EXT2_SB(sb)->s_es-> | 662 | ext2_fsblk_t goal = ext2_group_first_block_no(sb, |
663 | s_first_data_block) + | 663 | EXT2_I(inode)->i_block_group); |
664 | EXT2_I(inode)->i_block_group * | ||
665 | EXT2_BLOCKS_PER_GROUP(sb); | ||
666 | int block = ext2_new_block(inode, goal, &error); | 664 | int block = ext2_new_block(inode, goal, &error); |
667 | if (error) | 665 | if (error) |
668 | goto cleanup; | 666 | goto cleanup; |