Commit 2fe435d8 authored by Wang Shilong's avatar Wang Shilong Committed by Theodore Ts'o

ext4: cleanup goto next group

avoid duplicated codes, also we need goto
next group in case we found reserved inode.
Signed-off-by: default avatarWang Shilong <wshilong@ddn.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
parent 4f9d956d
...@@ -892,19 +892,13 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, ...@@ -892,19 +892,13 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
/* /*
* Check free inodes count before loading bitmap. * Check free inodes count before loading bitmap.
*/ */
if (ext4_free_inodes_count(sb, gdp) == 0) { if (ext4_free_inodes_count(sb, gdp) == 0)
if (++group == ngroups) goto next_group;
group = 0;
continue;
}
grp = ext4_get_group_info(sb, group); grp = ext4_get_group_info(sb, group);
/* Skip groups with already-known suspicious inode tables */ /* Skip groups with already-known suspicious inode tables */
if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
if (++group == ngroups) goto next_group;
group = 0;
continue;
}
brelse(inode_bitmap_bh); brelse(inode_bitmap_bh);
inode_bitmap_bh = ext4_read_inode_bitmap(sb, group); inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
...@@ -912,9 +906,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, ...@@ -912,9 +906,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp) || if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp) ||
IS_ERR(inode_bitmap_bh)) { IS_ERR(inode_bitmap_bh)) {
inode_bitmap_bh = NULL; inode_bitmap_bh = NULL;
if (++group == ngroups) goto next_group;
group = 0;
continue;
} }
repeat_in_this_group: repeat_in_this_group:
...@@ -926,7 +918,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, ...@@ -926,7 +918,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
ext4_error(sb, "reserved inode found cleared - " ext4_error(sb, "reserved inode found cleared - "
"inode=%lu", ino + 1); "inode=%lu", ino + 1);
continue; goto next_group;
} }
if ((EXT4_SB(sb)->s_journal == NULL) && if ((EXT4_SB(sb)->s_journal == NULL) &&
recently_deleted(sb, group, ino)) { recently_deleted(sb, group, ino)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment