summaryrefslogtreecommitdiff
path: root/fs/bcachefs/ec.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-01-17 16:45:19 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:51 -0400
commit6e53151b7b738fe60b9295c2ff47e6b2092718b1 (patch)
treecd7f04741e5638fa69dd33aba36b2d9538400ea6 /fs/bcachefs/ec.c
parenta39c74be8059be72fcf6c7cc2f827c38076a25db (diff)
downloadlwn-6e53151b7b738fe60b9295c2ff47e6b2092718b1.tar.gz
lwn-6e53151b7b738fe60b9295c2ff47e6b2092718b1.zip
bcachefs: Kill stripe->dirty
This makes bch2_stripes_write() work more like bch2_alloc_write(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r--fs/bcachefs/ec.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index 1f125ce77e4f..0d9a27726c05 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -1466,7 +1466,7 @@ static int __bch2_stripe_write_key(struct btree_trans *trans,
size_t idx,
struct bkey_i_stripe *new_key)
{
- struct bch_fs *c = trans->c;
+ const struct bch_stripe *v;
struct bkey_s_c k;
unsigned i;
int ret;
@@ -1481,16 +1481,17 @@ static int __bch2_stripe_write_key(struct btree_trans *trans,
if (k.k->type != KEY_TYPE_stripe)
return -EIO;
+ v = bkey_s_c_to_stripe(k).v;
+ for (i = 0; i < v->nr_blocks; i++)
+ if (m->block_sectors[i] != stripe_blockcount_get(v, i))
+ goto write;
+ return 0;
+write:
bkey_reassemble(&new_key->k_i, k);
- spin_lock(&c->ec_stripes_heap_lock);
-
for (i = 0; i < new_key->v.nr_blocks; i++)
stripe_blockcount_set(&new_key->v, i,
m->block_sectors[i]);
- m->dirty = false;
-
- spin_unlock(&c->ec_stripes_heap_lock);
bch2_trans_update(trans, iter, &new_key->k_i, 0);
return 0;
@@ -1514,7 +1515,7 @@ int bch2_stripes_write(struct bch_fs *c, unsigned flags)
BTREE_ITER_SLOTS|BTREE_ITER_INTENT);
genradix_for_each(&c->stripes[0], giter, m) {
- if (!m->dirty)
+ if (!m->alive)
continue;
ret = __bch2_trans_do(&trans, NULL, NULL,