diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-30 13:15:36 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-04 14:17:11 -0400 |
commit | 1f7056b735d59843faee70f504f71e1fbffc51d8 (patch) | |
tree | 750329cbbdf53b838d4413141c6ab172efdef3c2 /fs/bcachefs/rebalance.c | |
parent | dc7a15fb90bf658be8289c9540c11f50993d10ff (diff) |
bcachefs: Ensure copygc does not spin
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.c | 10 |
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); |