Skip to content

Commit

Permalink
ext[234]: cleanup ext[234]_bg_num_gdb()
Browse files Browse the repository at this point in the history
Use ext[234]_bg_has_super() to remove duplicate code.

Signed-off-by: Akinobu Mita <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
mita authored and Linus Torvalds committed Feb 6, 2008
1 parent fb01bfd commit 859cb93
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
5 changes: 1 addition & 4 deletions fs/ext2/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,9 +1533,6 @@ int ext2_bg_has_super(struct super_block *sb, int group)
*/
unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
{
if (EXT2_HAS_RO_COMPAT_FEATURE(sb,EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)&&
!ext2_group_sparse(group))
return 0;
return EXT2_SB(sb)->s_gdb_count;
return ext2_bg_has_super(sb, group) ? EXT2_SB(sb)->s_gdb_count : 0;
}

6 changes: 1 addition & 5 deletions fs/ext3/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1848,11 +1848,7 @@ static unsigned long ext3_bg_num_gdb_meta(struct super_block *sb, int group)

static unsigned long ext3_bg_num_gdb_nometa(struct super_block *sb, int group)
{
if (EXT3_HAS_RO_COMPAT_FEATURE(sb,
EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER) &&
!ext3_group_sparse(group))
return 0;
return EXT3_SB(sb)->s_gdb_count;
return ext3_bg_has_super(sb, group) ? EXT3_SB(sb)->s_gdb_count : 0;
}

/**
Expand Down
6 changes: 1 addition & 5 deletions fs/ext4/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2011,11 +2011,7 @@ static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb,
static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
ext4_group_t group)
{
if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) &&
!ext4_group_sparse(group))
return 0;
return EXT4_SB(sb)->s_gdb_count;
return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)->s_gdb_count : 0;
}

/**
Expand Down

0 comments on commit 859cb93

Please sign in to comment.