]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
vfs: inline new_inode_pseudo() and de-staticize alloc_inode()
authorMateusz Guzik <mjguzik@gmail.com>
Wed, 12 Feb 2025 18:04:59 +0000 (19:04 +0100)
committerChristian Brauner <brauner@kernel.org>
Fri, 21 Feb 2025 09:25:32 +0000 (10:25 +0100)
The former is a no-op wrapper with the same argument.

I left it in place to not lose the information who needs it -- one day
"pseudo" inodes may start differing from what alloc_inode() returns.

In the meantime no point taking a detour.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20250212180459.1022983-1-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/inode.c
include/linux/fs.h

index 875e66261f064b253894ae22d6370e89188c2bff..0cd2304150971f63fffff6ab87e846a72d3eabb2 100644 (file)
@@ -327,7 +327,17 @@ static void i_callback(struct rcu_head *head)
                free_inode_nonrcu(inode);
 }
 
-static struct inode *alloc_inode(struct super_block *sb)
+/**
+ *     alloc_inode     - obtain an inode
+ *     @sb: superblock
+ *
+ *     Allocates a new inode for given superblock.
+ *     Inode wont be chained in superblock s_inodes list
+ *     This means :
+ *     - fs can't be unmount
+ *     - quotas, fsnotify, writeback can't work
+ */
+struct inode *alloc_inode(struct super_block *sb)
 {
        const struct super_operations *ops = sb->s_op;
        struct inode *inode;
@@ -1159,21 +1169,6 @@ unsigned int get_next_ino(void)
 }
 EXPORT_SYMBOL(get_next_ino);
 
-/**
- *     new_inode_pseudo        - obtain an inode
- *     @sb: superblock
- *
- *     Allocates a new inode for given superblock.
- *     Inode wont be chained in superblock s_inodes list
- *     This means :
- *     - fs can't be unmount
- *     - quotas, fsnotify, writeback can't work
- */
-struct inode *new_inode_pseudo(struct super_block *sb)
-{
-       return alloc_inode(sb);
-}
-
 /**
  *     new_inode       - obtain an inode
  *     @sb: superblock
@@ -1190,7 +1185,7 @@ struct inode *new_inode(struct super_block *sb)
 {
        struct inode *inode;
 
-       inode = new_inode_pseudo(sb);
+       inode = alloc_inode(sb);
        if (inode)
                inode_sb_list_add(inode);
        return inode;
index 3e07e4a44de6d3cb22450258407ee9f88ebce758..70c985f3d787c89cfaa601dedf12fa54dc8dcd40 100644 (file)
@@ -3285,7 +3285,11 @@ static inline void __iget(struct inode *inode)
 extern void iget_failed(struct inode *);
 extern void clear_inode(struct inode *);
 extern void __destroy_inode(struct inode *);
-extern struct inode *new_inode_pseudo(struct super_block *sb);
+struct inode *alloc_inode(struct super_block *sb);
+static inline struct inode *new_inode_pseudo(struct super_block *sb)
+{
+       return alloc_inode(sb);
+}
 extern struct inode *new_inode(struct super_block *sb);
 extern void free_inode_nonrcu(struct inode *inode);
 extern int setattr_should_drop_suidgid(struct mnt_idmap *, struct inode *);