summaryrefslogtreecommitdiff
path: root/libbcachefs/rebalance.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-29 22:00:41 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-29 22:00:41 -0500
commit46d51608693bddac162232133516e975f3b1e835 (patch)
treeb72d55ddbd36864b3011a0093aa76596e1c1b7a9 /libbcachefs/rebalance.c
parent314ce7d963efe13756e4cd2bb008e02b6afdcb80 (diff)
Update bcachefs sources to eb83f1f842bb mean and variance: Promote to lib/math
Diffstat (limited to 'libbcachefs/rebalance.c')
-rw-r--r--libbcachefs/rebalance.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libbcachefs/rebalance.c b/libbcachefs/rebalance.c
index fefa4395..79bd4ad0 100644
--- a/libbcachefs/rebalance.c
+++ b/libbcachefs/rebalance.c
@@ -331,8 +331,16 @@ static int do_rebalance(struct moving_context *ctxt)
BTREE_ID_rebalance_work, POS_MIN,
BTREE_ITER_ALL_SNAPSHOTS);
- while (!bch2_move_ratelimit(ctxt) &&
- !kthread_wait_freezable(r->enabled)) {
+ while (!bch2_move_ratelimit(ctxt)) {
+ if (!r->enabled) {
+ bch2_moving_ctxt_flush_all(ctxt);
+ kthread_wait_freezable(c->copy_gc_enabled ||
+ kthread_should_stop());
+ }
+
+ if (kthread_should_stop())
+ break;
+
bch2_trans_begin(trans);
ret = bkey_err(k = next_rebalance_entry(trans, &rebalance_work_iter));