[PATCH 7/7] ext4: check buffer_verified in advance to avoid unneeded ext4_get_group_info

Kemeng Shi posted 7 patches 1 year, 6 months ago
There is a newer version of this series
[PATCH 7/7] ext4: check buffer_verified in advance to avoid unneeded ext4_get_group_info
Posted by Kemeng Shi 1 year, 6 months ago
Check buffer_verified in advance to avoid unneeded ext4_get_group_info.
This could be a simple cleanup as complier may handle this.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/ext4/ialloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 0cb109037384..e700236303cd 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -87,10 +87,10 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
 	if (EXT4_SB(sb)->s_mount_state & EXT4_FC_REPLAY)
 		return 0;
 
-	grp = ext4_get_group_info(sb, block_group);
-
 	if (buffer_verified(bh))
 		return 0;
+
+	grp = ext4_get_group_info(sb, block_group);
 	if (!grp || EXT4_MB_GRP_IBITMAP_CORRUPT(grp))
 		return -EFSCORRUPTED;
 
-- 
2.30.0
Re: [PATCH 7/7] ext4: check buffer_verified in advance to avoid unneeded ext4_get_group_info
Posted by Markus Elfring 1 year, 5 months ago
…
> This could be a simple cleanup as complier may handle this.

                                    compiler?


Would you like to append parentheses to the mentioned function name?

Regards,
Markus
Re: [PATCH 7/7] ext4: check buffer_verified in advance to avoid unneeded ext4_get_group_info
Posted by Kemeng Shi 1 year, 5 months ago

on 8/15/2024 7:13 PM, Markus Elfring wrote:
> …
>> This could be a simple cleanup as complier may handle this.
> 
>                                     compiler?
Right.
> 
> 
> Would you like to append parentheses to the mentioned function name?
Sure

Will improve in next version.

Thanks,
Kemeng
> 
> Regards,
> Markus
>