Commit a8c1eb77 authored by Lu Hongfei's avatar Lu Hongfei Committed by Theodore Ts'o

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: default avatarLu Hongfei <luhongfei@vivo.com>
Reviewed-by: default avatarKemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230529070930.37949-1-luhongfei@vivo.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 745f17a4
...@@ -111,10 +111,8 @@ static unsigned ext4_num_overhead_clusters(struct super_block *sb, ...@@ -111,10 +111,8 @@ static unsigned ext4_num_overhead_clusters(struct super_block *sb,
itbl_blk_start = ext4_inode_table(sb, gdp); itbl_blk_start = ext4_inode_table(sb, gdp);
itbl_blk_end = itbl_blk_start + sbi->s_itb_per_group - 1; itbl_blk_end = itbl_blk_start + sbi->s_itb_per_group - 1;
if (itbl_blk_start <= end && itbl_blk_end >= start) { if (itbl_blk_start <= end && itbl_blk_end >= start) {
itbl_blk_start = itbl_blk_start >= start ? itbl_blk_start = max(itbl_blk_start, start);
itbl_blk_start : start; itbl_blk_end = min(itbl_blk_end, end);
itbl_blk_end = itbl_blk_end <= end ?
itbl_blk_end : end;
itbl_cluster_start = EXT4_B2C(sbi, itbl_blk_start - start); itbl_cluster_start = EXT4_B2C(sbi, itbl_blk_start - start);
itbl_cluster_end = EXT4_B2C(sbi, itbl_blk_end - start); itbl_cluster_end = EXT4_B2C(sbi, itbl_blk_end - start);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment