2023-02-21 12:29:03

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 0/4] Remove unused group parameter in bitmap checksum

Hi all, this series try to remove unused group parameter in four bitmap
checksum functions. Each function is cleaned in a separated patch.
Thanks!

Kemeng Shi (4):
ext4: remove unused group parameter in ext4_inode_bitmap_csum_verify
ext4: remove unused group parameter in ext4_inode_bitmap_csum_set
ext4: remove unused group parameter in ext4_block_bitmap_csum_verify
ext4: remove unused group parameter in ext4_block_bitmap_csum_set

fs/ext4/balloc.c | 3 +--
fs/ext4/bitmap.c | 8 ++++----
fs/ext4/ext4.h | 8 ++++----
fs/ext4/ialloc.c | 14 ++++++--------
fs/ext4/mballoc.c | 10 +++++-----
fs/ext4/resize.c | 7 +++----
6 files changed, 23 insertions(+), 27 deletions(-)

--
2.30.0



2023-02-21 12:29:05

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 1/4] ext4: remove unused group parameter in ext4_inode_bitmap_csum_verify

Remove unused group parameter in ext4_inode_bitmap_csum_verify.

Signed-off-by: Kemeng Shi <[email protected]>
---
fs/ext4/bitmap.c | 2 +-
fs/ext4/ext4.h | 2 +-
fs/ext4/ialloc.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index f63e028c638c..3bb28fad624f 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -16,7 +16,7 @@ unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
return numchars * BITS_PER_BYTE - memweight(bitmap, numchars);
}

-int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
+int ext4_inode_bitmap_csum_verify(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh, int sz)
{
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 6479146140d2..db2476daebd2 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2679,7 +2679,7 @@ extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
struct ext4_group_desc *gdp,
struct buffer_head *bh, int sz);
-int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
+int ext4_inode_bitmap_csum_verify(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh, int sz);
void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 63f9bb6e8851..7e388340f588 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -98,7 +98,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
if (buffer_verified(bh))
goto verified;
blk = ext4_inode_bitmap(sb, desc);
- if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
+ if (!ext4_inode_bitmap_csum_verify(sb, desc, bh,
EXT4_INODES_PER_GROUP(sb) / 8) ||
ext4_simulate_fail(sb, EXT4_SIM_IBITMAP_CRC)) {
ext4_unlock_group(sb, block_group);
--
2.30.0


2023-02-21 12:29:06

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 3/4] ext4: remove unused group parameter in ext4_block_bitmap_csum_verify

Remove unused group parameter in ext4_block_bitmap_csum_verify.

Signed-off-by: Kemeng Shi <[email protected]>
---
fs/ext4/balloc.c | 3 +--
fs/ext4/bitmap.c | 2 +-
fs/ext4/ext4.h | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 689edfed231a..49fdb758b0e4 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -385,8 +385,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
ext4_lock_group(sb, block_group);
if (buffer_verified(bh))
goto verified;
- if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
- desc, bh) ||
+ if (unlikely(!ext4_block_bitmap_csum_verify(sb, desc, bh) ||
ext4_simulate_fail(sb, EXT4_SIM_BBITMAP_CRC))) {
ext4_unlock_group(sb, block_group);
ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 0186b894f5b3..3b83d979a650 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -54,7 +54,7 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb,
gdp->bg_inode_bitmap_csum_hi = cpu_to_le16(csum >> 16);
}

-int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
+int ext4_block_bitmap_csum_verify(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh)
{
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index aa6948d12ede..04447640b4f4 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2685,7 +2685,7 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb,
void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
struct ext4_group_desc *gdp,
struct buffer_head *bh);
-int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
+int ext4_block_bitmap_csum_verify(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh);

--
2.30.0


2023-02-21 12:29:08

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 4/4] ext4: remove unused group parameter in ext4_block_bitmap_csum_set

Remove unused group parameter in ext4_block_bitmap_csum_set. After this,
group parameter in ext4_set_bitmap_checksums is also not used, just
remove it too.

Signed-off-by: Kemeng Shi <[email protected]>
---
fs/ext4/bitmap.c | 2 +-
fs/ext4/ext4.h | 2 +-
fs/ext4/ialloc.c | 6 ++----
fs/ext4/mballoc.c | 10 +++++-----
fs/ext4/resize.c | 5 ++---
5 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 3b83d979a650..87c1c8ae9298 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -80,7 +80,7 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb,
return 0;
}

-void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
+void ext4_block_bitmap_csum_set(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh)
{
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 04447640b4f4..3051dc8584d8 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2682,7 +2682,7 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb,
int ext4_inode_bitmap_csum_verify(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh, int sz);
-void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
+void ext4_block_bitmap_csum_set(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh);
int ext4_block_bitmap_csum_verify(struct super_block *sb,
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index b86756c57c0b..e4bad4b5145c 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -813,8 +813,7 @@ int ext4_mark_inode_used(struct super_block *sb, int ino)
gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
ext4_free_group_clusters_set(sb, gdp,
ext4_free_clusters_after_init(sb, group, gdp));
- ext4_block_bitmap_csum_set(sb, group, gdp,
- block_bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, gdp, block_bitmap_bh);
ext4_group_desc_csum_set(sb, group, gdp);
}
ext4_unlock_group(sb, group);
@@ -1165,8 +1164,7 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
ext4_free_group_clusters_set(sb, gdp,
ext4_free_clusters_after_init(sb, group, gdp));
- ext4_block_bitmap_csum_set(sb, group, gdp,
- block_bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, gdp, block_bitmap_bh);
ext4_group_desc_csum_set(sb, group, gdp);
}
ext4_unlock_group(sb, group);
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5b2ae37a8b80..0d69cd8c5fc3 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3822,7 +3822,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
}
len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len;
ext4_free_group_clusters_set(sb, gdp, len);
- ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp);

ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
@@ -3929,7 +3929,7 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
clen = ext4_free_group_clusters(sb, gdp) + clen_changed;

ext4_free_group_clusters_set(sb, gdp, clen);
- ext4_block_bitmap_csum_set(sb, group, gdp, bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
ext4_group_desc_csum_set(sb, group, gdp);

ext4_unlock_group(sb, group);
@@ -5861,7 +5861,7 @@ static void ext4_free_blocks_simple(struct inode *inode, ext4_fsblk_t block,
ext4_free_group_clusters_set(
sb, gdp, ext4_free_group_clusters(sb, gdp) +
count - already_freed);
- ext4_block_bitmap_csum_set(sb, group, gdp, bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
ext4_group_desc_csum_set(sb, group, gdp);
ext4_handle_dirty_metadata(NULL, NULL, gdp_bh);
sync_dirty_buffer(bitmap_bh);
@@ -6023,7 +6023,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,

ret = ext4_free_group_clusters(sb, gdp) + count_clusters;
ext4_free_group_clusters_set(sb, gdp, ret);
- ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
ext4_group_desc_csum_set(sb, block_group, gdp);
ext4_unlock_group(sb, block_group);

@@ -6280,7 +6280,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
free_clusters_count = clusters_freed +
ext4_free_group_clusters(sb, desc);
ext4_free_group_clusters_set(sb, desc, free_clusters_count);
- ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh);
+ ext4_block_bitmap_csum_set(sb, desc, bitmap_bh);
ext4_group_desc_csum_set(sb, block_group, desc);
ext4_unlock_group(sb, block_group);
percpu_counter_add(&sbi->s_freeclusters_counter,
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 607a1af00665..0361c20910de 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1306,7 +1306,6 @@ static struct buffer_head *ext4_get_bitmap(struct super_block *sb, __u64 block)
}

static int ext4_set_bitmap_checksums(struct super_block *sb,
- ext4_group_t group,
struct ext4_group_desc *gdp,
struct ext4_new_group_data *group_data)
{
@@ -1325,7 +1324,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb,
bh = ext4_get_bitmap(sb, group_data->block_bitmap);
if (!bh)
return -EIO;
- ext4_block_bitmap_csum_set(sb, group, gdp, bh);
+ ext4_block_bitmap_csum_set(sb, gdp, bh);
brelse(bh);

return 0;
@@ -1363,7 +1362,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb,
memset(gdp, 0, EXT4_DESC_SIZE(sb));
ext4_block_bitmap_set(sb, gdp, group_data->block_bitmap);
ext4_inode_bitmap_set(sb, gdp, group_data->inode_bitmap);
- err = ext4_set_bitmap_checksums(sb, group, gdp, group_data);
+ err = ext4_set_bitmap_checksums(sb, gdp, group_data);
if (err) {
ext4_std_error(sb, err);
break;
--
2.30.0


2023-02-21 12:29:08

by Kemeng Shi

[permalink] [raw]
Subject: [PATCH 2/4] ext4: remove unused group parameter in ext4_inode_bitmap_csum_set

Remove unused group parameter in ext4_inode_bitmap_csum_set.

Signed-off-by: Kemeng Shi <[email protected]>
---
fs/ext4/bitmap.c | 2 +-
fs/ext4/ext4.h | 2 +-
fs/ext4/ialloc.c | 6 +++---
fs/ext4/resize.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 3bb28fad624f..0186b894f5b3 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -38,7 +38,7 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb,
return provided == calculated;
}

-void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
+void ext4_inode_bitmap_csum_set(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh, int sz)
{
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index db2476daebd2..aa6948d12ede 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2676,7 +2676,7 @@ struct mmpd_data {

/* bitmap.c */
extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
-void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
+void ext4_inode_bitmap_csum_set(struct super_block *sb,
struct ext4_group_desc *gdp,
struct buffer_head *bh, int sz);
int ext4_inode_bitmap_csum_verify(struct super_block *sb,
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 7e388340f588..b86756c57c0b 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -327,7 +327,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
if (percpu_counter_initialized(&sbi->s_dirs_counter))
percpu_counter_dec(&sbi->s_dirs_counter);
}
- ext4_inode_bitmap_csum_set(sb, block_group, gdp, bitmap_bh,
+ ext4_inode_bitmap_csum_set(sb, gdp, bitmap_bh,
EXT4_INODES_PER_GROUP(sb) / 8);
ext4_group_desc_csum_set(sb, block_group, gdp);
ext4_unlock_group(sb, block_group);
@@ -852,7 +852,7 @@ int ext4_mark_inode_used(struct super_block *sb, int ino)

ext4_free_inodes_set(sb, gdp, ext4_free_inodes_count(sb, gdp) - 1);
if (ext4_has_group_desc_csum(sb)) {
- ext4_inode_bitmap_csum_set(sb, group, gdp, inode_bitmap_bh,
+ ext4_inode_bitmap_csum_set(sb, gdp, inode_bitmap_bh,
EXT4_INODES_PER_GROUP(sb) / 8);
ext4_group_desc_csum_set(sb, group, gdp);
}
@@ -1222,7 +1222,7 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
}
}
if (ext4_has_group_desc_csum(sb)) {
- ext4_inode_bitmap_csum_set(sb, group, gdp, inode_bitmap_bh,
+ ext4_inode_bitmap_csum_set(sb, gdp, inode_bitmap_bh,
EXT4_INODES_PER_GROUP(sb) / 8);
ext4_group_desc_csum_set(sb, group, gdp);
}
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 6b91443d6bf3..607a1af00665 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1318,7 +1318,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb,
bh = ext4_get_bitmap(sb, group_data->inode_bitmap);
if (!bh)
return -EIO;
- ext4_inode_bitmap_csum_set(sb, group, gdp, bh,
+ ext4_inode_bitmap_csum_set(sb, gdp, bh,
EXT4_INODES_PER_GROUP(sb) / 8);
brelse(bh);

--
2.30.0


2023-03-07 11:11:00

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 1/4] ext4: remove unused group parameter in ext4_inode_bitmap_csum_verify

On Wed 22-02-23 04:30:24, Kemeng Shi wrote:
> Remove unused group parameter in ext4_inode_bitmap_csum_verify.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/bitmap.c | 2 +-
> fs/ext4/ext4.h | 2 +-
> fs/ext4/ialloc.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
> index f63e028c638c..3bb28fad624f 100644
> --- a/fs/ext4/bitmap.c
> +++ b/fs/ext4/bitmap.c
> @@ -16,7 +16,7 @@ unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
> return numchars * BITS_PER_BYTE - memweight(bitmap, numchars);
> }
>
> -int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
> +int ext4_inode_bitmap_csum_verify(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh, int sz)
> {
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 6479146140d2..db2476daebd2 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2679,7 +2679,7 @@ extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
> void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh, int sz);
> -int ext4_inode_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
> +int ext4_inode_bitmap_csum_verify(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh, int sz);
> void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 63f9bb6e8851..7e388340f588 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -98,7 +98,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
> if (buffer_verified(bh))
> goto verified;
> blk = ext4_inode_bitmap(sb, desc);
> - if (!ext4_inode_bitmap_csum_verify(sb, block_group, desc, bh,
> + if (!ext4_inode_bitmap_csum_verify(sb, desc, bh,
> EXT4_INODES_PER_GROUP(sb) / 8) ||
> ext4_simulate_fail(sb, EXT4_SIM_IBITMAP_CRC)) {
> ext4_unlock_group(sb, block_group);
> --
> 2.30.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2023-03-07 11:11:21

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 2/4] ext4: remove unused group parameter in ext4_inode_bitmap_csum_set

On Wed 22-02-23 04:30:25, Kemeng Shi wrote:
> Remove unused group parameter in ext4_inode_bitmap_csum_set.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/bitmap.c | 2 +-
> fs/ext4/ext4.h | 2 +-
> fs/ext4/ialloc.c | 6 +++---
> fs/ext4/resize.c | 2 +-
> 4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
> index 3bb28fad624f..0186b894f5b3 100644
> --- a/fs/ext4/bitmap.c
> +++ b/fs/ext4/bitmap.c
> @@ -38,7 +38,7 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb,
> return provided == calculated;
> }
>
> -void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> +void ext4_inode_bitmap_csum_set(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh, int sz)
> {
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index db2476daebd2..aa6948d12ede 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2676,7 +2676,7 @@ struct mmpd_data {
>
> /* bitmap.c */
> extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
> -void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> +void ext4_inode_bitmap_csum_set(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh, int sz);
> int ext4_inode_bitmap_csum_verify(struct super_block *sb,
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 7e388340f588..b86756c57c0b 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -327,7 +327,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
> if (percpu_counter_initialized(&sbi->s_dirs_counter))
> percpu_counter_dec(&sbi->s_dirs_counter);
> }
> - ext4_inode_bitmap_csum_set(sb, block_group, gdp, bitmap_bh,
> + ext4_inode_bitmap_csum_set(sb, gdp, bitmap_bh,
> EXT4_INODES_PER_GROUP(sb) / 8);
> ext4_group_desc_csum_set(sb, block_group, gdp);
> ext4_unlock_group(sb, block_group);
> @@ -852,7 +852,7 @@ int ext4_mark_inode_used(struct super_block *sb, int ino)
>
> ext4_free_inodes_set(sb, gdp, ext4_free_inodes_count(sb, gdp) - 1);
> if (ext4_has_group_desc_csum(sb)) {
> - ext4_inode_bitmap_csum_set(sb, group, gdp, inode_bitmap_bh,
> + ext4_inode_bitmap_csum_set(sb, gdp, inode_bitmap_bh,
> EXT4_INODES_PER_GROUP(sb) / 8);
> ext4_group_desc_csum_set(sb, group, gdp);
> }
> @@ -1222,7 +1222,7 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
> }
> }
> if (ext4_has_group_desc_csum(sb)) {
> - ext4_inode_bitmap_csum_set(sb, group, gdp, inode_bitmap_bh,
> + ext4_inode_bitmap_csum_set(sb, gdp, inode_bitmap_bh,
> EXT4_INODES_PER_GROUP(sb) / 8);
> ext4_group_desc_csum_set(sb, group, gdp);
> }
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index 6b91443d6bf3..607a1af00665 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -1318,7 +1318,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb,
> bh = ext4_get_bitmap(sb, group_data->inode_bitmap);
> if (!bh)
> return -EIO;
> - ext4_inode_bitmap_csum_set(sb, group, gdp, bh,
> + ext4_inode_bitmap_csum_set(sb, gdp, bh,
> EXT4_INODES_PER_GROUP(sb) / 8);
> brelse(bh);
>
> --
> 2.30.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2023-03-07 11:11:50

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 3/4] ext4: remove unused group parameter in ext4_block_bitmap_csum_verify

On Wed 22-02-23 04:30:26, Kemeng Shi wrote:
> Remove unused group parameter in ext4_block_bitmap_csum_verify.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/balloc.c | 3 +--
> fs/ext4/bitmap.c | 2 +-
> fs/ext4/ext4.h | 2 +-
> 3 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index 689edfed231a..49fdb758b0e4 100644
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -385,8 +385,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
> ext4_lock_group(sb, block_group);
> if (buffer_verified(bh))
> goto verified;
> - if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group,
> - desc, bh) ||
> + if (unlikely(!ext4_block_bitmap_csum_verify(sb, desc, bh) ||
> ext4_simulate_fail(sb, EXT4_SIM_BBITMAP_CRC))) {
> ext4_unlock_group(sb, block_group);
> ext4_error(sb, "bg %u: bad block bitmap checksum", block_group);
> diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
> index 0186b894f5b3..3b83d979a650 100644
> --- a/fs/ext4/bitmap.c
> +++ b/fs/ext4/bitmap.c
> @@ -54,7 +54,7 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb,
> gdp->bg_inode_bitmap_csum_hi = cpu_to_le16(csum >> 16);
> }
>
> -int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
> +int ext4_block_bitmap_csum_verify(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh)
> {
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index aa6948d12ede..04447640b4f4 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2685,7 +2685,7 @@ int ext4_inode_bitmap_csum_verify(struct super_block *sb,
> void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh);
> -int ext4_block_bitmap_csum_verify(struct super_block *sb, ext4_group_t group,
> +int ext4_block_bitmap_csum_verify(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh);
>
> --
> 2.30.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2023-03-07 11:12:22

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCH 4/4] ext4: remove unused group parameter in ext4_block_bitmap_csum_set

On Wed 22-02-23 04:30:27, Kemeng Shi wrote:
> Remove unused group parameter in ext4_block_bitmap_csum_set. After this,
> group parameter in ext4_set_bitmap_checksums is also not used, just
> remove it too.
>
> Signed-off-by: Kemeng Shi <[email protected]>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/ext4/bitmap.c | 2 +-
> fs/ext4/ext4.h | 2 +-
> fs/ext4/ialloc.c | 6 ++----
> fs/ext4/mballoc.c | 10 +++++-----
> fs/ext4/resize.c | 5 ++---
> 5 files changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
> index 3b83d979a650..87c1c8ae9298 100644
> --- a/fs/ext4/bitmap.c
> +++ b/fs/ext4/bitmap.c
> @@ -80,7 +80,7 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb,
> return 0;
> }
>
> -void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> +void ext4_block_bitmap_csum_set(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh)
> {
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 04447640b4f4..3051dc8584d8 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2682,7 +2682,7 @@ void ext4_inode_bitmap_csum_set(struct super_block *sb,
> int ext4_inode_bitmap_csum_verify(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh, int sz);
> -void ext4_block_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
> +void ext4_block_bitmap_csum_set(struct super_block *sb,
> struct ext4_group_desc *gdp,
> struct buffer_head *bh);
> int ext4_block_bitmap_csum_verify(struct super_block *sb,
> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index b86756c57c0b..e4bad4b5145c 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -813,8 +813,7 @@ int ext4_mark_inode_used(struct super_block *sb, int ino)
> gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
> ext4_free_group_clusters_set(sb, gdp,
> ext4_free_clusters_after_init(sb, group, gdp));
> - ext4_block_bitmap_csum_set(sb, group, gdp,
> - block_bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, gdp, block_bitmap_bh);
> ext4_group_desc_csum_set(sb, group, gdp);
> }
> ext4_unlock_group(sb, group);
> @@ -1165,8 +1164,7 @@ struct inode *__ext4_new_inode(struct user_namespace *mnt_userns,
> gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
> ext4_free_group_clusters_set(sb, gdp,
> ext4_free_clusters_after_init(sb, group, gdp));
> - ext4_block_bitmap_csum_set(sb, group, gdp,
> - block_bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, gdp, block_bitmap_bh);
> ext4_group_desc_csum_set(sb, group, gdp);
> }
> ext4_unlock_group(sb, group);
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 5b2ae37a8b80..0d69cd8c5fc3 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3822,7 +3822,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
> }
> len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len;
> ext4_free_group_clusters_set(sb, gdp, len);
> - ext4_block_bitmap_csum_set(sb, ac->ac_b_ex.fe_group, gdp, bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
> ext4_group_desc_csum_set(sb, ac->ac_b_ex.fe_group, gdp);
>
> ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
> @@ -3929,7 +3929,7 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
> clen = ext4_free_group_clusters(sb, gdp) + clen_changed;
>
> ext4_free_group_clusters_set(sb, gdp, clen);
> - ext4_block_bitmap_csum_set(sb, group, gdp, bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
> ext4_group_desc_csum_set(sb, group, gdp);
>
> ext4_unlock_group(sb, group);
> @@ -5861,7 +5861,7 @@ static void ext4_free_blocks_simple(struct inode *inode, ext4_fsblk_t block,
> ext4_free_group_clusters_set(
> sb, gdp, ext4_free_group_clusters(sb, gdp) +
> count - already_freed);
> - ext4_block_bitmap_csum_set(sb, group, gdp, bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
> ext4_group_desc_csum_set(sb, group, gdp);
> ext4_handle_dirty_metadata(NULL, NULL, gdp_bh);
> sync_dirty_buffer(bitmap_bh);
> @@ -6023,7 +6023,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
>
> ret = ext4_free_group_clusters(sb, gdp) + count_clusters;
> ext4_free_group_clusters_set(sb, gdp, ret);
> - ext4_block_bitmap_csum_set(sb, block_group, gdp, bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, gdp, bitmap_bh);
> ext4_group_desc_csum_set(sb, block_group, gdp);
> ext4_unlock_group(sb, block_group);
>
> @@ -6280,7 +6280,7 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
> free_clusters_count = clusters_freed +
> ext4_free_group_clusters(sb, desc);
> ext4_free_group_clusters_set(sb, desc, free_clusters_count);
> - ext4_block_bitmap_csum_set(sb, block_group, desc, bitmap_bh);
> + ext4_block_bitmap_csum_set(sb, desc, bitmap_bh);
> ext4_group_desc_csum_set(sb, block_group, desc);
> ext4_unlock_group(sb, block_group);
> percpu_counter_add(&sbi->s_freeclusters_counter,
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index 607a1af00665..0361c20910de 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -1306,7 +1306,6 @@ static struct buffer_head *ext4_get_bitmap(struct super_block *sb, __u64 block)
> }
>
> static int ext4_set_bitmap_checksums(struct super_block *sb,
> - ext4_group_t group,
> struct ext4_group_desc *gdp,
> struct ext4_new_group_data *group_data)
> {
> @@ -1325,7 +1324,7 @@ static int ext4_set_bitmap_checksums(struct super_block *sb,
> bh = ext4_get_bitmap(sb, group_data->block_bitmap);
> if (!bh)
> return -EIO;
> - ext4_block_bitmap_csum_set(sb, group, gdp, bh);
> + ext4_block_bitmap_csum_set(sb, gdp, bh);
> brelse(bh);
>
> return 0;
> @@ -1363,7 +1362,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb,
> memset(gdp, 0, EXT4_DESC_SIZE(sb));
> ext4_block_bitmap_set(sb, gdp, group_data->block_bitmap);
> ext4_inode_bitmap_set(sb, gdp, group_data->inode_bitmap);
> - err = ext4_set_bitmap_checksums(sb, group, gdp, group_data);
> + err = ext4_set_bitmap_checksums(sb, gdp, group_data);
> if (err) {
> ext4_std_error(sb, err);
> break;
> --
> 2.30.0
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2023-03-17 01:53:20

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH 0/4] Remove unused group parameter in bitmap checksum

On Wed, 22 Feb 2023 04:30:23 +0800, Kemeng Shi wrote:
> checksum functions. Each function is cleaned in a separated patch.
> Thanks!
>
> Kemeng Shi (4):
> ext4: remove unused group parameter in ext4_inode_bitmap_csum_verify
> ext4: remove unused group parameter in ext4_inode_bitmap_csum_set
> ext4: remove unused group parameter in ext4_block_bitmap_csum_verify
> ext4: remove unused group parameter in ext4_block_bitmap_csum_set
>
> [...]

Applied, thanks!

[1/4] ext4: remove unused group parameter in ext4_inode_bitmap_csum_verify
commit: b689b64229af15259db90652b8e99502bbb31078
[2/4] ext4: remove unused group parameter in ext4_inode_bitmap_csum_set
commit: 96b71c52b744c17dd57b1ae842e878be921d2a80
[3/4] ext4: remove unused group parameter in ext4_block_bitmap_csum_verify
commit: 2ad044d3a6851cb9755b56a1bcbe1f49e5175399
[4/4] ext4: remove unused group parameter in ext4_block_bitmap_csum_set
commit: d7214a6a02a0c7447cce55ebf05de5f7c8df9adf

Best regards,
--
Theodore Ts'o <[email protected]>