Skip to content

Commit

Permalink
bcachefs: target_congested -> get_random_u32_below()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kent Overstreet committed Mar 13, 2025
1 parent 3bcde88 commit 69a5a13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/bcachefs/io_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 69a5a13

Please sign in to comment.