diff options
Diffstat (limited to 'fs/ntfs/file.c')
-rw-r--r-- | fs/ntfs/file.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index bed4d427dfae..91117ada8528 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -220,8 +220,8 @@ do_non_resident_extend: | |||
220 | m = NULL; | 220 | m = NULL; |
221 | } | 221 | } |
222 | mapping = vi->i_mapping; | 222 | mapping = vi->i_mapping; |
223 | index = old_init_size >> PAGE_CACHE_SHIFT; | 223 | index = old_init_size >> PAGE_SHIFT; |
224 | end_index = (new_init_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 224 | end_index = (new_init_size + PAGE_SIZE - 1) >> PAGE_SHIFT; |
225 | do { | 225 | do { |
226 | /* | 226 | /* |
227 | * Read the page. If the page is not present, this will zero | 227 | * Read the page. If the page is not present, this will zero |
@@ -233,7 +233,7 @@ do_non_resident_extend: | |||
233 | goto init_err_out; | 233 | goto init_err_out; |
234 | } | 234 | } |
235 | if (unlikely(PageError(page))) { | 235 | if (unlikely(PageError(page))) { |
236 | page_cache_release(page); | 236 | put_page(page); |
237 | err = -EIO; | 237 | err = -EIO; |
238 | goto init_err_out; | 238 | goto init_err_out; |
239 | } | 239 | } |
@@ -242,13 +242,13 @@ do_non_resident_extend: | |||
242 | * enough to make ntfs_writepage() work. | 242 | * enough to make ntfs_writepage() work. |
243 | */ | 243 | */ |
244 | write_lock_irqsave(&ni->size_lock, flags); | 244 | write_lock_irqsave(&ni->size_lock, flags); |
245 | ni->initialized_size = (s64)(index + 1) << PAGE_CACHE_SHIFT; | 245 | ni->initialized_size = (s64)(index + 1) << PAGE_SHIFT; |
246 | if (ni->initialized_size > new_init_size) | 246 | if (ni->initialized_size > new_init_size) |
247 | ni->initialized_size = new_init_size; | 247 | ni->initialized_size = new_init_size; |
248 | write_unlock_irqrestore(&ni->size_lock, flags); | 248 | write_unlock_irqrestore(&ni->size_lock, flags); |
249 | /* Set the page dirty so it gets written out. */ | 249 | /* Set the page dirty so it gets written out. */ |
250 | set_page_dirty(page); | 250 | set_page_dirty(page); |
251 | page_cache_release(page); | 251 | put_page(page); |
252 | /* | 252 | /* |
253 | * Play nice with the vm and the rest of the system. This is | 253 | * Play nice with the vm and the rest of the system. This is |
254 | * very much needed as we can potentially be modifying the | 254 | * very much needed as we can potentially be modifying the |
@@ -543,7 +543,7 @@ out: | |||
543 | err_out: | 543 | err_out: |
544 | while (nr > 0) { | 544 | while (nr > 0) { |
545 | unlock_page(pages[--nr]); | 545 | unlock_page(pages[--nr]); |
546 | page_cache_release(pages[nr]); | 546 | put_page(pages[nr]); |
547 | } | 547 | } |
548 | goto out; | 548 | goto out; |
549 | } | 549 | } |
@@ -573,7 +573,7 @@ static inline int ntfs_submit_bh_for_read(struct buffer_head *bh) | |||
573 | * only partially being written to. | 573 | * only partially being written to. |
574 | * | 574 | * |
575 | * If @nr_pages is greater than one, we are guaranteed that the cluster size is | 575 | * If @nr_pages is greater than one, we are guaranteed that the cluster size is |
576 | * greater than PAGE_CACHE_SIZE, that all pages in @pages are entirely inside | 576 | * greater than PAGE_SIZE, that all pages in @pages are entirely inside |
577 | * the same cluster and that they are the entirety of that cluster, and that | 577 | * the same cluster and that they are the entirety of that cluster, and that |
578 | * the cluster is sparse, i.e. we need to allocate a cluster to fill the hole. | 578 | * the cluster is sparse, i.e. we need to allocate a cluster to fill the hole. |
579 | * | 579 | * |
@@ -653,7 +653,7 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages, | |||
653 | u = 0; | 653 | u = 0; |
654 | do_next_page: | 654 | do_next_page: |
655 | page = pages[u]; | 655 | page = pages[u]; |
656 | bh_pos = (s64)page->index << PAGE_CACHE_SHIFT; | 656 | bh_pos = (s64)page->index << PAGE_SHIFT; |
657 | bh = head = page_buffers(page); | 657 | bh = head = page_buffers(page); |
658 | do { | 658 | do { |
659 | VCN cdelta; | 659 | VCN cdelta; |
@@ -810,11 +810,11 @@ map_buffer_cached: | |||
810 | 810 | ||
811 | kaddr = kmap_atomic(page); | 811 | kaddr = kmap_atomic(page); |
812 | if (bh_pos < pos) { | 812 | if (bh_pos < pos) { |
813 | pofs = bh_pos & ~PAGE_CACHE_MASK; | 813 | pofs = bh_pos & ~PAGE_MASK; |
814 | memset(kaddr + pofs, 0, pos - bh_pos); | 814 | memset(kaddr + pofs, 0, pos - bh_pos); |
815 | } | 815 | } |
816 | if (bh_end > end) { | 816 | if (bh_end > end) { |
817 | pofs = end & ~PAGE_CACHE_MASK; | 817 | pofs = end & ~PAGE_MASK; |
818 | memset(kaddr + pofs, 0, bh_end - end); | 818 | memset(kaddr + pofs, 0, bh_end - end); |
819 | } | 819 | } |
820 | kunmap_atomic(kaddr); | 820 | kunmap_atomic(kaddr); |
@@ -942,7 +942,7 @@ rl_not_mapped_enoent: | |||
942 | * unmapped. This can only happen when the cluster size is | 942 | * unmapped. This can only happen when the cluster size is |
943 | * less than the page cache size. | 943 | * less than the page cache size. |
944 | */ | 944 | */ |
945 | if (unlikely(vol->cluster_size < PAGE_CACHE_SIZE)) { | 945 | if (unlikely(vol->cluster_size < PAGE_SIZE)) { |
946 | bh_cend = (bh_end + vol->cluster_size - 1) >> | 946 | bh_cend = (bh_end + vol->cluster_size - 1) >> |
947 | vol->cluster_size_bits; | 947 | vol->cluster_size_bits; |
948 | if ((bh_cend <= cpos || bh_cpos >= cend)) { | 948 | if ((bh_cend <= cpos || bh_cpos >= cend)) { |
@@ -1208,7 +1208,7 @@ rl_not_mapped_enoent: | |||
1208 | wait_on_buffer(bh); | 1208 | wait_on_buffer(bh); |
1209 | if (likely(buffer_uptodate(bh))) { | 1209 | if (likely(buffer_uptodate(bh))) { |
1210 | page = bh->b_page; | 1210 | page = bh->b_page; |
1211 | bh_pos = ((s64)page->index << PAGE_CACHE_SHIFT) + | 1211 | bh_pos = ((s64)page->index << PAGE_SHIFT) + |
1212 | bh_offset(bh); | 1212 | bh_offset(bh); |
1213 | /* | 1213 | /* |
1214 | * If the buffer overflows the initialized size, need | 1214 | * If the buffer overflows the initialized size, need |
@@ -1350,7 +1350,7 @@ rl_not_mapped_enoent: | |||
1350 | bh = head = page_buffers(page); | 1350 | bh = head = page_buffers(page); |
1351 | do { | 1351 | do { |
1352 | if (u == nr_pages && | 1352 | if (u == nr_pages && |
1353 | ((s64)page->index << PAGE_CACHE_SHIFT) + | 1353 | ((s64)page->index << PAGE_SHIFT) + |
1354 | bh_offset(bh) >= end) | 1354 | bh_offset(bh) >= end) |
1355 | break; | 1355 | break; |
1356 | if (!buffer_new(bh)) | 1356 | if (!buffer_new(bh)) |
@@ -1422,7 +1422,7 @@ static inline int ntfs_commit_pages_after_non_resident_write( | |||
1422 | bool partial; | 1422 | bool partial; |
1423 | 1423 | ||
1424 | page = pages[u]; | 1424 | page = pages[u]; |
1425 | bh_pos = (s64)page->index << PAGE_CACHE_SHIFT; | 1425 | bh_pos = (s64)page->index << PAGE_SHIFT; |
1426 | bh = head = page_buffers(page); | 1426 | bh = head = page_buffers(page); |
1427 | partial = false; | 1427 | partial = false; |
1428 | do { | 1428 | do { |
@@ -1639,7 +1639,7 @@ static int ntfs_commit_pages_after_write(struct page **pages, | |||
1639 | if (end < attr_len) | 1639 | if (end < attr_len) |
1640 | memcpy(kaddr + end, kattr + end, attr_len - end); | 1640 | memcpy(kaddr + end, kattr + end, attr_len - end); |
1641 | /* Zero the region outside the end of the attribute value. */ | 1641 | /* Zero the region outside the end of the attribute value. */ |
1642 | memset(kaddr + attr_len, 0, PAGE_CACHE_SIZE - attr_len); | 1642 | memset(kaddr + attr_len, 0, PAGE_SIZE - attr_len); |
1643 | flush_dcache_page(page); | 1643 | flush_dcache_page(page); |
1644 | SetPageUptodate(page); | 1644 | SetPageUptodate(page); |
1645 | } | 1645 | } |
@@ -1706,7 +1706,7 @@ static size_t ntfs_copy_from_user_iter(struct page **pages, unsigned nr_pages, | |||
1706 | unsigned len, copied; | 1706 | unsigned len, copied; |
1707 | 1707 | ||
1708 | do { | 1708 | do { |
1709 | len = PAGE_CACHE_SIZE - ofs; | 1709 | len = PAGE_SIZE - ofs; |
1710 | if (len > bytes) | 1710 | if (len > bytes) |
1711 | len = bytes; | 1711 | len = bytes; |
1712 | copied = iov_iter_copy_from_user_atomic(*pages, &data, ofs, | 1712 | copied = iov_iter_copy_from_user_atomic(*pages, &data, ofs, |
@@ -1724,14 +1724,14 @@ out: | |||
1724 | return total; | 1724 | return total; |
1725 | err: | 1725 | err: |
1726 | /* Zero the rest of the target like __copy_from_user(). */ | 1726 | /* Zero the rest of the target like __copy_from_user(). */ |
1727 | len = PAGE_CACHE_SIZE - copied; | 1727 | len = PAGE_SIZE - copied; |
1728 | do { | 1728 | do { |
1729 | if (len > bytes) | 1729 | if (len > bytes) |
1730 | len = bytes; | 1730 | len = bytes; |
1731 | zero_user(*pages, copied, len); | 1731 | zero_user(*pages, copied, len); |
1732 | bytes -= len; | 1732 | bytes -= len; |
1733 | copied = 0; | 1733 | copied = 0; |
1734 | len = PAGE_CACHE_SIZE; | 1734 | len = PAGE_SIZE; |
1735 | } while (++pages < last_page); | 1735 | } while (++pages < last_page); |
1736 | goto out; | 1736 | goto out; |
1737 | } | 1737 | } |
@@ -1787,8 +1787,8 @@ static ssize_t ntfs_perform_write(struct file *file, struct iov_iter *i, | |||
1787 | * attributes. | 1787 | * attributes. |
1788 | */ | 1788 | */ |
1789 | nr_pages = 1; | 1789 | nr_pages = 1; |
1790 | if (vol->cluster_size > PAGE_CACHE_SIZE && NInoNonResident(ni)) | 1790 | if (vol->cluster_size > PAGE_SIZE && NInoNonResident(ni)) |
1791 | nr_pages = vol->cluster_size >> PAGE_CACHE_SHIFT; | 1791 | nr_pages = vol->cluster_size >> PAGE_SHIFT; |
1792 | last_vcn = -1; | 1792 | last_vcn = -1; |
1793 | do { | 1793 | do { |
1794 | VCN vcn; | 1794 | VCN vcn; |
@@ -1796,9 +1796,9 @@ static ssize_t ntfs_perform_write(struct file *file, struct iov_iter *i, | |||
1796 | unsigned ofs, do_pages, u; | 1796 | unsigned ofs, do_pages, u; |
1797 | size_t copied; | 1797 | size_t copied; |
1798 | 1798 | ||
1799 | start_idx = idx = pos >> PAGE_CACHE_SHIFT; | 1799 | start_idx = idx = pos >> PAGE_SHIFT; |
1800 | ofs = pos & ~PAGE_CACHE_MASK; | 1800 | ofs = pos & ~PAGE_MASK; |
1801 | bytes = PAGE_CACHE_SIZE - ofs; | 1801 | bytes = PAGE_SIZE - ofs; |
1802 | do_pages = 1; | 1802 | do_pages = 1; |
1803 | if (nr_pages > 1) { | 1803 | if (nr_pages > 1) { |
1804 | vcn = pos >> vol->cluster_size_bits; | 1804 | vcn = pos >> vol->cluster_size_bits; |
@@ -1832,7 +1832,7 @@ static ssize_t ntfs_perform_write(struct file *file, struct iov_iter *i, | |||
1832 | if (lcn == LCN_HOLE) { | 1832 | if (lcn == LCN_HOLE) { |
1833 | start_idx = (pos & ~(s64) | 1833 | start_idx = (pos & ~(s64) |
1834 | vol->cluster_size_mask) | 1834 | vol->cluster_size_mask) |
1835 | >> PAGE_CACHE_SHIFT; | 1835 | >> PAGE_SHIFT; |
1836 | bytes = vol->cluster_size - (pos & | 1836 | bytes = vol->cluster_size - (pos & |
1837 | vol->cluster_size_mask); | 1837 | vol->cluster_size_mask); |
1838 | do_pages = nr_pages; | 1838 | do_pages = nr_pages; |
@@ -1871,12 +1871,12 @@ again: | |||
1871 | if (unlikely(status)) { | 1871 | if (unlikely(status)) { |
1872 | do { | 1872 | do { |
1873 | unlock_page(pages[--do_pages]); | 1873 | unlock_page(pages[--do_pages]); |
1874 | page_cache_release(pages[do_pages]); | 1874 | put_page(pages[do_pages]); |
1875 | } while (do_pages); | 1875 | } while (do_pages); |
1876 | break; | 1876 | break; |
1877 | } | 1877 | } |
1878 | } | 1878 | } |
1879 | u = (pos >> PAGE_CACHE_SHIFT) - pages[0]->index; | 1879 | u = (pos >> PAGE_SHIFT) - pages[0]->index; |
1880 | copied = ntfs_copy_from_user_iter(pages + u, do_pages - u, ofs, | 1880 | copied = ntfs_copy_from_user_iter(pages + u, do_pages - u, ofs, |
1881 | i, bytes); | 1881 | i, bytes); |
1882 | ntfs_flush_dcache_pages(pages + u, do_pages - u); | 1882 | ntfs_flush_dcache_pages(pages + u, do_pages - u); |
@@ -1889,7 +1889,7 @@ again: | |||
1889 | } | 1889 | } |
1890 | do { | 1890 | do { |
1891 | unlock_page(pages[--do_pages]); | 1891 | unlock_page(pages[--do_pages]); |
1892 | page_cache_release(pages[do_pages]); | 1892 | put_page(pages[do_pages]); |
1893 | } while (do_pages); | 1893 | } while (do_pages); |
1894 | if (unlikely(status < 0)) | 1894 | if (unlikely(status < 0)) |
1895 | break; | 1895 | break; |
@@ -1921,7 +1921,7 @@ again: | |||
1921 | } | 1921 | } |
1922 | } while (iov_iter_count(i)); | 1922 | } while (iov_iter_count(i)); |
1923 | if (cached_page) | 1923 | if (cached_page) |
1924 | page_cache_release(cached_page); | 1924 | put_page(cached_page); |
1925 | ntfs_debug("Done. Returning %s (written 0x%lx, status %li).", | 1925 | ntfs_debug("Done. Returning %s (written 0x%lx, status %li).", |
1926 | written ? "written" : "status", (unsigned long)written, | 1926 | written ? "written" : "status", (unsigned long)written, |
1927 | (long)status); | 1927 | (long)status); |