summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init/do_mounts.c10
-rw-r--r--mm/shmem.c4
2 files changed, 12 insertions, 2 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 5d8d48fd0ee4..e27908b949d4 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -27,6 +27,7 @@
27#include <linux/fs_struct.h> 27#include <linux/fs_struct.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/ramfs.h> 29#include <linux/ramfs.h>
30#include <linux/shmem_fs.h>
30 31
31#include <linux/nfs_fs.h> 32#include <linux/nfs_fs.h>
32#include <linux/nfs_fs_sb.h> 33#include <linux/nfs_fs_sb.h>
@@ -598,7 +599,8 @@ static struct dentry *rootfs_mount(struct file_system_type *fs_type,
598 if (test_and_set_bit(0, &once)) 599 if (test_and_set_bit(0, &once))
599 return ERR_PTR(-ENODEV); 600 return ERR_PTR(-ENODEV);
600 601
601 return mount_nodev(fs_type, flags, data, ramfs_fill_super); 602 return mount_nodev(fs_type, flags, data,
603 IS_ENABLED(CONFIG_TMPFS) ? shmem_fill_super : ramfs_fill_super);
602} 604}
603 605
604static struct file_system_type rootfs_fs_type = { 606static struct file_system_type rootfs_fs_type = {
@@ -614,7 +616,11 @@ int __init init_rootfs(void)
614 if (err) 616 if (err)
615 return err; 617 return err;
616 618
617 err = init_ramfs_fs(); 619 if (IS_ENABLED(CONFIG_TMPFS))
620 err = shmem_init();
621 else
622 err = init_ramfs_fs();
623
618 if (err) 624 if (err)
619 unregister_filesystem(&rootfs_fs_type); 625 unregister_filesystem(&rootfs_fs_type);
620 626
diff --git a/mm/shmem.c b/mm/shmem.c
index a1b8bf4391c2..8297623fcaed 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2819,6 +2819,10 @@ int __init shmem_init(void)
2819{ 2819{
2820 int error; 2820 int error;
2821 2821
2822 /* If rootfs called this, don't re-init */
2823 if (shmem_inode_cachep)
2824 return 0;
2825
2822 error = bdi_init(&shmem_backing_dev_info); 2826 error = bdi_init(&shmem_backing_dev_info);
2823 if (error) 2827 if (error)
2824 goto out4; 2828 goto out4;