From: George Hu Date: Sat, 28 Jun 2025 05:21:30 +0000 (+0800) Subject: btrfs: replace nested usage of min & max with clamp in btrfs_compress_set_level() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afd1dacbd0964c7d36a9057c39c168fe7fbb5196;p=thirdparty%2Flinux.git btrfs: replace nested usage of min & max with clamp in btrfs_compress_set_level() Refactor the btrfs_compress_set_level() function by replacing the nested usage of min() and max() macro with clamp() to simplify the code and improve readability. Reviewed-by: Qu Wenruo Signed-off-by: George Hu Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index a4934eb1ecdc9..6d3161bc77814 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -975,7 +975,7 @@ static int btrfs_compress_set_level(unsigned int type, int level) if (level == 0) level = ops->default_level; else - level = min(max(level, ops->min_level), ops->max_level); + level = clamp(level, ops->min_level, ops->max_level); return level; }