1 From 3c70515d068ddd713ee71e4e7abb1c577c00bc97 Mon Sep 17 00:00:00 2001
2 From: Wang Shilong <wshilong@ddn.com>
3 Date: Thu, 24 Aug 2017 11:58:18 -0400
4 ext4: cleanup goto next group
6 avoid duplicated codes, also we need goto
7 next group in case we found reserved inode.
9 Signed-off-by: Wang Shilong <wshilong@ddn.com>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
11 Reviewed-by: Jan Kara <jack@suse.cz>
13 fs/ext4/ialloc.c | 23 +++++++----------------
14 1 file changed, 7 insertions(+), 16 deletions(-)
16 diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
17 index 54f1ae0..7d71533 100644
18 --- a/fs/ext4/ialloc.c
19 +++ b/fs/ext4/ialloc.c
20 @@ -775,28 +775,19 @@ got_group:
22 * Check free inodes count before loading bitmap.
24 - if (ext4_free_inodes_count(sb, gdp) == 0) {
25 - if (++group == ngroups)
29 + if (ext4_free_inodes_count(sb, gdp) == 0)
32 grp = ext4_get_group_info(sb, group);
33 /* Skip groups with already-known suspicious inode tables */
34 - if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) {
35 - if (++group == ngroups)
39 + if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
42 brelse(inode_bitmap_bh);
43 inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
44 /* Skip groups with suspicious inode tables */
45 - if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp) || !inode_bitmap_bh) {
46 - if (++group == ngroups)
50 + if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp) || !inode_bitmap_bh)
54 ino = ext4_find_next_zero_bit((unsigned long *)
55 @@ -807,7 +798,7 @@ repeat_in_this_group:
56 if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
57 ext4_error(sb, "reserved inode found cleared - "
58 "inode=%lu", ino + 1);
62 if ((EXT4_SB(sb)->s_journal == NULL) &&
63 recently_deleted(sb, group, ino)) {