diff options
Diffstat (limited to 'fs/ramfs')
-rw-r--r-- | fs/ramfs/file-nommu.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 266531343aae..1739a4aba25f 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -123,35 +123,6 @@ add_error: | |||
123 | 123 | ||
124 | /*****************************************************************************/ | 124 | /*****************************************************************************/ |
125 | /* | 125 | /* |
126 | * check that file shrinkage doesn't leave any VMAs dangling in midair | ||
127 | */ | ||
128 | static 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 | down_write(&nommu_region_sem); | ||
135 | |||
136 | /* search for VMAs that fall within the dead zone */ | ||
137 | vma_prio_tree_foreach(vma, &iter, &inode->i_mapping->i_mmap, | ||
138 | newsize >> PAGE_SHIFT, | ||
139 | (size + PAGE_SIZE - 1) >> PAGE_SHIFT | ||
140 | ) { | ||
141 | /* found one - only interested if it's shared out of the page | ||
142 | * cache */ | ||
143 | if (vma->vm_flags & VM_SHARED) { | ||
144 | up_write(&nommu_region_sem); | ||
145 | return -ETXTBSY; /* not quite true, but near enough */ | ||
146 | } | ||
147 | } | ||
148 | |||
149 | up_write(&nommu_region_sem); | ||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | /*****************************************************************************/ | ||
154 | /* | ||
155 | * | 126 | * |
156 | */ | 127 | */ |
157 | static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) | 128 | static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) |
@@ -169,7 +140,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) | |||
169 | 140 | ||
170 | /* check that a decrease in size doesn't cut off any shared mappings */ | 141 | /* check that a decrease in size doesn't cut off any shared mappings */ |
171 | if (newsize < size) { | 142 | if (newsize < size) { |
172 | ret = ramfs_nommu_check_mappings(inode, newsize, size); | 143 | ret = nommu_shrink_inode_mappings(inode, size, newsize); |
173 | if (ret < 0) | 144 | if (ret < 0) |
174 | return ret; | 145 | return ret; |
175 | } | 146 | } |