diff options
author | Xichao Zhao <zhao.xichao@vivo.com> | 2025-08-18 15:28:59 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2025-09-25 14:35:21 -0400 |
commit | 981b696faf2d59a58d1dc8e258bba00b12e5de93 (patch) | |
tree | 02e3b4bafa012f6b6f89cfa6532d0da7f1e9022f | |
parent | 1534f72dc2a11ded38b0e0268fbcc0ca24e9fd4a (diff) |
ext4: replace min/max nesting with clamp()
The clamp() macro explicitly expresses the intent of constraining a value
within bounds.Therefore, replacing max(min(a,b),c) with clamp(val, lo, hi)
can improve code readability.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | fs/ext4/mmp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index 51661570cf3b..ab1ff51302fb 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -231,9 +231,9 @@ static int kmmpd(void *data) * Adjust the mmp_check_interval depending on how much time * it took for the MMP block to be written. */ - mmp_check_interval = max(min(EXT4_MMP_CHECK_MULT * diff / HZ, - EXT4_MMP_MAX_CHECK_INTERVAL), - EXT4_MMP_MIN_CHECK_INTERVAL); + mmp_check_interval = clamp(EXT4_MMP_CHECK_MULT * diff / HZ, + EXT4_MMP_MIN_CHECK_INTERVAL, + EXT4_MMP_MAX_CHECK_INTERVAL); mmp->mmp_check_interval = cpu_to_le16(mmp_check_interval); } |