[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b66d0e99-5b59-4a91-9b32-3bad3ffc471a@huawei.com>
Date: Tue, 13 May 2025 14:17:08 +0800
From: Baokun Li <libaokun1@...wei.com>
To: Eric Biggers <ebiggers@...nel.org>
CC: <linux-ext4@...r.kernel.org>
Subject: Re: [PATCH 2/4] ext4: remove sb argument from ext4_superblock_csum()
On 2025/5/13 13:38, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
>
> Since ext4_superblock_csum() no longer uses its sb argument, remove it.
>
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
Good spotting!
Reviewed-by: Baokun Li <libaokun1@...wei.com>
> ---
> fs/ext4/ext4.h | 3 +--
> fs/ext4/ioctl.c | 4 ++--
> fs/ext4/resize.c | 2 +-
> fs/ext4/super.c | 9 ++++-----
> 4 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 5c7a86acbf79..25221c6693b0 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -3116,12 +3116,11 @@ extern int ext4_read_bh(struct buffer_head *bh, blk_opf_t op_flags,
> bh_end_io_t *end_io, bool simu_fail);
> extern int ext4_read_bh_lock(struct buffer_head *bh, blk_opf_t op_flags, bool wait);
> extern void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block);
> extern int ext4_seq_options_show(struct seq_file *seq, void *offset);
> extern int ext4_calculate_overhead(struct super_block *sb);
> -extern __le32 ext4_superblock_csum(struct super_block *sb,
> - struct ext4_super_block *es);
> +extern __le32 ext4_superblock_csum(struct ext4_super_block *es);
> extern void ext4_superblock_csum_set(struct super_block *sb);
> extern int ext4_alloc_flex_bg_array(struct super_block *sb,
> ext4_group_t ngroup);
> extern const char *ext4_decode_error(struct super_block *sb, int errno,
> char nbuf[16]);
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index 6b99284095bf..c05eb0efbb95 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -141,19 +141,19 @@ static int ext4_update_backup_sb(struct super_block *sb,
> }
>
> es = (struct ext4_super_block *) (bh->b_data + offset);
> lock_buffer(bh);
> if (ext4_has_feature_metadata_csum(sb) &&
> - es->s_checksum != ext4_superblock_csum(sb, es)) {
> + es->s_checksum != ext4_superblock_csum(es)) {
> ext4_msg(sb, KERN_ERR, "Invalid checksum for backup "
> "superblock %llu", sb_block);
> unlock_buffer(bh);
> goto out_bh;
> }
> func(es, arg);
> if (ext4_has_feature_metadata_csum(sb))
> - es->s_checksum = ext4_superblock_csum(sb, es);
> + es->s_checksum = ext4_superblock_csum(es);
> set_buffer_uptodate(bh);
> unlock_buffer(bh);
>
> if (handle) {
> err = ext4_handle_dirty_metadata(handle, NULL, bh);
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index b7ff0d955f0d..050f26168d97 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -1117,11 +1117,11 @@ static inline void ext4_set_block_group_nr(struct super_block *sb, char *data,
> {
> struct ext4_super_block *es = (struct ext4_super_block *) data;
>
> es->s_block_group_nr = cpu_to_le16(group);
> if (ext4_has_feature_metadata_csum(sb))
> - es->s_checksum = ext4_superblock_csum(sb, es);
> + es->s_checksum = ext4_superblock_csum(es);
> }
>
> /*
> * Update the backup copies of the ext4 metadata. These don't need to be part
> * of the main resize transaction, because e2fsck will re-write them if there
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index d7780269b455..14e47cc2a5a3 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -284,12 +284,11 @@ static int ext4_verify_csum_type(struct super_block *sb,
> return 1;
>
> return es->s_checksum_type == EXT4_CRC32C_CHKSUM;
> }
>
> -__le32 ext4_superblock_csum(struct super_block *sb,
> - struct ext4_super_block *es)
> +__le32 ext4_superblock_csum(struct ext4_super_block *es)
> {
> int offset = offsetof(struct ext4_super_block, s_checksum);
> __u32 csum;
>
> csum = ext4_chksum(~0, (char *)es, offset);
> @@ -301,21 +300,21 @@ static int ext4_superblock_csum_verify(struct super_block *sb,
> struct ext4_super_block *es)
> {
> if (!ext4_has_feature_metadata_csum(sb))
> return 1;
>
> - return es->s_checksum == ext4_superblock_csum(sb, es);
> + return es->s_checksum == ext4_superblock_csum(es);
> }
>
> void ext4_superblock_csum_set(struct super_block *sb)
> {
> struct ext4_super_block *es = EXT4_SB(sb)->s_es;
>
> if (!ext4_has_feature_metadata_csum(sb))
> return;
>
> - es->s_checksum = ext4_superblock_csum(sb, es);
> + es->s_checksum = ext4_superblock_csum(es);
> }
>
> ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
> struct ext4_group_desc *bg)
> {
> @@ -5913,11 +5912,11 @@ static struct file *ext4_get_journal_blkdev(struct super_block *sb,
> goto out_bh;
> }
>
> if ((le32_to_cpu(es->s_feature_ro_compat) &
> EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) &&
> - es->s_checksum != ext4_superblock_csum(sb, es)) {
> + es->s_checksum != ext4_superblock_csum(es)) {
> ext4_msg(sb, KERN_ERR, "external journal has corrupt superblock");
> errno = -EFSCORRUPTED;
> goto out_bh;
> }
>
Powered by blists - more mailing lists