]>
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 | |
711f58d2 | 33 | @@ -255,17 +255,18 @@ |
0af9b189 | 34 | return err; |
2380c486 JR |
35 | } |
36 | ||
711f58d2 AM |
37 | + |
38 | struct dentry *ramfs_mount(struct file_system_type *fs_type, | |
39 | int flags, const char *dev_name, void *data) | |
40 | { | |
41 | return mount_nodev(fs_type, flags, data, ramfs_fill_super); | |
42 | } | |
43 | ||
44 | -static struct dentry *rootfs_mount(struct file_system_type *fs_type, | |
45 | - int flags, const char *dev_name, void *data) | |
46 | -{ | |
47 | - return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); | |
48 | -} | |
38eb4ad4 | 49 | +static struct file_system_type ramfs_fs_type = { |
0af9b189 | 50 | + .name = "ramfs", |
711f58d2 | 51 | + .mount = ramfs_mount, |
0af9b189 | 52 | + .kill_sb = kill_litter_super, |
38eb4ad4 | 53 | +}; |
711f58d2 AM |
54 | |
55 | static void ramfs_kill_sb(struct super_block *sb) | |
38eb4ad4 | 56 | { |
711f58d2 | 57 | @@ -273,30 +274,19 @@ |
38eb4ad4 | 58 | kill_litter_super(sb); |
59 | } | |
2380c486 | 60 | |
38eb4ad4 | 61 | -static struct file_system_type ramfs_fs_type = { |
970f8983 AM |
62 | - .name = "ramfs", |
63 | - .mount = ramfs_mount, | |
64 | - .kill_sb = kill_litter_super, | |
38eb4ad4 | 65 | -}; |
711f58d2 AM |
66 | +#ifndef CONFIG_TMPFS_ROOT |
67 | +static struct dentry *rootfs_mount(struct file_system_type *fs_type, | |
68 | + int flags, const char *dev_name, void *data) | |
69 | +{ | |
70 | + return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); | |
71 | +} | |
72 | + | |
38eb4ad4 | 73 | static struct file_system_type rootfs_fs_type = { |
74 | .name = "rootfs", | |
0af9b189 | 75 | .mount = rootfs_mount, |
2380c486 JR |
76 | .kill_sb = kill_litter_super, |
77 | }; | |
78 | ||
38eb4ad4 | 79 | -static int __init init_ramfs_fs(void) |
80 | -{ | |
81 | - return register_filesystem(&ramfs_fs_type); | |
82 | -} | |
83 | - | |
84 | -static void __exit exit_ramfs_fs(void) | |
85 | -{ | |
86 | - unregister_filesystem(&ramfs_fs_type); | |
87 | -} | |
88 | - | |
89 | -module_init(init_ramfs_fs) | |
90 | -module_exit(exit_ramfs_fs) | |
91 | - | |
92 | int __init init_rootfs(void) | |
2380c486 | 93 | { |
38eb4ad4 | 94 | int err; |
711f58d2 | 95 | @@ -311,5 +301,19 @@ |
2380c486 | 96 | |
38eb4ad4 | 97 | return err; |
2380c486 | 98 | } |
38eb4ad4 | 99 | +#endif |
100 | + | |
101 | +static int __init init_ramfs_fs(void) | |
102 | +{ | |
711f58d2 | 103 | + return register_filesystem(&ramfs_fs_type); |
38eb4ad4 | 104 | +} |
105 | + | |
106 | +static void __exit exit_ramfs_fs(void) | |
107 | +{ | |
711f58d2 | 108 | + unregister_filesystem(&ramfs_fs_type); |
38eb4ad4 | 109 | +} |
110 | + | |
111 | +module_init(init_ramfs_fs) | |
112 | +module_exit(exit_ramfs_fs) | |
2380c486 | 113 | |
38eb4ad4 | 114 | MODULE_LICENSE("GPL"); |
115 | diff -ruw linux-2.6.30.orig/mm/shmem.c linux-2.6.30/mm/shmem.c | |
116 | --- linux-2.6.30.orig/mm/shmem.c 2009-02-12 17:51:15.000000000 +0000 | |
117 | +++ linux-2.6.30/mm/shmem.c 2009-02-13 11:42:02.000000000 +0000 | |
118 | @@ -86,7 +86,7 @@ | |
119 | #ifdef CONFIG_TMPFS | |
120 | static unsigned long shmem_default_max_blocks(void) | |
121 | { | |
122 | - return totalram_pages / 2; | |
123 | + return totalram_pages / 10 * 9; | |
124 | } | |
125 | ||
126 | static unsigned long shmem_default_max_inodes(void) | |
127 | @@ -2369,6 +2369,10 @@ | |
128 | ||
db41fa5b | 129 | static int shmem_init_inodecache(void) |
38eb4ad4 | 130 | { |
131 | +#ifdef CONFIG_TMPFS_ROOT | |
132 | + if (shmem_inode_cachep) | |
133 | + return 0; | |
134 | +#endif | |
135 | shmem_inode_cachep = kmem_cache_create("shmem_inode_cache", | |
136 | sizeof(struct shmem_inode_info), | |
137 | 0, SLAB_PANIC, init_once); | |
138 | @@ -2587,6 +2591,27 @@ | |
139 | } | |
140 | EXPORT_SYMBOL_GPL(shmem_file_setup); | |
141 | ||
142 | +#ifdef CONFIG_TMPFS_ROOT | |
0497755d AM |
143 | + |
144 | + | |
145 | + | |
146 | + | |
147 | + | |
38eb4ad4 | 148 | + |
149 | +static struct file_system_type rootfs_fs_type = { | |
150 | + .name = "rootfs", | |
0497755d | 151 | + .mount = shmem_mount, |
38eb4ad4 | 152 | + .kill_sb = kill_litter_super, |
153 | +}; | |
154 | + | |
155 | +int __init init_rootfs(void) | |
156 | +{ | |
db41fa5b | 157 | + if (shmem_init_inodecache()) |
38eb4ad4 | 158 | + panic("Can't initialize shm inode cache"); |
159 | + return register_filesystem(&rootfs_fs_type); | |
160 | +} | |
161 | +#endif | |
162 | + | |
163 | /** | |
164 | * shmem_zero_setup - setup a shared anonymous mapping | |
165 | * @vma: the vma to be mmapped is prepared by do_mmap_pgoff |