]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: make btrfs_iget_path() return a btrfs inode instead
authorFilipe Manana <fdmanana@suse.com>
Fri, 7 Mar 2025 12:27:15 +0000 (12:27 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:50 +0000 (20:35 +0100)
It's an internal function and btrfs_iget() is now returning a btrfs inode,
so change btrfs_iget_path() to also return a btrfs inode instead of a VFS
inode.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/btrfs_inode.h
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c

index b5a94b961663bc02b1dcf2d0032ff0d291a1ecf6..4e2952cf5766edd66ab25d67c06a50da480f6a49 100644 (file)
@@ -593,8 +593,8 @@ void btrfs_free_inode(struct inode *inode);
 int btrfs_drop_inode(struct inode *inode);
 int __init btrfs_init_cachep(void);
 void __cold btrfs_destroy_cachep(void);
-struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
-                             struct btrfs_path *path);
+struct btrfs_inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
+                                   struct btrfs_path *path);
 struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root);
 struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
                                    struct folio *folio, u64 start, u64 len);
index 3095cce904b55e942e56d24527c77cd5a9ca582b..05e173311c1a92d4d7d359c5e91fff36700783a0 100644 (file)
@@ -88,7 +88,7 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
        struct btrfs_disk_key disk_key;
        struct btrfs_free_space_header *header;
        struct extent_buffer *leaf;
-       struct inode *inode = NULL;
+       struct btrfs_inode *inode;
        unsigned nofs_flag;
        int ret;
 
@@ -120,13 +120,13 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
        btrfs_release_path(path);
        memalloc_nofs_restore(nofs_flag);
        if (IS_ERR(inode))
-               return inode;
+               return ERR_CAST(inode);
 
-       mapping_set_gfp_mask(inode->i_mapping,
-                       mapping_gfp_constraint(inode->i_mapping,
+       mapping_set_gfp_mask(inode->vfs_inode.i_mapping,
+                       mapping_gfp_constraint(inode->vfs_inode.i_mapping,
                        ~(__GFP_FS | __GFP_HIGHMEM)));
 
-       return inode;
+       return &inode->vfs_inode;
 }
 
 struct inode *lookup_free_space_inode(struct btrfs_block_group *block_group,
index d48da09e53f3836827287b6cea10533f098e8c52..a9d20ccea74f7104d58ffc91a0439386a5b81c13 100644 (file)
@@ -5642,8 +5642,8 @@ static struct btrfs_inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
  * Get an inode object given its inode number and corresponding root.  Path is
  * preallocated to prevent recursing back to iget through allocator.
  */
-struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
-                             struct btrfs_path *path)
+struct btrfs_inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
+                                   struct btrfs_path *path)
 {
        struct btrfs_inode *inode;
        int ret;
@@ -5653,14 +5653,14 @@ struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
                return ERR_PTR(-ENOMEM);
 
        if (!(inode->vfs_inode.i_state & I_NEW))
-               return &inode->vfs_inode;
+               return inode;
 
        ret = btrfs_read_locked_inode(inode, path);
        if (ret)
                return ERR_PTR(ret);
 
        unlock_new_inode(&inode->vfs_inode);
-       return &inode->vfs_inode;
+       return inode;
 }
 
 /*