diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-11-28 22:31:19 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:18 +0300 |
commit | 58e1ea4bcb057388636b0098524d6e0647eb40c2 (patch) | |
tree | 5ceb724ebe5e88fea1a99fe5e90bdaee6eda4aea /fs/bcachefs/ec.c | |
parent | 502cfb3591ec1f3d133c7eb281b8b93ca2bb2768 (diff) | |
download | linux-58e1ea4bcb057388636b0098524d6e0647eb40c2.tar.xz |
bcachefs: Push c->mark_lock usage down to where it is needed
This changes the bch2_mark_key() and related paths to take mark lock
where it is needed, instead of taking it in the upper transaction commit
path - by pushing down locking we'll be able to handle fsck errors
locally instead of requiring a separate check in the btree_gc code for
replicas being marked.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r-- | fs/bcachefs/ec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index 9624cd5e5ada..b8e9bc91bf0b 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -1635,12 +1635,16 @@ int bch2_stripes_write(struct bch_fs *c, unsigned flags) static int bch2_stripes_read_fn(struct btree_trans *trans, struct bkey_s_c k) { + struct bkey deleted = KEY(0, 0, 0); + struct bkey_s_c old = (struct bkey_s_c) { &deleted, NULL }; struct bch_fs *c = trans->c; int ret = 0; + deleted.p = k.k->p; + if (k.k->type == KEY_TYPE_stripe) ret = __ec_stripe_mem_alloc(c, k.k->p.offset, GFP_KERNEL) ?: - bch2_mark_key(trans, k, + bch2_mark_key(trans, old, k, BTREE_TRIGGER_NOATOMIC); return ret; |