summaryrefslogtreecommitdiff
path: root/libbcachefs/io_write.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-07-14 10:18:56 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-07-14 10:18:56 -0400
commite1e87f53cdfeb048747b1e6fa1d1a44b4a85376e (patch)
treeb12305759419a953d75bda42519091a816265350 /libbcachefs/io_write.c
parentb261da891a7d3bd8b9081b5814bfe9b7661e8ec7 (diff)
Update bcachefs sources to 4b5105c627f4 workqueue: Basic memory allocation profiling support
Diffstat (limited to 'libbcachefs/io_write.c')
-rw-r--r--libbcachefs/io_write.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libbcachefs/io_write.c b/libbcachefs/io_write.c
index fa077341..aedbea63 100644
--- a/libbcachefs/io_write.c
+++ b/libbcachefs/io_write.c
@@ -55,14 +55,9 @@ static inline void bch2_congested_acct(struct bch_dev *ca, u64 io_latency,
s64 latency_over = io_latency - latency_threshold;
if (latency_threshold && latency_over > 0) {
- /*
- * bump up congested by approximately latency_over * 4 /
- * latency_threshold - we don't need much accuracy here so don't
- * bother with the divide:
- */
if (atomic_read(&ca->congested) < CONGESTED_MAX)
- atomic_add(latency_over >>
- max_t(int, ilog2(latency_threshold) - 2, 0),
+ atomic_add((u32) min(U32_MAX, io_latency * 2) /
+ (u32) min(U32_MAX, latency_threshold),
&ca->congested);
ca->congested_last = now;