diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-12-05 00:30:49 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:18 -0400 |
commit | 94a3e1a6c1bd441b58972ee0216593fc0b09ee75 (patch) | |
tree | c1c51180768769af2f00c7653122329c85b4f93c /fs/bcachefs/buckets.c | |
parent | 1d81313f22205bfd844bd2e13e7e3ea5d50cd673 (diff) | |
download | lwn-94a3e1a6c1bd441b58972ee0216593fc0b09ee75.tar.gz lwn-94a3e1a6c1bd441b58972ee0216593fc0b09ee75.zip |
bcachefs: bch2_trans_update() is now __must_check
With snapshots, bch2_trans_update() has to check if we need a whitout,
which can cause a transaction restart, so this is important now.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 66f072905173..ef018c27d276 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1549,7 +1549,9 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans, goto out; bch2_alloc_pack(c, a, u); - bch2_trans_update(trans, &iter, &a->k, 0); + ret = bch2_trans_update(trans, &iter, &a->k, 0); + if (ret) + goto out; out: bch2_trans_iter_exit(trans, &iter); return ret; @@ -1600,7 +1602,9 @@ static int bch2_trans_mark_stripe_ptr(struct btree_trans *trans, stripe_blockcount_set(&s->v, p.ec.block, stripe_blockcount_get(&s->v, p.ec.block) + sectors); - bch2_trans_update(trans, &iter, &s->k_i, 0); + ret = bch2_trans_update(trans, &iter, &s->k_i, 0); + if (ret) + goto err; bch2_bkey_to_replicas(&r.e, bkey_i_to_s_c(&s->k_i)); r.e.data_type = data_type; @@ -1738,7 +1742,9 @@ static int bch2_trans_mark_stripe_bucket(struct btree_trans *trans, u.data_type = !deleting ? data_type : 0; bch2_alloc_pack(c, a, u); - bch2_trans_update(trans, &iter, &a->k, 0); + ret = bch2_trans_update(trans, &iter, &a->k, 0); + if (ret) + goto err; err: bch2_trans_iter_exit(trans, &iter); return ret; @@ -2017,7 +2023,9 @@ static int __bch2_trans_mark_metadata_bucket(struct btree_trans *trans, u.dirty_sectors = sectors; bch2_alloc_pack(c, a, u); - bch2_trans_update(trans, &iter, &a->k, 0); + ret = bch2_trans_update(trans, &iter, &a->k, 0); + if (ret) + goto out; out: bch2_trans_iter_exit(trans, &iter); return ret; |