diff options
author | Shen Feng <shen@cn.fujitsu.com> | 2008-07-13 21:03:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-07-13 21:03:31 -0400 |
commit | 7e5a8cdd843b7af8d6d38a9bf96306145edb66e0 (patch) | |
tree | 68c9dd5f35938520333f2c364a48c94f4e38566b /fs/ext4 | |
parent | cfbe7e4f5e4a0e1fc2ff23b167bfb3fa992f623d (diff) |
ext4: fix error processing in mb_free_blocks
The error processing of the return value of mb_free_blocks is meanless
because it only returns 0. This fix includes
- make mb_free_blocks return void
- remove the error processing part in callers
- unlock group before calling ext4_error in mb_free_blocks
Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
Cc: Mingming Cao <cmm@us.ibm.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/mballoc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 771a1d608528..b882868f4661 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1051,7 +1051,7 @@ static void mb_set_bits(spinlock_t *lock, void *bm, int cur, int len) | |||
1051 | } | 1051 | } |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | static int mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | 1054 | static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, |
1055 | int first, int count) | 1055 | int first, int count) |
1056 | { | 1056 | { |
1057 | int block = 0; | 1057 | int block = 0; |
@@ -1091,11 +1091,12 @@ static int mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
1091 | blocknr += block; | 1091 | blocknr += block; |
1092 | blocknr += | 1092 | blocknr += |
1093 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); | 1093 | le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); |
1094 | 1094 | ext4_unlock_group(sb, e4b->bd_group); | |
1095 | ext4_error(sb, __func__, "double-free of inode" | 1095 | ext4_error(sb, __func__, "double-free of inode" |
1096 | " %lu's block %llu(bit %u in group %lu)\n", | 1096 | " %lu's block %llu(bit %u in group %lu)\n", |
1097 | inode ? inode->i_ino : 0, blocknr, block, | 1097 | inode ? inode->i_ino : 0, blocknr, block, |
1098 | e4b->bd_group); | 1098 | e4b->bd_group); |
1099 | ext4_lock_group(sb, e4b->bd_group); | ||
1099 | } | 1100 | } |
1100 | mb_clear_bit(block, EXT4_MB_BITMAP(e4b)); | 1101 | mb_clear_bit(block, EXT4_MB_BITMAP(e4b)); |
1101 | e4b->bd_info->bb_counters[order]++; | 1102 | e4b->bd_info->bb_counters[order]++; |
@@ -1133,8 +1134,6 @@ static int mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, | |||
1133 | } while (1); | 1134 | } while (1); |
1134 | } | 1135 | } |
1135 | mb_check_buddy(e4b); | 1136 | mb_check_buddy(e4b); |
1136 | |||
1137 | return 0; | ||
1138 | } | 1137 | } |
1139 | 1138 | ||
1140 | static int mb_find_extent(struct ext4_buddy *e4b, int order, int block, | 1139 | static int mb_find_extent(struct ext4_buddy *e4b, int order, int block, |
@@ -2570,8 +2569,7 @@ ext4_mb_free_committed_blocks(struct super_block *sb) | |||
2570 | ext4_lock_group(sb, md->group); | 2569 | ext4_lock_group(sb, md->group); |
2571 | for (i = 0; i < md->num; i++) { | 2570 | for (i = 0; i < md->num; i++) { |
2572 | mb_debug(" %u", md->blocks[i]); | 2571 | mb_debug(" %u", md->blocks[i]); |
2573 | err = mb_free_blocks(NULL, &e4b, md->blocks[i], 1); | 2572 | mb_free_blocks(NULL, &e4b, md->blocks[i], 1); |
2574 | BUG_ON(err != 0); | ||
2575 | } | 2573 | } |
2576 | mb_debug("\n"); | 2574 | mb_debug("\n"); |
2577 | ext4_unlock_group(sb, md->group); | 2575 | ext4_unlock_group(sb, md->group); |
@@ -4333,10 +4331,9 @@ do_more: | |||
4333 | ext4_mb_free_metadata(handle, &e4b, block_group, bit, count); | 4331 | ext4_mb_free_metadata(handle, &e4b, block_group, bit, count); |
4334 | } else { | 4332 | } else { |
4335 | ext4_lock_group(sb, block_group); | 4333 | ext4_lock_group(sb, block_group); |
4336 | err = mb_free_blocks(inode, &e4b, bit, count); | 4334 | mb_free_blocks(inode, &e4b, bit, count); |
4337 | ext4_mb_return_to_preallocation(inode, &e4b, block, count); | 4335 | ext4_mb_return_to_preallocation(inode, &e4b, block, count); |
4338 | ext4_unlock_group(sb, block_group); | 4336 | ext4_unlock_group(sb, block_group); |
4339 | BUG_ON(err != 0); | ||
4340 | } | 4337 | } |
4341 | 4338 | ||
4342 | spin_lock(sb_bgl_lock(sbi, block_group)); | 4339 | spin_lock(sb_bgl_lock(sbi, block_group)); |