public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: remove useless conditional branch code
@ 2023-04-01  7:53 wuchi
  2023-04-14 16:55 ` Jan Kara
  2023-04-20 13:47 ` Theodore Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: wuchi @ 2023-04-01  7:53 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel

It's ok because the code will be optimized by the compiler, just
try to simple the code.

Signed-off-by: wuchi <wuchi.zero@gmail.com>
---
 fs/ext4/bitmap.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
index 87c1c8ae9298..cd725bebe69e 100644
--- a/fs/ext4/bitmap.c
+++ b/fs/ext4/bitmap.c
@@ -74,10 +74,7 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb,
 	} else
 		calculated &= 0xFFFF;
 
-	if (provided == calculated)
-		return 1;
-
-	return 0;
+	return provided == calculated;
 }
 
 void ext4_block_bitmap_csum_set(struct super_block *sb,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: remove useless conditional branch code
  2023-04-01  7:53 [PATCH] ext4: remove useless conditional branch code wuchi
@ 2023-04-14 16:55 ` Jan Kara
  2023-04-20 13:47 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2023-04-14 16:55 UTC (permalink / raw)
  To: wuchi; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel

On Sat 01-04-23 15:53:03, wuchi wrote:
> It's ok because the code will be optimized by the compiler, just
> try to simple the code.
> 
> Signed-off-by: wuchi <wuchi.zero@gmail.com>

Sure. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> 
> diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c
> index 87c1c8ae9298..cd725bebe69e 100644
> --- a/fs/ext4/bitmap.c
> +++ b/fs/ext4/bitmap.c
> @@ -74,10 +74,7 @@ int ext4_block_bitmap_csum_verify(struct super_block *sb,
>  	} else
>  		calculated &= 0xFFFF;
>  
> -	if (provided == calculated)
> -		return 1;
> -
> -	return 0;
> +	return provided == calculated;
>  }
>  
>  void ext4_block_bitmap_csum_set(struct super_block *sb,
> -- 
> 2.20.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: remove useless conditional branch code
  2023-04-01  7:53 [PATCH] ext4: remove useless conditional branch code wuchi
  2023-04-14 16:55 ` Jan Kara
@ 2023-04-20 13:47 ` Theodore Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2023-04-20 13:47 UTC (permalink / raw)
  To: adilger.kernel, wuchi; +Cc: Theodore Ts'o, linux-ext4, linux-kernel


On Sat, 01 Apr 2023 15:53:03 +0800, wuchi wrote:
> It's ok because the code will be optimized by the compiler, just
> try to simple the code.
> 
> 

Applied, thanks!

[1/1] ext4: remove useless conditional branch code
      commit: 17809d3cf801374d7c23101800770ea34951f3c8

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-20 16:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-01  7:53 [PATCH] ext4: remove useless conditional branch code wuchi
2023-04-14 16:55 ` Jan Kara
2023-04-20 13:47 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox