[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230608162131.kduwoemmbeowmfg4@quack3>
Date: Thu, 8 Jun 2023 18:21:31 +0200
From: Jan Kara <jack@...e.cz>
To: Lu Hongfei <luhongfei@...o.com>
Cc: Theodore Ts'o <tytso@....edu>,
Andreas Dilger <adilger.kernel@...ger.ca>,
"open list:EXT4 FILE SYSTEM" <linux-ext4@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>,
opensource.kernel@...o.com
Subject: Re: [PATCH] ext4: Fix traditional comparison using max/min method
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@...o.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.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@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists