Commit 684572df authored by Lu Fengqi's avatar Lu Fengqi Committed by David Sterba

btrfs: Remove root parameter from btrfs_insert_dir_item

All callers pass the root tree of dir, we can push that down to the
function itself.
Signed-off-by: default avatarLu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 3a584174
...@@ -3021,8 +3021,7 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info, ...@@ -3021,8 +3021,7 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
/* dir-item.c */ /* dir-item.c */
int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir, int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
const char *name, int name_len); const char *name, int name_len);
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, const char *name,
struct btrfs_root *root, const char *name,
int name_len, struct btrfs_inode *dir, int name_len, struct btrfs_inode *dir,
struct btrfs_key *location, u8 type, u64 index); struct btrfs_key *location, u8 type, u64 index);
struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
......
...@@ -105,13 +105,13 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans, ...@@ -105,13 +105,13 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
* to use for the second index (if one is created). * to use for the second index (if one is created).
* Will return 0 or -ENOMEM * Will return 0 or -ENOMEM
*/ */
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, const char *name,
*root, const char *name, int name_len, int name_len, struct btrfs_inode *dir,
struct btrfs_inode *dir, struct btrfs_key *location, struct btrfs_key *location, u8 type, u64 index)
u8 type, u64 index)
{ {
int ret = 0; int ret = 0;
int ret2 = 0; int ret2 = 0;
struct btrfs_root *root = dir->root;
struct btrfs_path *path; struct btrfs_path *path;
struct btrfs_dir_item *dir_item; struct btrfs_dir_item *dir_item;
struct extent_buffer *leaf; struct extent_buffer *leaf;
......
...@@ -6389,8 +6389,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans, ...@@ -6389,8 +6389,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
if (ret) if (ret)
return ret; return ret;
ret = btrfs_insert_dir_item(trans, root, name, name_len, ret = btrfs_insert_dir_item(trans, name, name_len, parent_inode, &key,
parent_inode, &key,
btrfs_inode_type(&inode->vfs_inode), index); btrfs_inode_type(&inode->vfs_inode), index);
if (ret == -EEXIST || ret == -EOVERFLOW) if (ret == -EEXIST || ret == -EOVERFLOW)
goto fail_dir_item; goto fail_dir_item;
......
...@@ -686,8 +686,7 @@ static noinline int create_subvol(struct inode *dir, ...@@ -686,8 +686,7 @@ static noinline int create_subvol(struct inode *dir,
goto fail; goto fail;
} }
ret = btrfs_insert_dir_item(trans, root, ret = btrfs_insert_dir_item(trans, name, namelen, BTRFS_I(dir), &key,
name, namelen, BTRFS_I(dir), &key,
BTRFS_FT_DIR, index); BTRFS_FT_DIR, index);
if (ret) { if (ret) {
btrfs_abort_transaction(trans, ret); btrfs_abort_transaction(trans, ret);
......
...@@ -1613,10 +1613,9 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, ...@@ -1613,10 +1613,9 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
if (ret < 0) if (ret < 0)
goto fail; goto fail;
ret = btrfs_insert_dir_item(trans, parent_root, ret = btrfs_insert_dir_item(trans, dentry->d_name.name,
dentry->d_name.name, dentry->d_name.len, dentry->d_name.len, BTRFS_I(parent_inode),
BTRFS_I(parent_inode), &key, &key, BTRFS_FT_DIR, index);
BTRFS_FT_DIR, index);
/* We have check then name at the beginning, so it is impossible. */ /* We have check then name at the beginning, so it is impossible. */
BUG_ON(ret == -EEXIST || ret == -EOVERFLOW); BUG_ON(ret == -EEXIST || ret == -EOVERFLOW);
if (ret) { if (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