diff options
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 456c9ab7705b..1de921484eac 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1798,7 +1798,7 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to) | |||
1798 | start = max(from, block_start); | 1798 | start = max(from, block_start); |
1799 | size = min(to, block_end) - start; | 1799 | size = min(to, block_end) - start; |
1800 | 1800 | ||
1801 | zero_user_page(page, start, size, KM_USER0); | 1801 | zero_user(page, start, size); |
1802 | set_buffer_uptodate(bh); | 1802 | set_buffer_uptodate(bh); |
1803 | } | 1803 | } |
1804 | 1804 | ||
@@ -1861,19 +1861,10 @@ static int __block_prepare_write(struct inode *inode, struct page *page, | |||
1861 | mark_buffer_dirty(bh); | 1861 | mark_buffer_dirty(bh); |
1862 | continue; | 1862 | continue; |
1863 | } | 1863 | } |
1864 | if (block_end > to || block_start < from) { | 1864 | if (block_end > to || block_start < from) |
1865 | void *kaddr; | 1865 | zero_user_segments(page, |
1866 | 1866 | to, block_end, | |
1867 | kaddr = kmap_atomic(page, KM_USER0); | 1867 | block_start, from); |
1868 | if (block_end > to) | ||
1869 | memset(kaddr+to, 0, | ||
1870 | block_end-to); | ||
1871 | if (block_start < from) | ||
1872 | memset(kaddr+block_start, | ||
1873 | 0, from-block_start); | ||
1874 | flush_dcache_page(page); | ||
1875 | kunmap_atomic(kaddr, KM_USER0); | ||
1876 | } | ||
1877 | continue; | 1868 | continue; |
1878 | } | 1869 | } |
1879 | } | 1870 | } |
@@ -2104,8 +2095,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block) | |||
2104 | SetPageError(page); | 2095 | SetPageError(page); |
2105 | } | 2096 | } |
2106 | if (!buffer_mapped(bh)) { | 2097 | if (!buffer_mapped(bh)) { |
2107 | zero_user_page(page, i * blocksize, blocksize, | 2098 | zero_user(page, i * blocksize, blocksize); |
2108 | KM_USER0); | ||
2109 | if (!err) | 2099 | if (!err) |
2110 | set_buffer_uptodate(bh); | 2100 | set_buffer_uptodate(bh); |
2111 | continue; | 2101 | continue; |
@@ -2218,7 +2208,7 @@ int cont_expand_zero(struct file *file, struct address_space *mapping, | |||
2218 | &page, &fsdata); | 2208 | &page, &fsdata); |
2219 | if (err) | 2209 | if (err) |
2220 | goto out; | 2210 | goto out; |
2221 | zero_user_page(page, zerofrom, len, KM_USER0); | 2211 | zero_user(page, zerofrom, len); |
2222 | err = pagecache_write_end(file, mapping, curpos, len, len, | 2212 | err = pagecache_write_end(file, mapping, curpos, len, len, |
2223 | page, fsdata); | 2213 | page, fsdata); |
2224 | if (err < 0) | 2214 | if (err < 0) |
@@ -2245,7 +2235,7 @@ int cont_expand_zero(struct file *file, struct address_space *mapping, | |||
2245 | &page, &fsdata); | 2235 | &page, &fsdata); |
2246 | if (err) | 2236 | if (err) |
2247 | goto out; | 2237 | goto out; |
2248 | zero_user_page(page, zerofrom, len, KM_USER0); | 2238 | zero_user(page, zerofrom, len); |
2249 | err = pagecache_write_end(file, mapping, curpos, len, len, | 2239 | err = pagecache_write_end(file, mapping, curpos, len, len, |
2250 | page, fsdata); | 2240 | page, fsdata); |
2251 | if (err < 0) | 2241 | if (err < 0) |
@@ -2422,7 +2412,6 @@ int nobh_write_begin(struct file *file, struct address_space *mapping, | |||
2422 | unsigned block_in_page; | 2412 | unsigned block_in_page; |
2423 | unsigned block_start, block_end; | 2413 | unsigned block_start, block_end; |
2424 | sector_t block_in_file; | 2414 | sector_t block_in_file; |
2425 | char *kaddr; | ||
2426 | int nr_reads = 0; | 2415 | int nr_reads = 0; |
2427 | int ret = 0; | 2416 | int ret = 0; |
2428 | int is_mapped_to_disk = 1; | 2417 | int is_mapped_to_disk = 1; |
@@ -2493,13 +2482,8 @@ int nobh_write_begin(struct file *file, struct address_space *mapping, | |||
2493 | continue; | 2482 | continue; |
2494 | } | 2483 | } |
2495 | if (buffer_new(bh) || !buffer_mapped(bh)) { | 2484 | if (buffer_new(bh) || !buffer_mapped(bh)) { |
2496 | kaddr = kmap_atomic(page, KM_USER0); | 2485 | zero_user_segments(page, block_start, from, |
2497 | if (block_start < from) | 2486 | to, block_end); |
2498 | memset(kaddr+block_start, 0, from-block_start); | ||
2499 | if (block_end > to) | ||
2500 | memset(kaddr + to, 0, block_end - to); | ||
2501 | flush_dcache_page(page); | ||
2502 | kunmap_atomic(kaddr, KM_USER0); | ||
2503 | continue; | 2487 | continue; |
2504 | } | 2488 | } |
2505 | if (buffer_uptodate(bh)) | 2489 | if (buffer_uptodate(bh)) |
@@ -2636,7 +2620,7 @@ int nobh_writepage(struct page *page, get_block_t *get_block, | |||
2636 | * the page size, the remaining memory is zeroed when mapped, and | 2620 | * the page size, the remaining memory is zeroed when mapped, and |
2637 | * writes to that region are not written out to the file." | 2621 | * writes to that region are not written out to the file." |
2638 | */ | 2622 | */ |
2639 | zero_user_page(page, offset, PAGE_CACHE_SIZE - offset, KM_USER0); | 2623 | zero_user_segment(page, offset, PAGE_CACHE_SIZE); |
2640 | out: | 2624 | out: |
2641 | ret = mpage_writepage(page, get_block, wbc); | 2625 | ret = mpage_writepage(page, get_block, wbc); |
2642 | if (ret == -EAGAIN) | 2626 | if (ret == -EAGAIN) |
@@ -2709,7 +2693,7 @@ has_buffers: | |||
2709 | if (page_has_buffers(page)) | 2693 | if (page_has_buffers(page)) |
2710 | goto has_buffers; | 2694 | goto has_buffers; |
2711 | } | 2695 | } |
2712 | zero_user_page(page, offset, length, KM_USER0); | 2696 | zero_user(page, offset, length); |
2713 | set_page_dirty(page); | 2697 | set_page_dirty(page); |
2714 | err = 0; | 2698 | err = 0; |
2715 | 2699 | ||
@@ -2785,7 +2769,7 @@ int block_truncate_page(struct address_space *mapping, | |||
2785 | goto unlock; | 2769 | goto unlock; |
2786 | } | 2770 | } |
2787 | 2771 | ||
2788 | zero_user_page(page, offset, length, KM_USER0); | 2772 | zero_user(page, offset, length); |
2789 | mark_buffer_dirty(bh); | 2773 | mark_buffer_dirty(bh); |
2790 | err = 0; | 2774 | err = 0; |
2791 | 2775 | ||
@@ -2831,7 +2815,7 @@ int block_write_full_page(struct page *page, get_block_t *get_block, | |||
2831 | * the page size, the remaining memory is zeroed when mapped, and | 2815 | * the page size, the remaining memory is zeroed when mapped, and |
2832 | * writes to that region are not written out to the file." | 2816 | * writes to that region are not written out to the file." |
2833 | */ | 2817 | */ |
2834 | zero_user_page(page, offset, PAGE_CACHE_SIZE - offset, KM_USER0); | 2818 | zero_user_segment(page, offset, PAGE_CACHE_SIZE); |
2835 | return __block_write_full_page(inode, page, get_block, wbc); | 2819 | return __block_write_full_page(inode, page, get_block, wbc); |
2836 | } | 2820 | } |
2837 | 2821 | ||