From: George Hu <integral@archlinux.org>
To: wqu@suse.com
Cc: clm@fb.com, dsterba@suse.com, integral@archlinux.org,
josef@toxicpanda.com, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2] btrfs: replace nested usage of min & max with clamp in btrfs_compress_set_level()
Date: Sat, 28 Jun 2025 13:21:30 +0800 [thread overview]
Message-ID: <20250628052130.36111-1-integral@archlinux.org> (raw)
In-Reply-To: <669773b7-4428-43ca-ab80-d7ed1c71886c@suse.com>
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.
Signed-off-by: George Hu <integral@archlinux.org>
---
fs/btrfs/compression.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 48d07939fee4..be8d51c53f39 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;
}
--
2.50.0
next prev parent reply other threads:[~2025-06-28 5:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-28 4:32 [PATCH] " George Hu
2025-06-28 4:48 ` Qu Wenruo
2025-06-28 5:21 ` George Hu [this message]
2025-06-28 5:26 ` [PATCH v2] " Qu Wenruo
2025-06-30 16:12 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250628052130.36111-1-integral@archlinux.org \
--to=integral@archlinux.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®