diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-02-06 16:23:37 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-02-06 16:23:37 -0500 |
commit | e187c6588d6ef3169db53c389b3de9dfde3b16cc (patch) | |
tree | 5ac50e38eecb58d8de571af0053331c31eb0a5e2 /fs/ext4/balloc.c | |
parent | 074ca44283bf031678e67af7d82668bb03c55a55 (diff) |
ext4: remove call to ext4_group_desc() in ext4_group_used_meta_blocks()
The static function ext4_group_used_meta_blocks() only has one caller,
who already has access to the block group's group descriptor. So it's
better to have ext4_init_block_bitmap() pass the group descriptor to
ext4_group_used_meta_blocks(), so it doesn't need to call
ext4_group_desc(). Previously this function did not check if
ext4_group_desc() returned NULL due to an error, potentially causing a
kernel OOPS report. This avoids the issue entirely.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 38f40d55899c..b37b12875582 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -55,7 +55,8 @@ static int ext4_block_in_group(struct super_block *sb, ext4_fsblk_t block, | |||
55 | } | 55 | } |
56 | 56 | ||
57 | static int ext4_group_used_meta_blocks(struct super_block *sb, | 57 | static int ext4_group_used_meta_blocks(struct super_block *sb, |
58 | ext4_group_t block_group) | 58 | ext4_group_t block_group, |
59 | struct ext4_group_desc *gdp) | ||
59 | { | 60 | { |
60 | ext4_fsblk_t tmp; | 61 | ext4_fsblk_t tmp; |
61 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 62 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
@@ -63,10 +64,6 @@ static int ext4_group_used_meta_blocks(struct super_block *sb, | |||
63 | int used_blocks = sbi->s_itb_per_group + 2; | 64 | int used_blocks = sbi->s_itb_per_group + 2; |
64 | 65 | ||
65 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) { | 66 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) { |
66 | struct ext4_group_desc *gdp; | ||
67 | struct buffer_head *bh; | ||
68 | |||
69 | gdp = ext4_get_group_desc(sb, block_group, &bh); | ||
70 | if (!ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp), | 67 | if (!ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp), |
71 | block_group)) | 68 | block_group)) |
72 | used_blocks--; | 69 | used_blocks--; |
@@ -177,7 +174,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
177 | */ | 174 | */ |
178 | mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data); | 175 | mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data); |
179 | } | 176 | } |
180 | return free_blocks - ext4_group_used_meta_blocks(sb, block_group); | 177 | return free_blocks - ext4_group_used_meta_blocks(sb, block_group, gdp); |
181 | } | 178 | } |
182 | 179 | ||
183 | 180 | ||