diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-06-25 08:34:45 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:10:05 +0300 |
commit | 75da97640a75878cd197f6dd9c50b46cac6cb9a8 (patch) | |
tree | bcbdba9ef6df3db4a269457f7b7bc6620d40b0a1 /fs | |
parent | 454377d8432fdfaa5ebfca05a9bfa3af311d5b9a (diff) | |
download | linux-75da97640a75878cd197f6dd9c50b46cac6cb9a8.tar.xz |
bcachefs: fsck needs BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE
A few fsck paths weren't using BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE -
oops.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/fsck.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index 40804012a990..3503dabe3871 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -191,17 +191,18 @@ static int __write_inode(struct btree_trans *trans, struct bch_inode_unpacked *inode, u32 snapshot) { - struct btree_iter iter; - int ret; + struct bkey_inode_buf *inode_p = + bch2_trans_kmalloc(trans, sizeof(*inode_p)); - bch2_trans_iter_init(trans, &iter, BTREE_ID_inodes, - SPOS(0, inode->bi_inum, snapshot), - BTREE_ITER_INTENT); + if (IS_ERR(inode_p)) + return PTR_ERR(inode_p); - ret = bch2_btree_iter_traverse(&iter) ?: - bch2_inode_write(trans, &iter, inode); - bch2_trans_iter_exit(trans, &iter); - return ret; + bch2_inode_pack(inode_p, inode); + inode_p->inode.k.p.snapshot = snapshot; + + 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, @@ -1201,7 +1202,8 @@ static int check_overlapping_extents(struct btree_trans *trans, if ((ret = PTR_ERR_OR_ZERO(update))) goto err; 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) goto err; } |