Commit 75da9764 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: fsck needs BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE

A few fsck paths weren't using BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE -
oops.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 454377d8
...@@ -191,17 +191,18 @@ static int __write_inode(struct btree_trans *trans, ...@@ -191,17 +191,18 @@ static int __write_inode(struct btree_trans *trans,
struct bch_inode_unpacked *inode, struct bch_inode_unpacked *inode,
u32 snapshot) u32 snapshot)
{ {
struct btree_iter iter; struct bkey_inode_buf *inode_p =
int ret; bch2_trans_kmalloc(trans, sizeof(*inode_p));
bch2_trans_iter_init(trans, &iter, BTREE_ID_inodes, if (IS_ERR(inode_p))
SPOS(0, inode->bi_inum, snapshot), return PTR_ERR(inode_p);
BTREE_ITER_INTENT);
ret = bch2_btree_iter_traverse(&iter) ?: bch2_inode_pack(inode_p, inode);
bch2_inode_write(trans, &iter, inode); inode_p->inode.k.p.snapshot = snapshot;
bch2_trans_iter_exit(trans, &iter);
return ret; return bch2_btree_insert_nonextent(trans, BTREE_ID_inodes,
&inode_p->inode.k_i,
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE);
} }
static int write_inode(struct btree_trans *trans, static int write_inode(struct btree_trans *trans,
...@@ -1201,7 +1202,8 @@ static int check_overlapping_extents(struct btree_trans *trans, ...@@ -1201,7 +1202,8 @@ static int check_overlapping_extents(struct btree_trans *trans,
if ((ret = PTR_ERR_OR_ZERO(update))) if ((ret = PTR_ERR_OR_ZERO(update)))
goto err; goto err;
bkey_reassemble(update, k); bkey_reassemble(update, k);
ret = bch2_trans_update_extent(trans, iter, update, 0); ret = bch2_trans_update_extent(trans, iter, update,
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE);
if (ret) if (ret)
goto err; goto err;
} }
......
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