aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/compression.c
diff options
context:
space:
mode:
authorGeorge Hu <[email protected]>2025-06-28 05:21:30 +0000
committerDavid Sterba <[email protected]>2025-07-21 21:58:05 +0000
commitafd1dacbd0964c7d36a9057c39c168fe7fbb5196 (patch)
tree36c84ed4384e14c6c56fba24fa13408af722dfd9 /fs/btrfs/compression.c
parentbtrfs: send: avoid extra calls to strlen() in gen_unique_name() (diff)
downloadkernel-afd1dacbd0964c7d36a9057c39c168fe7fbb5196.tar.gz
kernel-afd1dacbd0964c7d36a9057c39c168fe7fbb5196.zip
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 <[email protected]> Signed-off-by: George Hu <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r--fs/btrfs/compression.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index a4934eb1ecdc..6d3161bc7781 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;
}