]>
Commit | Line | Data |
---|---|---|
38eb4ad4 | 1 | diff -ruw linux-2.6.30.orig/fs/Kconfig linux-2.6.30/fs/Kconfig |
2 | --- linux-2.6.30.orig/fs/Kconfig 2009-02-12 17:51:15.000000000 +0000 | |
3 | +++ linux-2.6.30/fs/Kconfig 2009-02-13 12:01:55.000000000 +0000 | |
4 | @@ -724,6 +724,25 @@ | |
2380c486 | 5 | |
38eb4ad4 | 6 | If you don't know what Access Control Lists are, say N. |
2380c486 | 7 | |
38eb4ad4 | 8 | +config TMPFS_ROOT |
48ead238 | 9 | + bool "Use tmpfs instead of ramfs for initramfs" |
38eb4ad4 | 10 | + depends on TMPFS && SHMEM |
2380c486 JR |
11 | + default y |
12 | + help | |
38eb4ad4 | 13 | + This replaces the ramfs used for unpacking the cpio images |
14 | + with tmpfs. | |
15 | + | |
16 | +config RAMFS | |
17 | + bool "Ramfs file system support" if TMPFS_ROOT | |
18 | + default n | |
19 | + ---help--- | |
20 | + Ramfs is a file system which keeps all files in RAM. Unlike tmpfs, | |
21 | + it cannot be swapped to disk, and it has the risk of deadlocking | |
22 | + the system by using all memory. | |
23 | + | |
24 | + Ramfs is used for booting the system and unpacking the cpio if | |
25 | + TMPFS_ROOT is not set. | |
2380c486 JR |
26 | + |
27 | config HUGETLBFS | |
28 | bool "HugeTLB file system support" | |
38eb4ad4 | 29 | depends on X86 || IA64 || PPC64 || SPARC64 || (SUPERH && MMU) || \ |
30 | diff -ruw linux-2.6.30.orig/fs/ramfs/inode.c linux-2.6.30/fs/ramfs/inode.c | |
31 | --- linux-2.6.30.orig/fs/ramfs/inode.c 2009-02-12 17:51:15.000000000 +0000 | |
32 | +++ linux-2.6.30/fs/ramfs/inode.c 2009-02-13 11:30:30.000000000 +0000 | |
2964f0b9 | 33 | @@ -244,12 +244,6 @@ |
711f58d2 AM |
34 | return mount_nodev(fs_type, flags, data, ramfs_fill_super); |
35 | } | |
36 | ||
37 | -static struct dentry *rootfs_mount(struct file_system_type *fs_type, | |
38 | - int flags, const char *dev_name, void *data) | |
39 | -{ | |
40 | - return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); | |
41 | -} | |
2964f0b9 | 42 | - |
711f58d2 | 43 | static void ramfs_kill_sb(struct super_block *sb) |
38eb4ad4 | 44 | { |
2964f0b9 AM |
45 | kfree(sb->s_fs_info); |
46 | @@ -261,18 +255,20 @@ | |
47 | .mount = ramfs_mount, | |
48 | .kill_sb = ramfs_kill_sb, | |
49 | }; | |
50 | + | |
711f58d2 AM |
51 | +#ifndef CONFIG_TMPFS_ROOT |
52 | +static struct dentry *rootfs_mount(struct file_system_type *fs_type, | |
53 | + int flags, const char *dev_name, void *data) | |
54 | +{ | |
55 | + return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); | |
56 | +} | |
57 | + | |
38eb4ad4 | 58 | static struct file_system_type rootfs_fs_type = { |
59 | .name = "rootfs", | |
0af9b189 | 60 | .mount = rootfs_mount, |
2380c486 JR |
61 | .kill_sb = kill_litter_super, |
62 | }; | |
63 | ||
38eb4ad4 | 64 | -static int __init init_ramfs_fs(void) |
65 | -{ | |
66 | - return register_filesystem(&ramfs_fs_type); | |
67 | -} | |
38eb4ad4 | 68 | -module_init(init_ramfs_fs) |
38eb4ad4 | 69 | - |
70 | int __init init_rootfs(void) | |
2380c486 | 71 | { |
38eb4ad4 | 72 | int err; |
2964f0b9 | 73 | @@ -287,3 +283,12 @@ |
2380c486 | 74 | |
38eb4ad4 | 75 | return err; |
2380c486 | 76 | } |
38eb4ad4 | 77 | +#endif |
78 | + | |
79 | +static int __init init_ramfs_fs(void) | |
80 | +{ | |
711f58d2 | 81 | + return register_filesystem(&ramfs_fs_type); |
38eb4ad4 | 82 | +} |
2964f0b9 | 83 | +module_init(init_ramfs_fs) |
38eb4ad4 | 84 | + |
38eb4ad4 | 85 | + |
38eb4ad4 | 86 | diff -ruw linux-2.6.30.orig/mm/shmem.c linux-2.6.30/mm/shmem.c |
87 | --- linux-2.6.30.orig/mm/shmem.c 2009-02-12 17:51:15.000000000 +0000 | |
88 | +++ linux-2.6.30/mm/shmem.c 2009-02-13 11:42:02.000000000 +0000 | |
89 | @@ -86,7 +86,7 @@ | |
90 | #ifdef CONFIG_TMPFS | |
91 | static unsigned long shmem_default_max_blocks(void) | |
92 | { | |
93 | - return totalram_pages / 2; | |
94 | + return totalram_pages / 10 * 9; | |
95 | } | |
96 | ||
97 | static unsigned long shmem_default_max_inodes(void) | |
98 | @@ -2369,6 +2369,10 @@ | |
99 | ||
db41fa5b | 100 | static int shmem_init_inodecache(void) |
38eb4ad4 | 101 | { |
102 | +#ifdef CONFIG_TMPFS_ROOT | |
103 | + if (shmem_inode_cachep) | |
104 | + return 0; | |
105 | +#endif | |
106 | shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", | |
107 | sizeof(struct shmem_inode_info), | |
108 | 0, SLAB_PANIC, init_once); | |
109 | @@ -2587,6 +2591,27 @@ | |
110 | } | |
111 | EXPORT_SYMBOL_GPL(shmem_file_setup); | |
112 | ||
113 | +#ifdef CONFIG_TMPFS_ROOT | |
0497755d AM |
114 | + |
115 | + | |
116 | + | |
117 | + | |
118 | + | |
38eb4ad4 | 119 | + |
120 | +static struct file_system_type rootfs_fs_type = { | |
121 | + .name = "rootfs", | |
0497755d | 122 | + .mount = shmem_mount, |
38eb4ad4 | 123 | + .kill_sb = kill_litter_super, |
124 | +}; | |
125 | + | |
126 | +int __init init_rootfs(void) | |
127 | +{ | |
db41fa5b | 128 | + if (shmem_init_inodecache()) |
38eb4ad4 | 129 | + panic("Can't initialize shm inode cache"); |
130 | + return register_filesystem(&rootfs_fs_type); | |
131 | +} | |
132 | +#endif | |
133 | + | |
134 | /** | |
135 | * shmem_zero_setup - setup a shared anonymous mapping | |
136 | * @vma: the vma to be mmapped is prepared by do_mmap_pgoff |