summaryrefslogtreecommitdiff
path: root/fs/bcachefs/rebalance.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-30 13:15:36 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-30 13:51:47 -0400
commit08398d3534d8cdba7d90d2e37ac8bdb3e143dedf (patch)
tree5958532877643e1ca12e949416dc43360d4b4a86 /fs/bcachefs/rebalance.c
parent6628827a87075d3f807c974045ed293ac1e8965b (diff)
bcachefs: Ensure copygc does not spinbcachefs-v6.5
If copygc does no work - finds no fragmented buckets - wait for a bit of IO to happen. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/rebalance.c')
-rw-r--r--fs/bcachefs/rebalance.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c
index 6ee4d2e02073..82014cc6e271 100644
--- a/fs/bcachefs/rebalance.c
+++ b/fs/bcachefs/rebalance.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h"
+#include "alloc_background.h"
#include "alloc_foreground.h"
#include "btree_iter.h"
#include "btree_update.h"
@@ -282,15 +283,12 @@ static int do_rebalance_scan(struct moving_context *ctxt, u64 inum, u64 cookie)
static void rebalance_wait(struct bch_fs *c)
{
struct bch_fs_rebalance *r = &c->rebalance;
- struct bch_dev *ca;
struct io_clock *clock = &c->io_clock[WRITE];
u64 now = atomic64_read(&clock->now);
- u64 min_member_capacity = 128 * 2048;
- unsigned i;
+ u64 min_member_capacity = bch2_min_rw_member_capacity(c);
- for_each_rw_member(ca, c, i)
- min_member_capacity = min(min_member_capacity,
- ca->mi.nbuckets * ca->mi.bucket_size);
+ if (min_member_capacity == U64_MAX)
+ min_member_capacity = 128 * 2048;
r->wait_iotime_end = now + (min_member_capacity >> 6);