diff options
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 9c63f273b550..b7a8130d0af4 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -816,7 +816,6 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode, | |||
816 | int ret2, err = 0; | 816 | int ret2, err = 0; |
817 | struct inode *ret; | 817 | struct inode *ret; |
818 | ext4_group_t i; | 818 | ext4_group_t i; |
819 | int free = 0; | ||
820 | static int once = 1; | 819 | static int once = 1; |
821 | ext4_group_t flex_group; | 820 | ext4_group_t flex_group; |
822 | 821 | ||
@@ -950,26 +949,21 @@ got: | |||
950 | goto fail; | 949 | goto fail; |
951 | } | 950 | } |
952 | 951 | ||
953 | free = 0; | 952 | BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); |
954 | ext4_lock_group(sb, group); | 953 | err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh); |
954 | brelse(block_bitmap_bh); | ||
955 | |||
955 | /* recheck and clear flag under lock if we still need to */ | 956 | /* recheck and clear flag under lock if we still need to */ |
957 | ext4_lock_group(sb, group); | ||
956 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 958 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
957 | free = ext4_free_blocks_after_init(sb, group, gdp); | ||
958 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); | 959 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); |
959 | ext4_free_blks_set(sb, gdp, free); | 960 | ext4_free_blks_set(sb, gdp, |
961 | ext4_free_blocks_after_init(sb, group, gdp)); | ||
960 | gdp->bg_checksum = ext4_group_desc_csum(sbi, group, | 962 | gdp->bg_checksum = ext4_group_desc_csum(sbi, group, |
961 | gdp); | 963 | gdp); |
962 | } | 964 | } |
963 | ext4_unlock_group(sb, group); | 965 | ext4_unlock_group(sb, group); |
964 | 966 | ||
965 | /* Don't need to dirty bitmap block if we didn't change it */ | ||
966 | if (free) { | ||
967 | BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); | ||
968 | err = ext4_handle_dirty_metadata(handle, | ||
969 | NULL, block_bitmap_bh); | ||
970 | } | ||
971 | |||
972 | brelse(block_bitmap_bh); | ||
973 | if (err) | 967 | if (err) |
974 | goto fail; | 968 | goto fail; |
975 | } | 969 | } |