mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
bcachefs: Cleanup bch2_dirent_lookup_trans()
Drop an unnecessary bch2_subvolume_get_snapshot() call, and drop the __ from the name - this is a normal interface. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
23f2522315
commit
5b6271b509
@ -458,41 +458,29 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __bch2_dirent_lookup_trans(struct btree_trans *trans,
|
int bch2_dirent_lookup_trans(struct btree_trans *trans,
|
||||||
struct btree_iter *iter,
|
struct btree_iter *iter,
|
||||||
subvol_inum dir,
|
subvol_inum dir,
|
||||||
const struct bch_hash_info *hash_info,
|
const struct bch_hash_info *hash_info,
|
||||||
const struct qstr *name, subvol_inum *inum,
|
const struct qstr *name, subvol_inum *inum,
|
||||||
unsigned flags)
|
unsigned flags)
|
||||||
{
|
{
|
||||||
struct bkey_s_c k;
|
int ret = bch2_hash_lookup(trans, iter, bch2_dirent_hash_desc,
|
||||||
struct bkey_s_c_dirent d;
|
hash_info, dir, name, flags);
|
||||||
u32 snapshot;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = bch2_subvolume_get_snapshot(trans, dir.subvol, &snapshot);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = bch2_hash_lookup(trans, iter, bch2_dirent_hash_desc,
|
struct bkey_s_c k = bch2_btree_iter_peek_slot(iter);
|
||||||
hash_info, dir, name, flags);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
k = bch2_btree_iter_peek_slot(iter);
|
|
||||||
ret = bkey_err(k);
|
ret = bkey_err(k);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
d = bkey_s_c_to_dirent(k);
|
ret = bch2_dirent_read_target(trans, dir, bkey_s_c_to_dirent(k), inum);
|
||||||
|
|
||||||
ret = bch2_dirent_read_target(trans, dir, d, inum);
|
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
err:
|
err:
|
||||||
if (ret)
|
if (ret)
|
||||||
bch2_trans_iter_exit(trans, iter);
|
bch2_trans_iter_exit(trans, iter);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +492,7 @@ u64 bch2_dirent_lookup(struct bch_fs *c, subvol_inum dir,
|
|||||||
struct btree_iter iter = { NULL };
|
struct btree_iter iter = { NULL };
|
||||||
|
|
||||||
int ret = lockrestart_do(trans,
|
int ret = lockrestart_do(trans,
|
||||||
__bch2_dirent_lookup_trans(trans, &iter, dir, hash_info, name, inum, 0));
|
bch2_dirent_lookup_trans(trans, &iter, dir, hash_info, name, inum, 0));
|
||||||
bch2_trans_iter_exit(trans, &iter);
|
bch2_trans_iter_exit(trans, &iter);
|
||||||
bch2_trans_put(trans);
|
bch2_trans_put(trans);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -62,7 +62,7 @@ int bch2_dirent_rename(struct btree_trans *,
|
|||||||
const struct qstr *, subvol_inum *, u64 *,
|
const struct qstr *, subvol_inum *, u64 *,
|
||||||
enum bch_rename_mode);
|
enum bch_rename_mode);
|
||||||
|
|
||||||
int __bch2_dirent_lookup_trans(struct btree_trans *, struct btree_iter *,
|
int bch2_dirent_lookup_trans(struct btree_trans *, struct btree_iter *,
|
||||||
subvol_inum, const struct bch_hash_info *,
|
subvol_inum, const struct bch_hash_info *,
|
||||||
const struct qstr *, subvol_inum *, unsigned);
|
const struct qstr *, subvol_inum *, unsigned);
|
||||||
u64 bch2_dirent_lookup(struct bch_fs *, subvol_inum,
|
u64 bch2_dirent_lookup(struct bch_fs *, subvol_inum,
|
||||||
|
@ -260,8 +260,8 @@ int bch2_unlink_trans(struct btree_trans *trans,
|
|||||||
|
|
||||||
dir_hash = bch2_hash_info_init(c, dir_u);
|
dir_hash = bch2_hash_info_init(c, dir_u);
|
||||||
|
|
||||||
ret = __bch2_dirent_lookup_trans(trans, &dirent_iter, dir, &dir_hash,
|
ret = bch2_dirent_lookup_trans(trans, &dirent_iter, dir, &dir_hash,
|
||||||
name, &inum, BTREE_ITER_INTENT);
|
name, &inum, BTREE_ITER_INTENT);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user