From: Jan Kara <jack@suse.cz>
To: Wang Shilong <wangshilong1991@gmail.com>
Cc: linux-ext4@vger.kernel.org, sihara@ddn.com, lixi@ddn.com,
wshilong@ddn.com
Subject: Re: [PATCH 2/3] ext4: cleanup goto next group
Date: Mon, 21 Aug 2017 09:58:31 +0200 [thread overview]
Message-ID: <20170821075831.GA20202@quack2.suse.cz> (raw)
In-Reply-To: <20170820115325.57015-1-wshilong@ddn.com>
On Sun 20-08-17 19:53:25, Wang Shilong wrote:
> From: Wang Shilong <wshilong@ddn.com>
>
> avoid duplicated codes, also we need goto
> next group in case we found reserved inode.
>
> Signed-off-by: Wang Shilong <wshilong@ddn.com>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/ialloc.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 0d03e73..9e6eb1c 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -892,19 +892,13 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
> /*
> * Check free inodes count before loading bitmap.
> */
> - if (ext4_free_inodes_count(sb, gdp) == 0) {
> - if (++group == ngroups)
> - group = 0;
> - continue;
> - }
> + if (ext4_free_inodes_count(sb, gdp) == 0)
> + goto next_group;
>
> grp = ext4_get_group_info(sb, group);
> /* Skip groups with already-known suspicious inode tables */
> - if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) {
> - if (++group == ngroups)
> - group = 0;
> - continue;
> - }
> + if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
> + goto next_group;
>
> brelse(inode_bitmap_bh);
> inode_bitmap_bh = ext4_read_inode_bitmap(sb, group);
> @@ -912,9 +906,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
> if (EXT4_MB_GRP_IBITMAP_CORRUPT(grp) ||
> IS_ERR(inode_bitmap_bh)) {
> inode_bitmap_bh = NULL;
> - if (++group == ngroups)
> - group = 0;
> - continue;
> + goto next_group;
> }
>
> repeat_in_this_group:
> @@ -926,7 +918,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
> if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) {
> ext4_error(sb, "reserved inode found cleared - "
> "inode=%lu", ino + 1);
> - continue;
> + goto next_group;
> }
> if ((EXT4_SB(sb)->s_journal == NULL) &&
> recently_deleted(sb, group, ino)) {
> --
> 2.9.3
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2017-08-21 7:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-20 11:53 [PATCH 2/3] ext4: cleanup goto next group Wang Shilong
2017-08-21 7:58 ` Jan Kara [this message]
2017-08-24 15:59 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170821075831.GA20202@quack2.suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=lixi@ddn.com \
--cc=sihara@ddn.com \
--cc=wangshilong1991@gmail.com \
--cc=wshilong@ddn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).