Skip to content

Commit

Permalink
mnt_init(): call shmem_init() unconditionally
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Al Viro committed Jul 5, 2019
1 parent 3348884 commit 037f11b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 13 deletions.
2 changes: 2 additions & 0 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/sched/task.h>
#include <uapi/linux/mount.h>
#include <linux/fs_context.h>
#include <linux/shmem_fs.h>

#include "pnode.h"
#include "internal.h"
Expand Down Expand Up @@ -3740,6 +3741,7 @@ void __init mnt_init(void)
fs_kobj = kobject_create_and_add("fs", NULL);
if (!fs_kobj)
printk(KERN_WARNING "%s: kobj create error\n", __func__);
shmem_init();
init_rootfs();
init_mount_tree();
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extern unsigned int reset_devices;
/* used by init/main.c */
void setup_arch(char **);
void prepare_namespace(void);
int __init init_rootfs(void);
void __init init_rootfs(void);
extern struct file_system_type rootfs_fs_type;

#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
Expand Down
9 changes: 2 additions & 7 deletions init/do_mounts.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,9 @@ struct file_system_type rootfs_fs_type = {
.kill_sb = kill_litter_super,
};

int __init init_rootfs(void)
void __init init_rootfs(void)
{
int err = 0;

if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] &&
(!root_fs_names || strstr(root_fs_names, "tmpfs"))) {
err = shmem_init();
(!root_fs_names || strstr(root_fs_names, "tmpfs")))
is_tmpfs = true;
}
return err;
}
1 change: 0 additions & 1 deletion init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,6 @@ static void __init do_initcalls(void)
static void __init do_basic_setup(void)
{
cpuset_init_smp();
shmem_init();
driver_init();
init_irq_proc();
do_ctors();
Expand Down
4 changes: 0 additions & 4 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -3775,10 +3775,6 @@ int __init shmem_init(void)
{
int error;

/* If rootfs called this, don't re-init */
if (shmem_inode_cachep)
return 0;

shmem_init_inodecache();

error = register_filesystem(&shmem_fs_type);
Expand Down

0 comments on commit 037f11b

Please sign in to comment.