Skip to content

Commit 1eaafea

Browse files
mitatorvalds
authored andcommitted
ext3: use ext3_group_first_block_no()
Use ext3_group_first_block_no() Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: <linux-ext4@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1563300 commit 1eaafea

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

‎fs/ext3/super.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,14 +1254,14 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
12541254
static int ext3_check_descriptors(struct super_block *sb)
12551255
{
12561256
struct ext3_sb_info *sbi = EXT3_SB(sb);
1257-
ext3_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block);
1258-
ext3_fsblk_t last_block;
12591257
int i;
12601258

12611259
ext3_debug ("Checking group descriptors");
12621260

12631261
for (i = 0; i < sbi->s_groups_count; i++) {
12641262
struct ext3_group_desc *gdp = ext3_get_group_desc(sb, i, NULL);
1263+
ext3_fsblk_t first_block = ext3_group_first_block_no(sb, i);
1264+
ext3_fsblk_t last_block;
12651265

12661266
if (i == sbi->s_groups_count - 1)
12671267
last_block = le32_to_cpu(sbi->s_es->s_blocks_count) - 1;
@@ -1300,7 +1300,6 @@ static int ext3_check_descriptors(struct super_block *sb)
13001300
le32_to_cpu(gdp->bg_inode_table));
13011301
return 0;
13021302
}
1303-
first_block += EXT3_BLOCKS_PER_GROUP(sb);
13041303
}
13051304

13061305
sbi->s_es->s_free_blocks_count=cpu_to_le32(ext3_count_free_blocks(sb));

‎fs/ext3/xattr.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,8 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
799799
get_bh(new_bh);
800800
} else {
801801
/* We need to allocate a new block */
802-
ext3_fsblk_t goal = le32_to_cpu(
803-
EXT3_SB(sb)->s_es->s_first_data_block) +
804-
(ext3_fsblk_t)EXT3_I(inode)->i_block_group *
805-
EXT3_BLOCKS_PER_GROUP(sb);
802+
ext3_fsblk_t goal = ext3_group_first_block_no(sb,
803+
EXT3_I(inode)->i_block_group);
806804
ext3_fsblk_t block = ext3_new_block(handle, inode,
807805
goal, &error);
808806
if (error)

0 commit comments

Comments
 (0)