mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-26 15:54:18 +08:00
bcachefs: Fix fallocate FL_INSERT_RANGE
This was another bug because of bch2_btree_iter_set_pos() invalidating iterators. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
59a38a3844
commit
283eda5798
@ -2484,10 +2484,8 @@ reassemble:
|
||||
bkey_on_stack_reassemble(©, c, k);
|
||||
|
||||
if (insert &&
|
||||
bkey_cmp(bkey_start_pos(k.k), move_pos) < 0) {
|
||||
bkey_cmp(bkey_start_pos(k.k), move_pos) < 0)
|
||||
bch2_cut_front(move_pos, copy.k);
|
||||
bch2_btree_iter_set_pos(src, bkey_start_pos(©.k->k));
|
||||
}
|
||||
|
||||
copy.k->k.p.offset += shift >> 9;
|
||||
bch2_btree_iter_set_pos(dst, bkey_start_pos(©.k->k));
|
||||
@ -2507,8 +2505,9 @@ reassemble:
|
||||
}
|
||||
|
||||
bkey_init(&delete.k);
|
||||
delete.k.p = src->pos;
|
||||
bch2_key_resize(&delete.k, copy.k->k.size);
|
||||
delete.k.p = copy.k->k.p;
|
||||
delete.k.size = copy.k->k.size;
|
||||
delete.k.p.offset -= shift >> 9;
|
||||
|
||||
next_pos = insert ? bkey_start_pos(&delete.k) : delete.k.p;
|
||||
|
||||
@ -2529,6 +2528,8 @@ reassemble:
|
||||
BUG_ON(ret);
|
||||
}
|
||||
|
||||
bch2_btree_iter_set_pos(src, bkey_start_pos(&delete.k));
|
||||
|
||||
ret = bch2_trans_update(&trans, src, &delete, trigger_flags) ?:
|
||||
bch2_trans_update(&trans, dst, copy.k, trigger_flags) ?:
|
||||
bch2_trans_commit(&trans, &disk_res,
|
||||
|
Loading…
Reference in New Issue
Block a user