mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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>
This commit is contained in:
committed by
Theodore Ts'o
parent
1534f72dc2
commit
981b696faf
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user