Skip to content

Commit 4ea2fb9

Browse files
committed
btrfs: pass struct btrfs_inode to btrfs_iget_locked()
Pass a struct btrfs_inode to btrfs_inode() as it's an internal interface, allowing to remove some use of BTRFS_I. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent d36f84a commit 4ea2fb9

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

fs/btrfs/inode.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5611,7 +5611,7 @@ static int btrfs_find_actor(struct inode *inode, void *opaque)
56115611
args->root == BTRFS_I(inode)->root;
56125612
}
56135613

5614-
static struct inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
5614+
static struct btrfs_inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
56155615
{
56165616
struct inode *inode;
56175617
struct btrfs_iget_args args;
@@ -5623,7 +5623,9 @@ static struct inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
56235623
inode = iget5_locked_rcu(root->fs_info->sb, hashval, btrfs_find_actor,
56245624
btrfs_init_locked_inode,
56255625
(void *)&args);
5626-
return inode;
5626+
if (!inode)
5627+
return NULL;
5628+
return BTRFS_I(inode);
56275629
}
56285630

56295631
/*
@@ -5633,51 +5635,51 @@ static struct inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
56335635
struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
56345636
struct btrfs_path *path)
56355637
{
5636-
struct inode *inode;
5638+
struct btrfs_inode *inode;
56375639
int ret;
56385640

56395641
inode = btrfs_iget_locked(ino, root);
56405642
if (!inode)
56415643
return ERR_PTR(-ENOMEM);
56425644

5643-
if (!(inode->i_state & I_NEW))
5644-
return inode;
5645+
if (!(inode->vfs_inode.i_state & I_NEW))
5646+
return &inode->vfs_inode;
56455647

5646-
ret = btrfs_read_locked_inode(BTRFS_I(inode), path);
5648+
ret = btrfs_read_locked_inode(inode, path);
56475649
if (ret)
56485650
return ERR_PTR(ret);
56495651

5650-
unlock_new_inode(inode);
5651-
return inode;
5652+
unlock_new_inode(&inode->vfs_inode);
5653+
return &inode->vfs_inode;
56525654
}
56535655

56545656
/*
56555657
* Get an inode object given its inode number and corresponding root.
56565658
*/
56575659
struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
56585660
{
5659-
struct inode *inode;
5661+
struct btrfs_inode *inode;
56605662
struct btrfs_path *path;
56615663
int ret;
56625664

56635665
inode = btrfs_iget_locked(ino, root);
56645666
if (!inode)
56655667
return ERR_PTR(-ENOMEM);
56665668

5667-
if (!(inode->i_state & I_NEW))
5668-
return inode;
5669+
if (!(inode->vfs_inode.i_state & I_NEW))
5670+
return &inode->vfs_inode;
56695671

56705672
path = btrfs_alloc_path();
56715673
if (!path)
56725674
return ERR_PTR(-ENOMEM);
56735675

5674-
ret = btrfs_read_locked_inode(BTRFS_I(inode), path);
5676+
ret = btrfs_read_locked_inode(inode, path);
56755677
btrfs_free_path(path);
56765678
if (ret)
56775679
return ERR_PTR(ret);
56785680

5679-
unlock_new_inode(inode);
5680-
return inode;
5681+
unlock_new_inode(&inode->vfs_inode);
5682+
return &inode->vfs_inode;
56815683
}
56825684

56835685
static struct inode *new_simple_dir(struct inode *dir,

0 commit comments

Comments
 (0)