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: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Lu Fengqi 2018-08-04 21:10:57 +08:00 committed by David Sterba
parent 3a58417486
commit 684572df94
5 changed files with 10 additions and 14 deletions

View file

@ -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,

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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) {