]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: Use max() to improve gen_after()
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 11 Mar 2025 11:13:11 +0000 (12:13 +0100)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 15 Mar 2025 01:02:16 +0000 (21:02 -0400)
Use max() to simplify gen_after() and improve its readability.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/buckets.h

index 6aeec1c0973ce9b468d471c1e543c6455f06aceb..c5363256e3638771eba5dc9a4e7689642a3f8037 100644 (file)
@@ -140,9 +140,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)