mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Lu Hongfei <luhongfei@vivo.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	"open list:EXT4 FILE SYSTEM" <linux-ext4@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	opensource.kernel@vivo.com
Subject: Re: [PATCH] ext4: Fix traditional comparison using max/min method
Date: Thu, 8 Jun 2023 18:21:31 +0200	[thread overview]
Message-ID: <20230608162131.kduwoemmbeowmfg4@quack3> (raw)
In-Reply-To: <20230529070930.37949-1-luhongfei@vivo.com>

On Mon 29-05-23 15:09:30, Lu Hongfei wrote:
> It would be better to replace the traditional ternary conditional
> operator with max()/min()
> 
> Signed-off-by: Lu Hongfei <luhongfei@vivo.com>

Looks good. Feel free to add:

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

								Honza

> ---
>  fs/ext4/balloc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>  mode change 100644 => 100755 fs/ext4/balloc.c
> 
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index c1edde817be8..82124045d187
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -111,10 +111,8 @@ static unsigned ext4_num_overhead_clusters(struct super_block *sb,
>  	itbl_blk_start = ext4_inode_table(sb, gdp);
>  	itbl_blk_end = itbl_blk_start + sbi->s_itb_per_group - 1;
>  	if (itbl_blk_start <= end && itbl_blk_end >= start) {
> -		itbl_blk_start = itbl_blk_start >= start ?
> -			itbl_blk_start : start;
> -		itbl_blk_end = itbl_blk_end <= end ?
> -			itbl_blk_end : end;
> +		itbl_blk_start = max(itbl_blk_start, start);
> +		itbl_blk_end = min(itbl_blk_end, end);
>  
>  		itbl_cluster_start = EXT4_B2C(sbi, itbl_blk_start - start);
>  		itbl_cluster_end = EXT4_B2C(sbi, itbl_blk_end - start);
> -- 
> 2.39.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2023-06-08 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29  7:09 Lu Hongfei
2023-06-08 16:21 ` Jan Kara [this message]
2023-06-09  1:48 ` Kemeng Shi
2023-10-06 18:06 ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230608162131.kduwoemmbeowmfg4@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luhongfei@vivo.com \
    --cc=opensource.kernel@vivo.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®