summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-30 20:15:36 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-04 21:17:11 +0300
commit1f7056b735d59843faee70f504f71e1fbffc51d8 (patch)
tree750329cbbdf53b838d4413141c6ab172efdef3c2 /fs/bcachefs/alloc_background.c
parentdc7a15fb90bf658be8289c9540c11f50993d10ff (diff)
downloadlinux-1f7056b735d59843faee70f504f71e1fbffc51d8.tar.xz
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/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index c342ec3b0385..bcfae91667af 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -2085,6 +2085,17 @@ void bch2_recalc_capacity(struct bch_fs *c)
closure_wake_up(&c->freelist_wait);
}
+u64 bch2_min_rw_member_capacity(struct bch_fs *c)
+{
+ struct bch_dev *ca;
+ unsigned i;
+ u64 ret = U64_MAX;
+
+ for_each_rw_member(ca, c, i)
+ ret = min(ret, ca->mi.nbuckets * ca->mi.bucket_size);
+ return ret;
+}
+
static bool bch2_dev_has_open_write_point(struct bch_fs *c, struct bch_dev *ca)
{
struct open_bucket *ob;