Commit 7c909f65 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix repair path in bch2_mark_reflink_p()

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 0329631c
...@@ -1213,17 +1213,23 @@ static s64 __bch2_mark_reflink_p(struct btree_trans *trans, ...@@ -1213,17 +1213,23 @@ static s64 __bch2_mark_reflink_p(struct btree_trans *trans,
" missing range %llu-%llu", " missing range %llu-%llu",
(bch2_bkey_val_to_text(&buf, c, p.s_c), buf.buf), (bch2_bkey_val_to_text(&buf, c, p.s_c), buf.buf),
*idx, next_idx)) { *idx, next_idx)) {
struct bkey_i_error new; struct bkey_i_error *new;
bkey_init(&new.k); new = bch2_trans_kmalloc(trans, sizeof(*new));
new.k.type = KEY_TYPE_error; ret = PTR_ERR_OR_ZERO(new);
new.k.p = bkey_start_pos(p.k); if (ret)
new.k.p.offset += *idx - start; goto err;
bch2_key_resize(&new.k, next_idx - *idx);
ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new.k_i); bkey_init(&new->k);
new->k.type = KEY_TYPE_error;
new->k.p = bkey_start_pos(p.k);
new->k.p.offset += *idx - start;
bch2_key_resize(&new->k, next_idx - *idx);
ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new->k_i);
} }
*idx = next_idx; *idx = next_idx;
err:
fsck_err: fsck_err:
printbuf_exit(&buf); printbuf_exit(&buf);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment