aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap_xip.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 4553b2c5aab4..8c199f537732 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -68,13 +68,12 @@ do_xip_mapping_read(struct address_space *mapping,
68 if (unlikely(IS_ERR(page))) { 68 if (unlikely(IS_ERR(page))) {
69 if (PTR_ERR(page) == -ENODATA) { 69 if (PTR_ERR(page) == -ENODATA) {
70 /* sparse */ 70 /* sparse */
71 page = virt_to_page(empty_zero_page); 71 page = ZERO_PAGE(0);
72 } else { 72 } else {
73 desc->error = PTR_ERR(page); 73 desc->error = PTR_ERR(page);
74 goto out; 74 goto out;
75 } 75 }
76 } else 76 }
77 BUG_ON(!PageUptodate(page));
78 77
79 /* If users can be writing to this page using arbitrary 78 /* If users can be writing to this page using arbitrary
80 * virtual addresses, take care about potential aliasing 79 * virtual addresses, take care about potential aliasing
@@ -84,8 +83,7 @@ do_xip_mapping_read(struct address_space *mapping,
84 flush_dcache_page(page); 83 flush_dcache_page(page);
85 84
86 /* 85 /*
87 * Ok, we have the page, and it's up-to-date, so 86 * Ok, we have the page, so now we can copy it to user space...
88 * now we can copy it to user space...
89 * 87 *
90 * The actor routine returns how many bytes were actually used.. 88 * The actor routine returns how many bytes were actually used..
91 * NOTE! This may not be the same as how much of a user buffer 89 * NOTE! This may not be the same as how much of a user buffer
@@ -164,7 +162,7 @@ EXPORT_SYMBOL_GPL(xip_file_sendfile);
164 * xip_write 162 * xip_write
165 * 163 *
166 * This function walks all vmas of the address_space and unmaps the 164 * This function walks all vmas of the address_space and unmaps the
167 * empty_zero_page when found at pgoff. Should it go in rmap.c? 165 * ZERO_PAGE when found at pgoff. Should it go in rmap.c?
168 */ 166 */
169static void 167static void
170__xip_unmap (struct address_space * mapping, 168__xip_unmap (struct address_space * mapping,
@@ -187,7 +185,7 @@ __xip_unmap (struct address_space * mapping,
187 * We need the page_table_lock to protect us from page faults, 185 * We need the page_table_lock to protect us from page faults,
188 * munmap, fork, etc... 186 * munmap, fork, etc...
189 */ 187 */
190 pte = page_check_address(virt_to_page(empty_zero_page), mm, 188 pte = page_check_address(ZERO_PAGE(address), mm,
191 address); 189 address);
192 if (!IS_ERR(pte)) { 190 if (!IS_ERR(pte)) {
193 /* Nuke the page table entry. */ 191 /* Nuke the page table entry. */
@@ -230,7 +228,6 @@ xip_file_nopage(struct vm_area_struct * area,
230 228
231 page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0); 229 page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0);
232 if (!IS_ERR(page)) { 230 if (!IS_ERR(page)) {
233 BUG_ON(!PageUptodate(page));
234 return page; 231 return page;
235 } 232 }
236 if (PTR_ERR(page) != -ENODATA) 233 if (PTR_ERR(page) != -ENODATA)
@@ -245,12 +242,11 @@ xip_file_nopage(struct vm_area_struct * area,
245 pgoff*(PAGE_SIZE/512), 1); 242 pgoff*(PAGE_SIZE/512), 1);
246 if (IS_ERR(page)) 243 if (IS_ERR(page))
247 return NULL; 244 return NULL;
248 BUG_ON(!PageUptodate(page));
249 /* unmap page at pgoff from all other vmas */ 245 /* unmap page at pgoff from all other vmas */
250 __xip_unmap(mapping, pgoff); 246 __xip_unmap(mapping, pgoff);
251 } else { 247 } else {
252 /* not shared and writable, use empty_zero_page */ 248 /* not shared and writable, use ZERO_PAGE() */
253 page = virt_to_page(empty_zero_page); 249 page = ZERO_PAGE(address);
254 } 250 }
255 251
256 return page; 252 return page;
@@ -319,8 +315,6 @@ __xip_file_write(struct file *filp, const char __user *buf,
319 break; 315 break;
320 } 316 }
321 317
322 BUG_ON(!PageUptodate(page));
323
324 copied = filemap_copy_from_user(page, offset, buf, bytes); 318 copied = filemap_copy_from_user(page, offset, buf, bytes);
325 flush_dcache_page(page); 319 flush_dcache_page(page);
326 if (likely(copied > 0)) { 320 if (likely(copied > 0)) {
@@ -435,8 +429,7 @@ xip_truncate_page(struct address_space *mapping, loff_t from)
435 return 0; 429 return 0;
436 else 430 else
437 return PTR_ERR(page); 431 return PTR_ERR(page);
438 } else 432 }
439 BUG_ON(!PageUptodate(page));
440 kaddr = kmap_atomic(page, KM_USER0); 433 kaddr = kmap_atomic(page, KM_USER0);
441 memset(kaddr + offset, 0, length); 434 memset(kaddr + offset, 0, length);
442 kunmap_atomic(kaddr, KM_USER0); 435 kunmap_atomic(kaddr, KM_USER0);