summaryrefslogtreecommitdiff
path: root/libbcachefs/rebalance.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-05-14 21:46:09 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2020-05-14 21:48:52 -0400
commit34c9be19b376a007041555a7c9a47dfef3d0b1e6 (patch)
tree3ae88a4104761592131d7aaa98b8a9ca9044ac22 /libbcachefs/rebalance.c
parent024a01bf077a6f887b82fb74b7bd252a350dfa30 (diff)
Update bcachefs sources to e1f6739c4a bcachefs: Fix another iterator counting bug
Diffstat (limited to 'libbcachefs/rebalance.c')
-rw-r--r--libbcachefs/rebalance.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libbcachefs/rebalance.c b/libbcachefs/rebalance.c
index ab193432..e15a2b1d 100644
--- a/libbcachefs/rebalance.c
+++ b/libbcachefs/rebalance.c
@@ -204,17 +204,21 @@ static int bch2_rebalance_thread(void *arg)
prev_run_time;
if (w.dev_most_full_percent < 20 && throttle > 0) {
- r->state = REBALANCE_THROTTLED;
r->throttled_until_iotime = io_start +
div_u64(w.dev_most_full_capacity *
(20 - w.dev_most_full_percent),
50);
- r->throttled_until_cputime = start + throttle;
- bch2_kthread_io_clock_wait(clock,
- r->throttled_until_iotime,
- throttle);
- continue;
+ if (atomic_long_read(&clock->now) + clock->max_slop <
+ r->throttled_until_iotime) {
+ r->throttled_until_cputime = start + throttle;
+ r->state = REBALANCE_THROTTLED;
+
+ bch2_kthread_io_clock_wait(clock,
+ r->throttled_until_iotime,
+ throttle);
+ continue;
+ }
}
/* minimum 1 mb/sec: */