[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <herlaqmrxfzbh2yqumcquf4ex7qxz5sk47uswmwucdg3pmryez@bvyyavacx5rq>
Date: Wed, 3 Dec 2025 11:40:06 +0100
From: Jan Kara <jack@...e.cz>
To: Vivek BalachandharTN <vivek.balachandhar@...il.com>
Cc: jack@...e.com, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext2: factor out ext2_fill_super() teardown path
On Wed 03-12-25 04:50:48, Vivek BalachandharTN wrote:
> The error path at the end of ext2_fill_super() open-codes the final
> teardown of the ext2_sb_info structure and associated resources.
> Centralize this into a small helper to make the control flow a bit
> clearer and avoid repeating the same cleanup sequence in multiple
> labels.
>
> Behavior is unchanged.
>
> Signed-off-by: Vivek BalachandharTN <vivek.balachandhar@...il.com>
This is pointless - no point in factoring out helper when it has a single
call site. Also your patch is broken in several ways (both in correctness
and style). Please be more thoughtful when submitting patches.
Honza
> +static void ext2_free_sbi(struct super_block *sb,
> + struct ext2_sb_info *sbi,
> + struct buffer_head *bh)
> +{
> + if (bh)
> + brelse(bh);
> +
> + fs_put_dax(sbi->s_daxdev, NULL);
> + sb->s_fs_info = NULL;
> + kfree(sbi->s_blockgroup_lock);
> + kfree(sbi);
> +}
> +
> static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
> {
> struct ext2_fs_context *ctx = fc->fs_private;
> @@ -1251,12 +1264,8 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
> kvfree(sbi->s_group_desc);
> kfree(sbi->s_debts);
> failed_mount:
> - brelse(bh);
> failed_sbi:
> - fs_put_dax(sbi->s_daxdev, NULL);
> - sb->s_fs_info = NULL;
> - kfree(sbi->s_blockgroup_lock);
> - kfree(sbi);
> + ext2_free_sbi(sb, sbi, bh);
> return ret;
> }
>
> --
> 2.34.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists