aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ramfs
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /fs/ramfs
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'fs/ramfs')
-rw-r--r--fs/ramfs/file-nommu.c29
-rw-r--r--fs/ramfs/inode.c1
2 files changed, 4 insertions, 26 deletions
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 32fae4040ebf..5ea4ad81a429 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -21,6 +21,7 @@
21#include <linux/pagevec.h> 21#include <linux/pagevec.h>
22#include <linux/mman.h> 22#include <linux/mman.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/slab.h>
24 25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include "internal.h" 27#include "internal.h"
@@ -60,7 +61,7 @@ const struct inode_operations ramfs_file_inode_operations = {
60 */ 61 */
61int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) 62int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
62{ 63{
63 unsigned long npages, xpages, loop, limit; 64 unsigned long npages, xpages, loop;
64 struct page *pages; 65 struct page *pages;
65 unsigned order; 66 unsigned order;
66 void *data; 67 void *data;
@@ -123,30 +124,6 @@ add_error:
123 124
124/*****************************************************************************/ 125/*****************************************************************************/
125/* 126/*
126 * check that file shrinkage doesn't leave any VMAs dangling in midair
127 */
128static int ramfs_nommu_check_mappings(struct inode *inode,
129 size_t newsize, size_t size)
130{
131 struct vm_area_struct *vma;
132 struct prio_tree_iter iter;
133
134 /* search for VMAs that fall within the dead zone */
135 vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap,
136 newsize >> PAGE_SHIFT,
137 (size + PAGE_SIZE - 1) >> PAGE_SHIFT
138 ) {
139 /* found one - only interested if it's shared out of the page
140 * cache */
141 if (vma->vm_flags & VM_SHARED)
142 return -ETXTBSY; /* not quite true, but near enough */
143 }
144
145 return 0;
146}
147
148/*****************************************************************************/
149/*
150 * 127 *
151 */ 128 */
152static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) 129static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size)
@@ -164,7 +141,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size)
164 141
165 /* check that a decrease in size doesn't cut off any shared mappings */ 142 /* check that a decrease in size doesn't cut off any shared mappings */
166 if (newsize < size) { 143 if (newsize < size) {
167 ret = ramfs_nommu_check_mappings(inode, newsize, size); 144 ret = nommu_shrink_inode_mappings(inode, size, newsize);
168 if (ret < 0) 145 if (ret < 0)
169 return ret; 146 return ret;
170 } 147 }
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index a6090aa1a7c1..c94853473ca9 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -35,6 +35,7 @@
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/parser.h> 36#include <linux/parser.h>
37#include <linux/magic.h> 37#include <linux/magic.h>
38#include <linux/slab.h>
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39#include "internal.h" 40#include "internal.h"
40 41