summaryrefslogtreecommitdiff
path: root/fs/bcachefs/buckets.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-19 06:11:50 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:54 +0300
commit27616a31241e0625ee063f2cacd8c8e339b2de65 (patch)
treede3a0ccf8a385bcf762e5312007d0a254b4ff84e /fs/bcachefs/buckets.c
parent4b1e669995a6c19f1e1cc8a600101edf7fe9277e (diff)
downloadlinux-27616a31241e0625ee063f2cacd8c8e339b2de65.tar.xz
bcachefs: Simplify ec stripes heap
Now that we have a separate data structure for tracking open stripes, the stripes heap can track all existing stripes, which is a nice simplification. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r--fs/bcachefs/buckets.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index ddbf88a759f9..7c4780b3ceb5 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1031,7 +1031,7 @@ int bch2_mark_stripe(struct btree_trans *trans,
if (!gc) {
struct stripe *m = genradix_ptr(&c->stripes, idx);
- if (!m || (old_s && !m->alive)) {
+ if (!m) {
struct printbuf buf1 = PRINTBUF;
struct printbuf buf2 = PRINTBUF;
@@ -1047,13 +1047,10 @@ int bch2_mark_stripe(struct btree_trans *trans,
}
if (!new_s) {
- mutex_lock(&c->ec_stripes_heap_lock);
bch2_stripes_heap_del(c, m, idx);
- mutex_unlock(&c->ec_stripes_heap_lock);
memset(m, 0, sizeof(*m));
} else {
- m->alive = true;
m->sectors = le16_to_cpu(new_s->sectors);
m->algorithm = new_s->algorithm;
m->nr_blocks = new_s->nr_blocks;
@@ -1063,9 +1060,10 @@ int bch2_mark_stripe(struct btree_trans *trans,
for (i = 0; i < new_s->nr_blocks; i++)
m->blocks_nonempty += !!stripe_blockcount_get(new_s, i);
- mutex_lock(&c->ec_stripes_heap_lock);
- bch2_stripes_heap_update(c, m, idx);
- mutex_unlock(&c->ec_stripes_heap_lock);
+ if (!old_s)
+ bch2_stripes_heap_insert(c, m, idx);
+ else
+ bch2_stripes_heap_update(c, m, idx);
}
} else {
struct gc_stripe *m =