btrfs: Remove root parameter from btrfs_insert_dir_item
authorLu Fengqi <lufq.fnst@cn.fujitsu.com>
Sat, 4 Aug 2018 13:10:57 +0000 (21:10 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:25 +0000 (17:23 +0200)
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>
fs/btrfs/ctree.h
fs/btrfs/dir-item.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/transaction.c

index 3dd4d0cb0c7e7728dfbf99a5e72c6b549049a366..df260a9867be972ba714bc7be44c4bf14a1c9c80 100644 (file)
@@ -3021,8 +3021,7 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info,
 /* dir-item.c */
 int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
                          const char *name, int name_len);
-int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
-                         struct btrfs_root *root, const char *name,
+int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, const char *name,
                          int name_len, struct btrfs_inode *dir,
                          struct btrfs_key *location, u8 type, u64 index);
 struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
index a678b07fcf0160fae9ca2702c79a18930955a072..8de74d835dba46e0067ffd0b665486545bb5efd9 100644 (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).
  * Will return 0 or -ENOMEM
  */
-int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
-                         *root, const char *name, int name_len,
-                         struct btrfs_inode *dir, struct btrfs_key *location,
-                         u8 type, u64 index)
+int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, const char *name,
+                         int name_len, struct btrfs_inode *dir,
+                         struct btrfs_key *location, u8 type, u64 index)
 {
        int ret = 0;
        int ret2 = 0;
+       struct btrfs_root *root = dir->root;
        struct btrfs_path *path;
        struct btrfs_dir_item *dir_item;
        struct extent_buffer *leaf;
index bc3d0e0c43a5930c5d424f0af5dd1fb335a1c73f..a147e10b12ae6426ef739a80d7bf0505f50a6770 100644 (file)
@@ -6389,8 +6389,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
        if (ret)
                return ret;
 
-       ret = btrfs_insert_dir_item(trans, root, name, name_len,
-                                   parent_inode, &key,
+       ret = btrfs_insert_dir_item(trans, name, name_len, parent_inode, &key,
                                    btrfs_inode_type(&inode->vfs_inode), index);
        if (ret == -EEXIST || ret == -EOVERFLOW)
                goto fail_dir_item;
index d60b6caf09e857ef7c39e8ce337171d04cca1d72..1cf4decaee0dfaffa30025b3f76c2d5078a9c543 100644 (file)
@@ -686,8 +686,7 @@ static noinline int create_subvol(struct inode *dir,
                goto fail;
        }
 
-       ret = btrfs_insert_dir_item(trans, root,
-                                   name, namelen, BTRFS_I(dir), &key,
+       ret = btrfs_insert_dir_item(trans, name, namelen, BTRFS_I(dir), &key,
                                    BTRFS_FT_DIR, index);
        if (ret) {
                btrfs_abort_transaction(trans, ret);
index 3b84f50150299d6ddf7ce57617cde98282bf8214..bd784d8f52154b15857825bda60f569c435302bc 100644 (file)
@@ -1613,10 +1613,9 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
        if (ret < 0)
                goto fail;
 
-       ret = btrfs_insert_dir_item(trans, parent_root,
-                                   dentry->d_name.name, dentry->d_name.len,
-                                   BTRFS_I(parent_inode), &key,
-                                   BTRFS_FT_DIR, index);
+       ret = btrfs_insert_dir_item(trans, dentry->d_name.name,
+                                   dentry->d_name.len, BTRFS_I(parent_inode),
+                                   &key, BTRFS_FT_DIR, index);
        /* We have check then name at the beginning, so it is impossible. */
        BUG_ON(ret == -EEXIST || ret == -EOVERFLOW);
        if (ret) {