diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-04-27 23:48:33 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:01 -0400 |
commit | 34dfa5db191fe227c0c413624b7387f1f1804029 (patch) | |
tree | 44af501b23067b94c95d40191829a88917f7c08e /fs/bcachefs/buckets.c | |
parent | d67a16df9c5e03e3e4a672bd6547812baad0bf2c (diff) | |
download | lwn-34dfa5db191fe227c0c413624b7387f1f1804029.tar.gz lwn-34dfa5db191fe227c0c413624b7387f1f1804029.zip |
bcachefs: bch2_bkey_get_mut() improvements
- bch2_bkey_get_mut() now handles types increasing in size, allocating
a buffer for the type's current size when necessary
- bch2_bkey_make_mut_typed()
- bch2_bkey_get_mut() now initializes the iterator, like
bch2_bkey_get_iter()
Also, refactor so that most of the code is in functions - now macros are
only used for wrappers.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index f3cee8f2b793..00b60749daf8 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1448,10 +1448,9 @@ static int bch2_trans_mark_stripe_ptr(struct btree_trans *trans, struct bch_replicas_padded r; int ret = 0; - bch2_trans_iter_init(trans, &iter, BTREE_ID_stripes, POS(0, p.ec.idx), - BTREE_ITER_INTENT| - BTREE_ITER_WITH_UPDATES); - s = bch2_bkey_get_mut_typed(trans, &iter, stripe); + s = bch2_bkey_get_mut_typed(trans, &iter, + BTREE_ID_stripes, POS(0, p.ec.idx), + BTREE_ITER_WITH_UPDATES, stripe); ret = PTR_ERR_OR_ZERO(s); if (unlikely(ret)) { bch2_trans_inconsistent_on(ret == -ENOENT, trans, @@ -1750,10 +1749,9 @@ static int __bch2_trans_mark_reflink_p(struct btree_trans *trans, struct printbuf buf = PRINTBUF; int ret; - bch2_trans_iter_init(trans, &iter, BTREE_ID_reflink, POS(0, *idx), - BTREE_ITER_INTENT| - BTREE_ITER_WITH_UPDATES); - k = bch2_bkey_get_mut(trans, &iter); + k = bch2_bkey_get_mut(trans, &iter, + BTREE_ID_reflink, POS(0, *idx), + BTREE_ITER_WITH_UPDATES); ret = PTR_ERR_OR_ZERO(k); if (ret) goto err; |