Linux bcachefs list
 help / color / mirror / Atom feed
* [PATCH] bcachefs: Use max() to improve gen_after()
@ 2025-03-11 11:13 Thorsten Blum
  2025-03-11 14:29 ` Kent Overstreet
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-03-11 11:13 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: Thorsten Blum, linux-bcachefs, linux-kernel

Use max() to simplify gen_after() and improve its readability.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 fs/bcachefs/buckets.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h
index a9acdd6c0c86..124ac380b22e 100644
--- a/fs/bcachefs/buckets.h
+++ b/fs/bcachefs/buckets.h
@@ -167,9 +167,7 @@ static inline int gen_cmp(u8 a, u8 b)
 
 static inline int gen_after(u8 a, u8 b)
 {
-	int r = gen_cmp(a, b);
-
-	return r > 0 ? r : 0;
+	return max(0, gen_cmp(a, b));
 }
 
 static inline int dev_ptr_stale_rcu(struct bch_dev *ca, const struct bch_extent_ptr *ptr)
-- 
2.48.1


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

end of thread, other threads:[~2025-03-11 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 11:13 [PATCH] bcachefs: Use max() to improve gen_after() Thorsten Blum
2025-03-11 14:29 ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox