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 5d8d48f..e27908b 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -27,6 +27,7 @@
#include <linux/fs_struct.h>
#include <linux/slab.h>
#include <linux/ramfs.h>
+#include <linux/shmem_fs.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
@@ -598,7 +599,8 @@ static struct dentry *rootfs_mount(struct file_system_type *fs_type,
if (test_and_set_bit(0, &once))
return ERR_PTR(-ENODEV);
- return mount_nodev(fs_type, flags, data, ramfs_fill_super);
+ return mount_nodev(fs_type, flags, data,
+ IS_ENABLED(CONFIG_TMPFS) ? shmem_fill_super : ramfs_fill_super);
}
static struct file_system_type rootfs_fs_type = {
@@ -614,7 +616,11 @@ int __init init_rootfs(void)
if (err)
return err;
- err = init_ramfs_fs();
+ if (IS_ENABLED(CONFIG_TMPFS))
+ err = shmem_init();
+ else
+ err = init_ramfs_fs();
+
if (err)
unregister_filesystem(&rootfs_fs_type);
diff --git a/mm/shmem.c b/mm/shmem.c
index a1b8bf4..8297623 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2819,6 +2819,10 @@ int __init shmem_init(void)
{
int error;
+ /* If rootfs called this, don't re-init */
+ if (shmem_inode_cachep)
+ return 0;
+
error = bdi_init(&shmem_backing_dev_info);
if (error)
goto out4;
OpenPOWER on IntegriCloud