* [PATCH 2/3] ext4: cleanup goto next group
@ 2017-08-20 11:53 Wang Shilong
2017-08-21 7:58 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Wang Shilong @ 2017-08-20 11:53 UTC (permalink / raw)
To: linux-ext4; +Cc: sihara, lixi, wshilong
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] ext4: cleanup goto next group
2017-08-20 11:53 [PATCH 2/3] ext4: cleanup goto next group Wang Shilong
@ 2017-08-21 7:58 ` Jan Kara
2017-08-24 15:59 ` Theodore Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2017-08-21 7:58 UTC (permalink / raw)
To: Wang Shilong; +Cc: linux-ext4, sihara, lixi, wshilong
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] ext4: cleanup goto next group
2017-08-21 7:58 ` Jan Kara
@ 2017-08-24 15:59 ` Theodore Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2017-08-24 15:59 UTC (permalink / raw)
To: Jan Kara; +Cc: Wang Shilong, linux-ext4, sihara, lixi, wshilong
On Mon, Aug 21, 2017 at 09:58:31AM +0200, Jan Kara wrote:
> 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>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-24 15:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-20 11:53 [PATCH 2/3] ext4: cleanup goto next group Wang Shilong
2017-08-21 7:58 ` Jan Kara
2017-08-24 15:59 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.