summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorLu Hongfei <luhongfei@vivo.com>2023-05-29 10:09:30 +0300
committerTheodore Ts'o <tytso@mit.edu>2023-10-06 04:48:02 +0300
commita8c1eb77edfc92a64788dad70fedf9277cbafe76 (patch)
tree561b4a868a84945041490124d209d2d6731bc69d /fs/ext4
parent745f17a4166e79315e4b7f33ce89d03e75a76983 (diff)
downloadlinux-a8c1eb77edfc92a64788dad70fedf9277cbafe76.tar.xz
ext4: fix traditional comparison using max/min method
It would be better to replace the traditional ternary conditional operator with max()/min() Signed-off-by: Lu Hongfei <luhongfei@vivo.com> Reviewed-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230529070930.37949-1-luhongfei@vivo.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/balloc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 79b20d6ae39e..4d08bb2bd184 100644
--- 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);