linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs: replace min & max with clamp() in xfs_max_open_zones()
@ 2025-07-12 14:57 George Hu
  2025-07-14  5:55 ` Christoph Hellwig
  2025-07-14  7:58 ` John Garry
  0 siblings, 2 replies; 5+ messages in thread
From: George Hu @ 2025-07-12 14:57 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs, linux-kernel, George Hu

Refactor the xfs_max_open_zones() function by replacing the usage
of min() and max() macro with clamp() to simplify the code and
improve readability.

Signed-off-by: George Hu <integral@archlinux.org>
---
 fs/xfs/xfs_zone_alloc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 01315ed75502..58997afb1a14 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -1133,9 +1133,7 @@ xfs_max_open_zones(
 	/*
 	 * Cap the max open limit to 1/4 of available space
 	 */
-	max_open = min(max_open, mp->m_sb.sb_rgcount / 4);
-
-	return max(XFS_MIN_OPEN_ZONES, max_open);
+	return clamp(max_open, XFS_MIN_OPEN_ZONES, mp->m_sb.sb_rgcount / 4);
 }
 
 /*
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-15  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12 14:57 [PATCH] xfs: replace min & max with clamp() in xfs_max_open_zones() George Hu
2025-07-14  5:55 ` Christoph Hellwig
2025-07-14  7:58 ` John Garry
2025-07-14 10:59   ` Christoph Hellwig
2025-07-15  9:49     ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).