On 22/09/03 11:01AM, Jason Yan wrote:
> Factor out ext4_group_desc_init() and ext4_group_desc_free(). No
> functional change.
>
> Signed-off-by: Jason Yan <[email protected]>
> Reviewed-by: Jan Kara <[email protected]>
> ---
> fs/ext4/super.c | 143 ++++++++++++++++++++++++++++--------------------
> 1 file changed, 84 insertions(+), 59 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 69921a850644..468a958cf414 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4743,9 +4743,89 @@ static int ext4_geometry_check(struct super_block *sb,
> return 0;
> }
>
> +static void ext4_group_desc_free(struct ext4_sb_info *sbi)
> +{
> + struct buffer_head **group_desc;
> + int i;
> +
> + rcu_read_lock();
> + group_desc = rcu_dereference(sbi->s_group_desc);
> + for (i = 0; i < sbi->s_gdb_count; i++)
> + brelse(group_desc[i]);
> + kvfree(group_desc);
> + rcu_read_unlock();
> +}
I thought we could use ext4_group_desc_free() in ext4_put_super() too.
But I guess in there within the same rcu_read_lock/unlock() we call for
kvfree of flex_groups as well.
But this change looks good to me.
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>