diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-10-23 18:40:30 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2020-11-05 12:45:13 -0500 |
commit | 524562a525d8b3f076b211e2b487ebeef31a2587 (patch) | |
tree | 53b3d24497e57ba45431071f0b86a66ad0bfc3ff | |
parent | 73d6e13a096493a809ecf2d4c4e8e51fae00d003 (diff) |
bcachefs: Fix bch2_mark_stripe()
There's no reason not to always recalculate these fields
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/buckets.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 99aeba1deb0a..c8e8e978d143 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1265,6 +1265,13 @@ static int bch2_mark_stripe(struct bch_fs *c, m->algorithm = new_s->algorithm; m->nr_blocks = new_s->nr_blocks; m->nr_redundant = new_s->nr_redundant; + m->blocks_nonempty = 0; + + for (i = 0; i < new_s->nr_blocks; i++) { + m->block_sectors[i] = + stripe_blockcount_get(new_s, i); + m->blocks_nonempty += !!m->block_sectors[i]; + } if (gc && old_s) update_replicas(c, fs_usage, &m->r.e, @@ -1276,17 +1283,6 @@ static int bch2_mark_stripe(struct bch_fs *c, update_replicas(c, fs_usage, &m->r.e, ((s64) m->sectors * m->nr_redundant)); - /* gc recalculates these fields: */ - if (!(flags & BTREE_TRIGGER_GC)) { - m->blocks_nonempty = 0; - - for (i = 0; i < new_s->nr_blocks; i++) { - m->block_sectors[i] = - stripe_blockcount_get(new_s, i); - m->blocks_nonempty += !!m->block_sectors[i]; - } - } - if (!gc) { spin_lock(&c->ec_stripes_heap_lock); bch2_stripes_heap_update(c, m, idx); |