2022-02-01 20:42:01

by Ritesh Harjani

[permalink] [raw]
Subject: [RFC 4/6] ext4: No need to test for block bitmap bits in ext4_mb_mark_bb()

We don't need the return value of mb_test_and_clear_bits() in ext4_mb_mark_bb()
So simply use mb_clear_bits() instead.

Signed-off-by: Ritesh Harjani <[email protected]>
---
fs/ext4/mballoc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 60d32d3d8dc4..2f931575e6c2 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3943,7 +3943,7 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
if (state)
ext4_set_bits(bitmap_bh->b_data, blkoff, clen);
else
- mb_test_and_clear_bits(bitmap_bh->b_data, blkoff, clen);
+ mb_clear_bits(bitmap_bh->b_data, blkoff, clen);
if (ext4_has_group_desc_csum(sb) &&
(gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) {
gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
--
2.31.1


2022-02-02 06:54:11

by Jan Kara

[permalink] [raw]
Subject: Re: [RFC 4/6] ext4: No need to test for block bitmap bits in ext4_mb_mark_bb()

On Mon 31-01-22 20:46:53, Ritesh Harjani wrote:
> We don't need the return value of mb_test_and_clear_bits() in ext4_mb_mark_bb()
> So simply use mb_clear_bits() instead.
>
> Signed-off-by: Ritesh Harjani <[email protected]>

Looks good. I'm rather confused by ext4_set_bits() vs mb_clear_bits()
asymetry but that's not directly related to this patch. Just another
cleanup to do. Feel free to add:

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

Honza

> ---
> fs/ext4/mballoc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 60d32d3d8dc4..2f931575e6c2 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3943,7 +3943,7 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
> if (state)
> ext4_set_bits(bitmap_bh->b_data, blkoff, clen);
> else
> - mb_test_and_clear_bits(bitmap_bh->b_data, blkoff, clen);
> + mb_clear_bits(bitmap_bh->b_data, blkoff, clen);
> if (ext4_has_group_desc_csum(sb) &&
> (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) {
> gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
> --
> 2.31.1
>
--
Jan Kara <[email protected]>
SUSE Labs, CR

2022-02-04 17:13:41

by Ritesh Harjani

[permalink] [raw]
Subject: Re: [RFC 4/6] ext4: No need to test for block bitmap bits in ext4_mb_mark_bb()

On 22/02/01 12:38PM, Jan Kara wrote:
> On Mon 31-01-22 20:46:53, Ritesh Harjani wrote:
> > We don't need the return value of mb_test_and_clear_bits() in ext4_mb_mark_bb()
> > So simply use mb_clear_bits() instead.
> >
> > Signed-off-by: Ritesh Harjani <[email protected]>
>
> Looks good. I'm rather confused by ext4_set_bits() vs mb_clear_bits()
> asymetry but that's not directly related to this patch. Just another
> cleanup to do. Feel free to add:

Yes, make sense. Looking at ext4_set_bits(), I think it should be renamed to
mb_set_bits() for uniform API conventions.

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

Thanks :)

> Honza
>
> > ---
> > fs/ext4/mballoc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> > index 60d32d3d8dc4..2f931575e6c2 100644
> > --- a/fs/ext4/mballoc.c
> > +++ b/fs/ext4/mballoc.c
> > @@ -3943,7 +3943,7 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,
> > if (state)
> > ext4_set_bits(bitmap_bh->b_data, blkoff, clen);
> > else
> > - mb_test_and_clear_bits(bitmap_bh->b_data, blkoff, clen);
> > + mb_clear_bits(bitmap_bh->b_data, blkoff, clen);
> > if (ext4_has_group_desc_csum(sb) &&
> > (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) {
> > gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
> > --
> > 2.31.1
> >
> --
> Jan Kara <[email protected]>
> SUSE Labs, CR