]> www.infradead.org Git - users/hch/misc.git/commitdiff
bcachefs: target_congested -> get_random_u32_below()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 13 Mar 2025 13:56:07 +0000 (09:56 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 13 Mar 2025 16:39:21 +0000 (12:39 -0400)
get_random_u32_below() has a better algorithm than bch2_rand_range(),
it just didn't exist at the time.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/io_read.c

index 726da68073e2b807d05153050b6f8be7ac6adce5..aa91fcf51eecc93551983ee289cb1419665d5d2f 100644 (file)
@@ -59,7 +59,7 @@ static bool bch2_target_congested(struct bch_fs *c, u16 target)
        }
        rcu_read_unlock();
 
-       return bch2_rand_range(nr * CONGESTED_MAX) < total;
+       return get_random_u32_below(nr * CONGESTED_MAX) < total;
 }
 
 #else