summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-11-01 15:13:19 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:11 -0400
commitcd575ddf57af004913ff5a994aa5f3203216fa68 (patch)
tree15fafb5d59b359aef897a2296f1ce7f8bc33f55a /fs/bcachefs/alloc_background.c
parent91f8b5677b5d831cff34b25ef03322ae49e03256 (diff)
downloadlinux-cd575ddf57af004913ff5a994aa5f3203216fa68.tar.gz
linux-cd575ddf57af004913ff5a994aa5f3203216fa68.tar.bz2
linux-cd575ddf57af004913ff5a994aa5f3203216fa68.zip
bcachefs: Erasure coding
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 291d352ee370..b49d0cd84b78 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -10,6 +10,7 @@
#include "buckets.h"
#include "clock.h"
#include "debug.h"
+#include "ec.h"
#include "error.h"
#include "journal_io.h"
#include "trace.h"
@@ -1113,6 +1114,24 @@ void bch2_dev_allocator_remove(struct bch_fs *c, struct bch_dev *ca)
}
mutex_unlock(&c->btree_reserve_cache_lock);
+ while (1) {
+ struct open_bucket *ob;
+
+ spin_lock(&c->freelist_lock);
+ if (!ca->open_buckets_partial_nr) {
+ spin_unlock(&c->freelist_lock);
+ break;
+ }
+ ob = c->open_buckets +
+ ca->open_buckets_partial[--ca->open_buckets_partial_nr];
+ ob->on_partial_list = false;
+ spin_unlock(&c->freelist_lock);
+
+ bch2_open_bucket_put(c, ob);
+ }
+
+ bch2_ec_stop_dev(c, ca);
+
/*
* Wake up threads that were blocked on allocation, so they can notice
* the device can no longer be removed and the capacity has changed: