summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2025-02-17 22:36:17 +0100
committerDavid Sterba <dsterba@suse.com>2025-03-18 20:35:43 +0100
commit4ea2fb9c628b55929bbc380d8c18733d1d027f1d (patch)
tree5ffc45b3abb8918abae303d41301a4e92d6fde1a /fs/btrfs/inode.c
parentd36f84a849c7685099594815a1e5a48db62c243d (diff)
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>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 69021842fb4b..c24ba1b1e57d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5611,7 +5611,7 @@ static int btrfs_find_actor(struct inode *inode, void *opaque)
args->root == BTRFS_I(inode)->root;
}
-static struct inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
+static struct btrfs_inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
{
struct inode *inode;
struct btrfs_iget_args args;
@@ -5623,7 +5623,9 @@ static struct inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
inode = iget5_locked_rcu(root->fs_info->sb, hashval, btrfs_find_actor,
btrfs_init_locked_inode,
(void *)&args);
- return inode;
+ if (!inode)
+ return NULL;
+ return BTRFS_I(inode);
}
/*
@@ -5633,22 +5635,22 @@ static struct inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
struct btrfs_path *path)
{
- struct inode *inode;
+ struct btrfs_inode *inode;
int ret;
inode = btrfs_iget_locked(ino, root);
if (!inode)
return ERR_PTR(-ENOMEM);
- if (!(inode->i_state & I_NEW))
- return inode;
+ if (!(inode->vfs_inode.i_state & I_NEW))
+ return &inode->vfs_inode;
- ret = btrfs_read_locked_inode(BTRFS_I(inode), path);
+ ret = btrfs_read_locked_inode(inode, path);
if (ret)
return ERR_PTR(ret);
- unlock_new_inode(inode);
- return inode;
+ unlock_new_inode(&inode->vfs_inode);
+ return &inode->vfs_inode;
}
/*
@@ -5656,7 +5658,7 @@ struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
*/
struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
{
- struct inode *inode;
+ struct btrfs_inode *inode;
struct btrfs_path *path;
int ret;
@@ -5664,20 +5666,20 @@ struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
if (!inode)
return ERR_PTR(-ENOMEM);
- if (!(inode->i_state & I_NEW))
- return inode;
+ if (!(inode->vfs_inode.i_state & I_NEW))
+ return &inode->vfs_inode;
path = btrfs_alloc_path();
if (!path)
return ERR_PTR(-ENOMEM);
- ret = btrfs_read_locked_inode(BTRFS_I(inode), path);
+ ret = btrfs_read_locked_inode(inode, path);
btrfs_free_path(path);
if (ret)
return ERR_PTR(ret);
- unlock_new_inode(inode);
- return inode;
+ unlock_new_inode(&inode->vfs_inode);
+ return &inode->vfs_inode;
}
static struct inode *new_simple_dir(struct inode *dir,