diff -ruw linux-2.6.30.orig/fs/Kconfig linux-2.6.30/fs/Kconfig --- linux-2.6.30.orig/fs/Kconfig 2009-02-12 17:51:15.000000000 +0000 +++ linux-2.6.30/fs/Kconfig 2009-02-13 12:01:55.000000000 +0000 @@ -724,6 +724,25 @@ If you don't know what Access Control Lists are, say N. +config TMPFS_ROOT + bool "Use tmpfs instead of ramfs for initramfs" + depends on TMPFS && SHMEM + default y + help + This replaces the ramfs used for unpacking the cpio images + with tmpfs. + +config RAMFS + bool "Ramfs file system support" if TMPFS_ROOT + default n + ---help--- + Ramfs is a file system which keeps all files in RAM. Unlike tmpfs, + it cannot be swapped to disk, and it has the risk of deadlocking + the system by using all memory. + + Ramfs is used for booting the system and unpacking the cpio if + TMPFS_ROOT is not set. + config HUGETLBFS bool "HugeTLB file system support" depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \ diff -ruw linux-2.6.30.orig/fs/ramfs/inode.c linux-2.6.30/fs/ramfs/inode.c --- linux-2.6.30.orig/fs/ramfs/inode.c 2009-02-12 17:51:15.000000000 +0000 +++ linux-2.6.30/fs/ramfs/inode.c 2009-02-13 11:30:30.000000000 +0000 @@ -244,12 +244,6 @@ return mount_nodev(fs_type, flags, data, ramfs_fill_super); } -static struct dentry *rootfs_mount(struct file_system_type *fs_type, - int flags, const char *dev_name, void *data) -{ - return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); -} - static void ramfs_kill_sb(struct super_block *sb) { kfree(sb->s_fs_info); @@ -261,18 +255,20 @@ .mount = ramfs_mount, .kill_sb = ramfs_kill_sb, }; + +#ifndef CONFIG_TMPFS_ROOT +static struct dentry *rootfs_mount(struct file_system_type *fs_type, + int flags, const char *dev_name, void *data) +{ + return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); +} + static struct file_system_type rootfs_fs_type = { .name = "rootfs", .mount = rootfs_mount, .kill_sb = kill_litter_super, }; -static int __init init_ramfs_fs(void) -{ - return register_filesystem(&ramfs_fs_type); -} -module_init(init_ramfs_fs) - int __init init_rootfs(void) { int err; @@ -287,3 +283,12 @@ return err; } +#endif + +static int __init init_ramfs_fs(void) +{ + return register_filesystem(&ramfs_fs_type); +} +module_init(init_ramfs_fs) + + diff -ruw linux-2.6.30.orig/mm/shmem.c linux-2.6.30/mm/shmem.c --- linux-2.6.30.orig/mm/shmem.c 2009-02-12 17:51:15.000000000 +0000 +++ linux-2.6.30/mm/shmem.c 2009-02-13 11:42:02.000000000 +0000 @@ -86,7 +86,7 @@ #ifdef CONFIG_TMPFS static unsigned long shmem_default_max_blocks(void) { - return totalram_pages / 2; + return totalram_pages / 10 * 9; } static unsigned long shmem_default_max_inodes(void) @@ -2369,6 +2369,10 @@ static int shmem_init_inodecache(void) { +#ifdef CONFIG_TMPFS_ROOT + if (shmem_inode_cachep) + return 0; +#endif shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", sizeof(struct shmem_inode_info), 0, SLAB_PANIC, init_once); @@ -2587,6 +2591,27 @@ } EXPORT_SYMBOL_GPL(shmem_file_setup); +#ifdef CONFIG_TMPFS_ROOT + + + + + + +static struct file_system_type rootfs_fs_type = { + .name = "rootfs", + .mount = shmem_mount, + .kill_sb = kill_litter_super, +}; + +int __init init_rootfs(void) +{ + if (shmem_init_inodecache()) + panic("Can't initialize shm inode cache"); + return register_filesystem(&rootfs_fs_type); +} +#endif + /** * shmem_zero_setup - setup a shared anonymous mapping * @vma: the vma to be mmapped is prepared by do_mmap_pgoff