Skip to content

Commit 037f11b

Browse files
author
Al Viro
committed
mnt_init(): call shmem_init() unconditionally
No point having two call sites (earlier in init_rootfs() from mnt_init() in case we are going to use shmem-style rootfs, later from do_basic_setup() unconditionally), along with the logics in shmem_init() itself to make the second call a no-op... Signed-off-by: Al Viro <[email protected]>
1 parent 3348884 commit 037f11b

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

fs/namespace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/sched/task.h>
3030
#include <uapi/linux/mount.h>
3131
#include <linux/fs_context.h>
32+
#include <linux/shmem_fs.h>
3233

3334
#include "pnode.h"
3435
#include "internal.h"
@@ -3740,6 +3741,7 @@ void __init mnt_init(void)
37403741
fs_kobj = kobject_create_and_add("fs", NULL);
37413742
if (!fs_kobj)
37423743
printk(KERN_WARNING "%s: kobj create error\n", __func__);
3744+
shmem_init();
37433745
init_rootfs();
37443746
init_mount_tree();
37453747
}

include/linux/init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ extern unsigned int reset_devices;
148148
/* used by init/main.c */
149149
void setup_arch(char **);
150150
void prepare_namespace(void);
151-
int __init init_rootfs(void);
151+
void __init init_rootfs(void);
152152
extern struct file_system_type rootfs_fs_type;
153153

154154
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)

init/do_mounts.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,9 @@ struct file_system_type rootfs_fs_type = {
643643
.kill_sb = kill_litter_super,
644644
};
645645

646-
int __init init_rootfs(void)
646+
void __init init_rootfs(void)
647647
{
648-
int err = 0;
649-
650648
if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] &&
651-
(!root_fs_names || strstr(root_fs_names, "tmpfs"))) {
652-
err = shmem_init();
649+
(!root_fs_names || strstr(root_fs_names, "tmpfs")))
653650
is_tmpfs = true;
654-
}
655-
return err;
656651
}

init/main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,6 @@ static void __init do_initcalls(void)
10001000
static void __init do_basic_setup(void)
10011001
{
10021002
cpuset_init_smp();
1003-
shmem_init();
10041003
driver_init();
10051004
init_irq_proc();
10061005
do_ctors();

mm/shmem.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3775,10 +3775,6 @@ int __init shmem_init(void)
37753775
{
37763776
int error;
37773777

3778-
/* If rootfs called this, don't re-init */
3779-
if (shmem_inode_cachep)
3780-
return 0;
3781-
37823778
shmem_init_inodecache();
37833779

37843780
error = register_filesystem(&shmem_fs_type);

0 commit comments

Comments
 (0)