Commit 23f25223 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_hash_set_snapshot() -> bch2_hash_set_in_snapshot()

Minor renaming for clarity, bit of refactoring.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 6b83aee8
...@@ -219,7 +219,7 @@ int bch2_dirent_create_snapshot(struct btree_trans *trans, ...@@ -219,7 +219,7 @@ int bch2_dirent_create_snapshot(struct btree_trans *trans,
dirent->k.p.inode = dir; dirent->k.p.inode = dir;
dirent->k.p.snapshot = snapshot; dirent->k.p.snapshot = snapshot;
ret = bch2_hash_set_snapshot(trans, bch2_dirent_hash_desc, hash_info, ret = bch2_hash_set_in_snapshot(trans, bch2_dirent_hash_desc, hash_info,
zero_inum, snapshot, zero_inum, snapshot,
&dirent->k_i, str_hash_flags, &dirent->k_i, str_hash_flags,
BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE); BTREE_UPDATE_INTERNAL_SNAPSHOT_NODE);
......
...@@ -722,7 +722,7 @@ static int hash_redo_key(struct btree_trans *trans, ...@@ -722,7 +722,7 @@ static int hash_redo_key(struct btree_trans *trans,
delete->k.p = k_iter->pos; delete->k.p = k_iter->pos;
return bch2_btree_iter_traverse(k_iter) ?: return bch2_btree_iter_traverse(k_iter) ?:
bch2_trans_update(trans, k_iter, delete, 0) ?: bch2_trans_update(trans, k_iter, delete, 0) ?:
bch2_hash_set_snapshot(trans, desc, hash_info, bch2_hash_set_in_snapshot(trans, desc, hash_info,
(subvol_inum) { 0, k.k->p.inode }, (subvol_inum) { 0, k.k->p.inode },
k.k->p.snapshot, tmp, k.k->p.snapshot, tmp,
BCH_HASH_SET_MUST_CREATE, BCH_HASH_SET_MUST_CREATE,
...@@ -1778,7 +1778,6 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter, ...@@ -1778,7 +1778,6 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter,
if (d.v->d_type == DT_DIR) if (d.v->d_type == DT_DIR)
for_each_visible_inode(c, s, dir, equiv.snapshot, i) for_each_visible_inode(c, s, dir, equiv.snapshot, i)
i->count++; i->count++;
out: out:
err: err:
fsck_err: fsck_err:
......
...@@ -259,7 +259,7 @@ int bch2_hash_needs_whiteout(struct btree_trans *trans, ...@@ -259,7 +259,7 @@ int bch2_hash_needs_whiteout(struct btree_trans *trans,
} }
static __always_inline static __always_inline
int bch2_hash_set_snapshot(struct btree_trans *trans, int bch2_hash_set_in_snapshot(struct btree_trans *trans,
const struct bch_hash_desc desc, const struct bch_hash_desc desc,
const struct bch_hash_info *info, const struct bch_hash_info *info,
subvol_inum inum, u32 snapshot, subvol_inum inum, u32 snapshot,
...@@ -328,16 +328,11 @@ int bch2_hash_set(struct btree_trans *trans, ...@@ -328,16 +328,11 @@ int bch2_hash_set(struct btree_trans *trans,
struct bkey_i *insert, struct bkey_i *insert,
bch_str_hash_flags_t str_hash_flags) bch_str_hash_flags_t str_hash_flags)
{ {
u32 snapshot;
int ret;
ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
if (ret)
return ret;
insert->k.p.inode = inum.inum; insert->k.p.inode = inum.inum;
return bch2_hash_set_snapshot(trans, desc, info, inum, u32 snapshot;
return bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot) ?:
bch2_hash_set_in_snapshot(trans, desc, info, inum,
snapshot, insert, str_hash_flags, 0); snapshot, insert, str_hash_flags, 0);
} }
......
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