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 <wqu@suse.com>
Signed-off-by: George Hu <integral@archlinux.org>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
George Hu
2025-06-28 13:21:30 +08:00
committed by David Sterba
parent 2fb5e56f52
commit afd1dacbd0
+1 -1
View File
@@ -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;
}