mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
bcachefs: Bias reads more in favor of faster device
Per reports of performance issues on mixed multi device filesystems where we're issuing too much IO to the spinning rust - tweak this algorithm. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f4d67f6d5a
commit
e1cb4f56dc
|
|
@ -89,6 +89,14 @@ static inline bool ptr_better(struct bch_fs *c,
|
|||
u64 l1 = dev_latency(c, p1.ptr.dev);
|
||||
u64 l2 = dev_latency(c, p2.ptr.dev);
|
||||
|
||||
/*
|
||||
* Square the latencies, to bias more in favor of the faster
|
||||
* device - we never want to stop issuing reads to the slower
|
||||
* device altogether, so that we can update our latency numbers:
|
||||
*/
|
||||
l1 *= l1;
|
||||
l2 *= l2;
|
||||
|
||||
/* Pick at random, biased in favor of the faster device: */
|
||||
|
||||
return bch2_rand_range(l1 + l2) > l1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user