summaryrefslogtreecommitdiff
path: root/fs/bcachefs/reflink.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-06-14 18:16:10 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:06 -0400
commit8c3f6da9fc526e7ba0f6449efa1040084406e9ba (patch)
tree6106b0097c188e1acb746de16468c28f095aad40 /fs/bcachefs/reflink.c
parentb89726ab86aab15ea8526fb365da6a0f5d474241 (diff)
bcachefs: Improve iter->should_be_locked
Adding iter->should_be_locked introduced a regression where it ended up not being set on the iterator passed to bch2_btree_update_start(), which is definitely not what we want. This patch requires it to be set when calling bch2_trans_update(), and adds various fixups to make that happen. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/reflink.c')
-rw-r--r--fs/bcachefs/reflink.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index ba700810a4be..ebf391245470 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -142,7 +142,7 @@ static int bch2_make_extent_indirect(struct btree_trans *trans,
goto err;
/* rewind iter to start of hole, if necessary: */
- bch2_btree_iter_set_pos(reflink_iter, bkey_start_pos(k.k));
+ bch2_btree_iter_set_pos_to_extent_start(reflink_iter);
r_v = bch2_trans_kmalloc(trans, sizeof(__le64) + bkey_bytes(&orig->k));
ret = PTR_ERR_OR_ZERO(r_v);
@@ -257,11 +257,11 @@ s64 bch2_remap_range(struct bch_fs *c,
}
if (src_k.k->type != KEY_TYPE_reflink_p) {
+ bch2_btree_iter_set_pos_to_extent_start(src_iter);
+
bch2_bkey_buf_reassemble(&new_src, c, src_k);
src_k = bkey_i_to_s_c(new_src.k);
- bch2_btree_iter_set_pos(src_iter, bkey_start_pos(src_k.k));
-
ret = bch2_make_extent_indirect(&trans, src_iter,
new_src.k);
if (ret)