summaryrefslogtreecommitdiff
path: root/libbcachefs/io_write.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-06-03 17:03:54 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-06-03 20:08:06 -0400
commit7d79fba1af3d41b148009d3dc76d813b07f01f69 (patch)
treebee9ba49d247a1c74d1c1e7c9c14b37a243bba89 /libbcachefs/io_write.c
parentd456f9e97aebe649a59cc2858d5f28749b77d1d0 (diff)
Update bcachefs sources to f81dc88f0c80 bcachefs: bch2_btree_insert() - add btree iter flags
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/io_write.c')
-rw-r--r--libbcachefs/io_write.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libbcachefs/io_write.c b/libbcachefs/io_write.c
index 9401d13e..db9cda7b 100644
--- a/libbcachefs/io_write.c
+++ b/libbcachefs/io_write.c
@@ -69,11 +69,10 @@ void bch2_latency_acct(struct bch_dev *ca, u64 submit_time, int rw)
u64 io_latency = time_after64(now, submit_time)
? now - submit_time
: 0;
- u64 old, new, v = atomic64_read(latency);
+ u64 old, new;
+ old = atomic64_read(latency);
do {
- old = v;
-
/*
* If the io latency was reasonably close to the current
* latency, skip doing the update and atomic operation - most of
@@ -84,7 +83,7 @@ void bch2_latency_acct(struct bch_dev *ca, u64 submit_time, int rw)
break;
new = ewma_add(old, io_latency, 5);
- } while ((v = atomic64_cmpxchg(latency, old, new)) != old);
+ } while (!atomic64_try_cmpxchg(latency, &old, new));
bch2_congested_acct(ca, io_latency, now, rw);