Skip to content

Commit 0f93d71

Browse files
committed
pidfs: remove custom inode allocation
We don't need it anymore as persistent information is allocated lazily and stashed in struct pid. Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-7-98f3456fd552@kernel.org Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 5ee83f8 commit 0f93d71

1 file changed

Lines changed: 0 additions & 39 deletions

File tree

fs/pidfs.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#define PIDFS_PID_DEAD ERR_PTR(-ESRCH)
2929

30-
static struct kmem_cache *pidfs_cachep __ro_after_init;
3130
static struct kmem_cache *pidfs_attr_cachep __ro_after_init;
3231

3332
/*
@@ -45,15 +44,6 @@ struct pidfs_attr {
4544
struct pidfs_exit_info *exit_info;
4645
};
4746

48-
struct pidfs_inode {
49-
struct inode vfs_inode;
50-
};
51-
52-
static inline struct pidfs_inode *pidfs_i(struct inode *inode)
53-
{
54-
return container_of(inode, struct pidfs_inode, vfs_inode);
55-
}
56-
5747
static struct rb_root pidfs_ino_tree = RB_ROOT;
5848

5949
#if BITS_PER_LONG == 32
@@ -686,27 +676,9 @@ static void pidfs_evict_inode(struct inode *inode)
686676
put_pid(pid);
687677
}
688678

689-
static struct inode *pidfs_alloc_inode(struct super_block *sb)
690-
{
691-
struct pidfs_inode *pi;
692-
693-
pi = alloc_inode_sb(sb, pidfs_cachep, GFP_KERNEL);
694-
if (!pi)
695-
return NULL;
696-
697-
return &pi->vfs_inode;
698-
}
699-
700-
static void pidfs_free_inode(struct inode *inode)
701-
{
702-
kfree(pidfs_i(inode));
703-
}
704-
705679
static const struct super_operations pidfs_sops = {
706-
.alloc_inode = pidfs_alloc_inode,
707680
.drop_inode = generic_delete_inode,
708681
.evict_inode = pidfs_evict_inode,
709-
.free_inode = pidfs_free_inode,
710682
.statfs = simple_statfs,
711683
};
712684

@@ -1067,19 +1039,8 @@ void pidfs_put_pid(struct pid *pid)
10671039
dput(pid->stashed);
10681040
}
10691041

1070-
static void pidfs_inode_init_once(void *data)
1071-
{
1072-
struct pidfs_inode *pi = data;
1073-
1074-
inode_init_once(&pi->vfs_inode);
1075-
}
1076-
10771042
void __init pidfs_init(void)
10781043
{
1079-
pidfs_cachep = kmem_cache_create("pidfs_cache", sizeof(struct pidfs_inode), 0,
1080-
(SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT |
1081-
SLAB_ACCOUNT | SLAB_PANIC),
1082-
pidfs_inode_init_once);
10831044
pidfs_attr_cachep = kmem_cache_create("pidfs_attr_cache", sizeof(struct pidfs_attr), 0,
10841045
(SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT |
10851046
SLAB_ACCOUNT | SLAB_PANIC), NULL);

0 commit comments

Comments
 (0)