diff options
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 1e43c8a865ba..db21c51531ca 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -23,10 +23,8 @@ | |||
23 | * which makes it a completely usable filesystem. | 23 | * which makes it a completely usable filesystem. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/config.h> | ||
27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
29 | #include <linux/devfs_fs_kernel.h> | ||
30 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
31 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
32 | #include <linux/mman.h> | 30 | #include <linux/mman.h> |
@@ -174,7 +172,7 @@ static inline void shmem_unacct_blocks(unsigned long flags, long pages) | |||
174 | } | 172 | } |
175 | 173 | ||
176 | static struct super_operations shmem_ops; | 174 | static struct super_operations shmem_ops; |
177 | static struct address_space_operations shmem_aops; | 175 | static const struct address_space_operations shmem_aops; |
178 | static struct file_operations shmem_file_operations; | 176 | static struct file_operations shmem_file_operations; |
179 | static struct inode_operations shmem_inode_operations; | 177 | static struct inode_operations shmem_inode_operations; |
180 | static struct inode_operations shmem_dir_inode_operations; | 178 | static struct inode_operations shmem_dir_inode_operations; |
@@ -1046,12 +1044,12 @@ repeat: | |||
1046 | swappage = lookup_swap_cache(swap); | 1044 | swappage = lookup_swap_cache(swap); |
1047 | if (!swappage) { | 1045 | if (!swappage) { |
1048 | shmem_swp_unmap(entry); | 1046 | shmem_swp_unmap(entry); |
1049 | spin_unlock(&info->lock); | ||
1050 | /* here we actually do the io */ | 1047 | /* here we actually do the io */ |
1051 | if (type && *type == VM_FAULT_MINOR) { | 1048 | if (type && *type == VM_FAULT_MINOR) { |
1052 | inc_page_state(pgmajfault); | 1049 | __count_vm_event(PGMAJFAULT); |
1053 | *type = VM_FAULT_MAJOR; | 1050 | *type = VM_FAULT_MAJOR; |
1054 | } | 1051 | } |
1052 | spin_unlock(&info->lock); | ||
1055 | swappage = shmem_swapin(info, swap, idx); | 1053 | swappage = shmem_swapin(info, swap, idx); |
1056 | if (!swappage) { | 1054 | if (!swappage) { |
1057 | spin_lock(&info->lock); | 1055 | spin_lock(&info->lock); |
@@ -1081,14 +1079,6 @@ repeat: | |||
1081 | page_cache_release(swappage); | 1079 | page_cache_release(swappage); |
1082 | goto repeat; | 1080 | goto repeat; |
1083 | } | 1081 | } |
1084 | if (!PageSwapCache(swappage)) { | ||
1085 | /* Page migration has occured */ | ||
1086 | shmem_swp_unmap(entry); | ||
1087 | spin_unlock(&info->lock); | ||
1088 | unlock_page(swappage); | ||
1089 | page_cache_release(swappage); | ||
1090 | goto repeat; | ||
1091 | } | ||
1092 | if (PageWriteback(swappage)) { | 1082 | if (PageWriteback(swappage)) { |
1093 | shmem_swp_unmap(entry); | 1083 | shmem_swp_unmap(entry); |
1094 | spin_unlock(&info->lock); | 1084 | spin_unlock(&info->lock); |
@@ -1654,9 +1644,9 @@ static ssize_t shmem_file_sendfile(struct file *in_file, loff_t *ppos, | |||
1654 | return desc.error; | 1644 | return desc.error; |
1655 | } | 1645 | } |
1656 | 1646 | ||
1657 | static int shmem_statfs(struct super_block *sb, struct kstatfs *buf) | 1647 | static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf) |
1658 | { | 1648 | { |
1659 | struct shmem_sb_info *sbinfo = SHMEM_SB(sb); | 1649 | struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb); |
1660 | 1650 | ||
1661 | buf->f_type = TMPFS_MAGIC; | 1651 | buf->f_type = TMPFS_MAGIC; |
1662 | buf->f_bsize = PAGE_CACHE_SIZE; | 1652 | buf->f_bsize = PAGE_CACHE_SIZE; |
@@ -2170,7 +2160,7 @@ static void destroy_inodecache(void) | |||
2170 | printk(KERN_INFO "shmem_inode_cache: not all structures were freed\n"); | 2160 | printk(KERN_INFO "shmem_inode_cache: not all structures were freed\n"); |
2171 | } | 2161 | } |
2172 | 2162 | ||
2173 | static struct address_space_operations shmem_aops = { | 2163 | static const struct address_space_operations shmem_aops = { |
2174 | .writepage = shmem_writepage, | 2164 | .writepage = shmem_writepage, |
2175 | .set_page_dirty = __set_page_dirty_nobuffers, | 2165 | .set_page_dirty = __set_page_dirty_nobuffers, |
2176 | #ifdef CONFIG_TMPFS | 2166 | #ifdef CONFIG_TMPFS |
@@ -2233,10 +2223,10 @@ static struct vm_operations_struct shmem_vm_ops = { | |||
2233 | }; | 2223 | }; |
2234 | 2224 | ||
2235 | 2225 | ||
2236 | static struct super_block *shmem_get_sb(struct file_system_type *fs_type, | 2226 | static int shmem_get_sb(struct file_system_type *fs_type, |
2237 | int flags, const char *dev_name, void *data) | 2227 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
2238 | { | 2228 | { |
2239 | return get_sb_nodev(fs_type, flags, data, shmem_fill_super); | 2229 | return get_sb_nodev(fs_type, flags, data, shmem_fill_super, mnt); |
2240 | } | 2230 | } |
2241 | 2231 | ||
2242 | static struct file_system_type tmpfs_fs_type = { | 2232 | static struct file_system_type tmpfs_fs_type = { |
@@ -2260,10 +2250,8 @@ static int __init init_tmpfs(void) | |||
2260 | printk(KERN_ERR "Could not register tmpfs\n"); | 2250 | printk(KERN_ERR "Could not register tmpfs\n"); |
2261 | goto out2; | 2251 | goto out2; |
2262 | } | 2252 | } |
2263 | #ifdef CONFIG_TMPFS | 2253 | |
2264 | devfs_mk_dir("shm"); | 2254 | shm_mnt = vfs_kern_mount(&tmpfs_fs_type, MS_NOUSER, |
2265 | #endif | ||
2266 | shm_mnt = do_kern_mount(tmpfs_fs_type.name, MS_NOUSER, | ||
2267 | tmpfs_fs_type.name, NULL); | 2255 | tmpfs_fs_type.name, NULL); |
2268 | if (IS_ERR(shm_mnt)) { | 2256 | if (IS_ERR(shm_mnt)) { |
2269 | error = PTR_ERR(shm_mnt); | 2257 | error = PTR_ERR(shm_mnt); |