diff options
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index f820e600f1ad..10a171113273 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -128,6 +128,7 @@ void __delete_from_page_cache(struct page *page) | |||
128 | 128 | ||
129 | radix_tree_delete(&mapping->page_tree, page->index); | 129 | radix_tree_delete(&mapping->page_tree, page->index); |
130 | page->mapping = NULL; | 130 | page->mapping = NULL; |
131 | /* Leave page->index set: truncation lookup relies upon it */ | ||
131 | mapping->nrpages--; | 132 | mapping->nrpages--; |
132 | __dec_zone_page_state(page, NR_FILE_PAGES); | 133 | __dec_zone_page_state(page, NR_FILE_PAGES); |
133 | if (PageSwapBacked(page)) | 134 | if (PageSwapBacked(page)) |
@@ -483,6 +484,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping, | |||
483 | spin_unlock_irq(&mapping->tree_lock); | 484 | spin_unlock_irq(&mapping->tree_lock); |
484 | } else { | 485 | } else { |
485 | page->mapping = NULL; | 486 | page->mapping = NULL; |
487 | /* Leave page->index set: truncation relies upon it */ | ||
486 | spin_unlock_irq(&mapping->tree_lock); | 488 | spin_unlock_irq(&mapping->tree_lock); |
487 | mem_cgroup_uncharge_cache_page(page); | 489 | mem_cgroup_uncharge_cache_page(page); |
488 | page_cache_release(page); | 490 | page_cache_release(page); |
@@ -1792,7 +1794,7 @@ EXPORT_SYMBOL(generic_file_readonly_mmap); | |||
1792 | 1794 | ||
1793 | static struct page *__read_cache_page(struct address_space *mapping, | 1795 | static struct page *__read_cache_page(struct address_space *mapping, |
1794 | pgoff_t index, | 1796 | pgoff_t index, |
1795 | int (*filler)(void *,struct page*), | 1797 | int (*filler)(void *, struct page *), |
1796 | void *data, | 1798 | void *data, |
1797 | gfp_t gfp) | 1799 | gfp_t gfp) |
1798 | { | 1800 | { |
@@ -1823,7 +1825,7 @@ repeat: | |||
1823 | 1825 | ||
1824 | static struct page *do_read_cache_page(struct address_space *mapping, | 1826 | static struct page *do_read_cache_page(struct address_space *mapping, |
1825 | pgoff_t index, | 1827 | pgoff_t index, |
1826 | int (*filler)(void *,struct page*), | 1828 | int (*filler)(void *, struct page *), |
1827 | void *data, | 1829 | void *data, |
1828 | gfp_t gfp) | 1830 | gfp_t gfp) |
1829 | 1831 | ||
@@ -1863,7 +1865,7 @@ out: | |||
1863 | * @mapping: the page's address_space | 1865 | * @mapping: the page's address_space |
1864 | * @index: the page index | 1866 | * @index: the page index |
1865 | * @filler: function to perform the read | 1867 | * @filler: function to perform the read |
1866 | * @data: destination for read data | 1868 | * @data: first arg to filler(data, page) function, often left as NULL |
1867 | * | 1869 | * |
1868 | * Same as read_cache_page, but don't wait for page to become unlocked | 1870 | * Same as read_cache_page, but don't wait for page to become unlocked |
1869 | * after submitting it to the filler. | 1871 | * after submitting it to the filler. |
@@ -1875,7 +1877,7 @@ out: | |||
1875 | */ | 1877 | */ |
1876 | struct page *read_cache_page_async(struct address_space *mapping, | 1878 | struct page *read_cache_page_async(struct address_space *mapping, |
1877 | pgoff_t index, | 1879 | pgoff_t index, |
1878 | int (*filler)(void *,struct page*), | 1880 | int (*filler)(void *, struct page *), |
1879 | void *data) | 1881 | void *data) |
1880 | { | 1882 | { |
1881 | return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping)); | 1883 | return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping)); |
@@ -1923,7 +1925,7 @@ EXPORT_SYMBOL(read_cache_page_gfp); | |||
1923 | * @mapping: the page's address_space | 1925 | * @mapping: the page's address_space |
1924 | * @index: the page index | 1926 | * @index: the page index |
1925 | * @filler: function to perform the read | 1927 | * @filler: function to perform the read |
1926 | * @data: destination for read data | 1928 | * @data: first arg to filler(data, page) function, often left as NULL |
1927 | * | 1929 | * |
1928 | * Read into the page cache. If a page already exists, and PageUptodate() is | 1930 | * Read into the page cache. If a page already exists, and PageUptodate() is |
1929 | * not set, try to fill the page then wait for it to become unlocked. | 1931 | * not set, try to fill the page then wait for it to become unlocked. |
@@ -1932,7 +1934,7 @@ EXPORT_SYMBOL(read_cache_page_gfp); | |||
1932 | */ | 1934 | */ |
1933 | struct page *read_cache_page(struct address_space *mapping, | 1935 | struct page *read_cache_page(struct address_space *mapping, |
1934 | pgoff_t index, | 1936 | pgoff_t index, |
1935 | int (*filler)(void *,struct page*), | 1937 | int (*filler)(void *, struct page *), |
1936 | void *data) | 1938 | void *data) |
1937 | { | 1939 | { |
1938 | return wait_on_page_read(read_cache_page_async(mapping, index, filler, data)); | 1940 | return wait_on_page_read(read_cache_page_async(mapping, index, filler, data)); |