aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/pagemap.h23
-rw-r--r--mm/filemap.c32
2 files changed, 28 insertions, 27 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 8a83537d6978..862fc07dc6c0 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -84,11 +84,11 @@ static inline struct page *page_cache_alloc_cold(struct address_space *x)
84typedef int filler_t(void *, struct page *); 84typedef int filler_t(void *, struct page *);
85 85
86extern struct page * find_get_page(struct address_space *mapping, 86extern struct page * find_get_page(struct address_space *mapping,
87 unsigned long index); 87 pgoff_t index);
88extern struct page * find_lock_page(struct address_space *mapping, 88extern struct page * find_lock_page(struct address_space *mapping,
89 unsigned long index); 89 pgoff_t index);
90extern struct page * find_or_create_page(struct address_space *mapping, 90extern struct page * find_or_create_page(struct address_space *mapping,
91 unsigned long index, gfp_t gfp_mask); 91 pgoff_t index, gfp_t gfp_mask);
92unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 92unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
93 unsigned int nr_pages, struct page **pages); 93 unsigned int nr_pages, struct page **pages);
94unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, 94unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
@@ -99,41 +99,42 @@ unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
99/* 99/*
100 * Returns locked page at given index in given cache, creating it if needed. 100 * Returns locked page at given index in given cache, creating it if needed.
101 */ 101 */
102static inline struct page *grab_cache_page(struct address_space *mapping, unsigned long index) 102static inline struct page *grab_cache_page(struct address_space *mapping,
103 pgoff_t index)
103{ 104{
104 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); 105 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping));
105} 106}
106 107
107extern struct page * grab_cache_page_nowait(struct address_space *mapping, 108extern struct page * grab_cache_page_nowait(struct address_space *mapping,
108 unsigned long index); 109 pgoff_t index);
109extern struct page * read_cache_page_async(struct address_space *mapping, 110extern struct page * read_cache_page_async(struct address_space *mapping,
110 unsigned long index, filler_t *filler, 111 pgoff_t index, filler_t *filler,
111 void *data); 112 void *data);
112extern struct page * read_cache_page(struct address_space *mapping, 113extern struct page * read_cache_page(struct address_space *mapping,
113 unsigned long index, filler_t *filler, 114 pgoff_t index, filler_t *filler,
114 void *data); 115 void *data);
115extern int read_cache_pages(struct address_space *mapping, 116extern int read_cache_pages(struct address_space *mapping,
116 struct list_head *pages, filler_t *filler, void *data); 117 struct list_head *pages, filler_t *filler, void *data);
117 118
118static inline struct page *read_mapping_page_async( 119static inline struct page *read_mapping_page_async(
119 struct address_space *mapping, 120 struct address_space *mapping,
120 unsigned long index, void *data) 121 pgoff_t index, void *data)
121{ 122{
122 filler_t *filler = (filler_t *)mapping->a_ops->readpage; 123 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
123 return read_cache_page_async(mapping, index, filler, data); 124 return read_cache_page_async(mapping, index, filler, data);
124} 125}
125 126
126static inline struct page *read_mapping_page(struct address_space *mapping, 127static inline struct page *read_mapping_page(struct address_space *mapping,
127 unsigned long index, void *data) 128 pgoff_t index, void *data)
128{ 129{
129 filler_t *filler = (filler_t *)mapping->a_ops->readpage; 130 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
130 return read_cache_page(mapping, index, filler, data); 131 return read_cache_page(mapping, index, filler, data);
131} 132}
132 133
133int add_to_page_cache(struct page *page, struct address_space *mapping, 134int add_to_page_cache(struct page *page, struct address_space *mapping,
134 unsigned long index, gfp_t gfp_mask); 135 pgoff_t index, gfp_t gfp_mask);
135int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 136int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
136 unsigned long index, gfp_t gfp_mask); 137 pgoff_t index, gfp_t gfp_mask);
137extern void remove_from_page_cache(struct page *page); 138extern void remove_from_page_cache(struct page *page);
138extern void __remove_from_page_cache(struct page *page); 139extern void __remove_from_page_cache(struct page *page);
139 140
diff --git a/mm/filemap.c b/mm/filemap.c
index c1b94054cbbe..b436cbb3a834 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -593,7 +593,7 @@ void fastcall __lock_page_nosync(struct page *page)
593 * Is there a pagecache struct page at the given (mapping, offset) tuple? 593 * Is there a pagecache struct page at the given (mapping, offset) tuple?
594 * If yes, increment its refcount and return it; if no, return NULL. 594 * If yes, increment its refcount and return it; if no, return NULL.
595 */ 595 */
596struct page * find_get_page(struct address_space *mapping, unsigned long offset) 596struct page * find_get_page(struct address_space *mapping, pgoff_t offset)
597{ 597{
598 struct page *page; 598 struct page *page;
599 599
@@ -617,7 +617,7 @@ EXPORT_SYMBOL(find_get_page);
617 * Returns zero if the page was not present. find_lock_page() may sleep. 617 * Returns zero if the page was not present. find_lock_page() may sleep.
618 */ 618 */
619struct page *find_lock_page(struct address_space *mapping, 619struct page *find_lock_page(struct address_space *mapping,
620 unsigned long offset) 620 pgoff_t offset)
621{ 621{
622 struct page *page; 622 struct page *page;
623 623
@@ -663,7 +663,7 @@ EXPORT_SYMBOL(find_lock_page);
663 * memory exhaustion. 663 * memory exhaustion.
664 */ 664 */
665struct page *find_or_create_page(struct address_space *mapping, 665struct page *find_or_create_page(struct address_space *mapping,
666 unsigned long index, gfp_t gfp_mask) 666 pgoff_t index, gfp_t gfp_mask)
667{ 667{
668 struct page *page, *cached_page = NULL; 668 struct page *page, *cached_page = NULL;
669 int err; 669 int err;
@@ -797,7 +797,7 @@ EXPORT_SYMBOL(find_get_pages_tag);
797 * and deadlock against the caller's locked page. 797 * and deadlock against the caller's locked page.
798 */ 798 */
799struct page * 799struct page *
800grab_cache_page_nowait(struct address_space *mapping, unsigned long index) 800grab_cache_page_nowait(struct address_space *mapping, pgoff_t index)
801{ 801{
802 struct page *page = find_get_page(mapping, index); 802 struct page *page = find_get_page(mapping, index);
803 803
@@ -866,10 +866,10 @@ void do_generic_mapping_read(struct address_space *mapping,
866 read_actor_t actor) 866 read_actor_t actor)
867{ 867{
868 struct inode *inode = mapping->host; 868 struct inode *inode = mapping->host;
869 unsigned long index; 869 pgoff_t index;
870 unsigned long offset; 870 pgoff_t last_index;
871 unsigned long last_index; 871 pgoff_t prev_index;
872 unsigned long prev_index; 872 unsigned long offset; /* offset into pagecache page */
873 unsigned int prev_offset; 873 unsigned int prev_offset;
874 struct page *cached_page; 874 struct page *cached_page;
875 int error; 875 int error;
@@ -883,7 +883,7 @@ void do_generic_mapping_read(struct address_space *mapping,
883 883
884 for (;;) { 884 for (;;) {
885 struct page *page; 885 struct page *page;
886 unsigned long end_index; 886 pgoff_t end_index;
887 loff_t isize; 887 loff_t isize;
888 unsigned long nr, ret; 888 unsigned long nr, ret;
889 889
@@ -1217,7 +1217,7 @@ EXPORT_SYMBOL(generic_file_aio_read);
1217 1217
1218static ssize_t 1218static ssize_t
1219do_readahead(struct address_space *mapping, struct file *filp, 1219do_readahead(struct address_space *mapping, struct file *filp,
1220 unsigned long index, unsigned long nr) 1220 pgoff_t index, unsigned long nr)
1221{ 1221{
1222 if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) 1222 if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
1223 return -EINVAL; 1223 return -EINVAL;
@@ -1237,8 +1237,8 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
1237 if (file) { 1237 if (file) {
1238 if (file->f_mode & FMODE_READ) { 1238 if (file->f_mode & FMODE_READ) {
1239 struct address_space *mapping = file->f_mapping; 1239 struct address_space *mapping = file->f_mapping;
1240 unsigned long start = offset >> PAGE_CACHE_SHIFT; 1240 pgoff_t start = offset >> PAGE_CACHE_SHIFT;
1241 unsigned long end = (offset + count - 1) >> PAGE_CACHE_SHIFT; 1241 pgoff_t end = (offset + count - 1) >> PAGE_CACHE_SHIFT;
1242 unsigned long len = end - start + 1; 1242 unsigned long len = end - start + 1;
1243 ret = do_readahead(mapping, file, start, len); 1243 ret = do_readahead(mapping, file, start, len);
1244 } 1244 }
@@ -1256,7 +1256,7 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
1256 * This adds the requested page to the page cache if it isn't already there, 1256 * This adds the requested page to the page cache if it isn't already there,
1257 * and schedules an I/O to read in its contents from disk. 1257 * and schedules an I/O to read in its contents from disk.
1258 */ 1258 */
1259static int fastcall page_cache_read(struct file * file, unsigned long offset) 1259static int fastcall page_cache_read(struct file * file, pgoff_t offset)
1260{ 1260{
1261 struct address_space *mapping = file->f_mapping; 1261 struct address_space *mapping = file->f_mapping;
1262 struct page *page; 1262 struct page *page;
@@ -1497,7 +1497,7 @@ EXPORT_SYMBOL(generic_file_mmap);
1497EXPORT_SYMBOL(generic_file_readonly_mmap); 1497EXPORT_SYMBOL(generic_file_readonly_mmap);
1498 1498
1499static struct page *__read_cache_page(struct address_space *mapping, 1499static struct page *__read_cache_page(struct address_space *mapping,
1500 unsigned long index, 1500 pgoff_t index,
1501 int (*filler)(void *,struct page*), 1501 int (*filler)(void *,struct page*),
1502 void *data) 1502 void *data)
1503{ 1503{
@@ -1538,7 +1538,7 @@ repeat:
1538 * after submitting it to the filler. 1538 * after submitting it to the filler.
1539 */ 1539 */
1540struct page *read_cache_page_async(struct address_space *mapping, 1540struct page *read_cache_page_async(struct address_space *mapping,
1541 unsigned long index, 1541 pgoff_t index,
1542 int (*filler)(void *,struct page*), 1542 int (*filler)(void *,struct page*),
1543 void *data) 1543 void *data)
1544{ 1544{
@@ -1586,7 +1586,7 @@ EXPORT_SYMBOL(read_cache_page_async);
1586 * If the page does not get brought uptodate, return -EIO. 1586 * If the page does not get brought uptodate, return -EIO.
1587 */ 1587 */
1588struct page *read_cache_page(struct address_space *mapping, 1588struct page *read_cache_page(struct address_space *mapping,
1589 unsigned long index, 1589 pgoff_t index,
1590 int (*filler)(void *,struct page*), 1590 int (*filler)(void *,struct page*),
1591 void *data) 1591 void *data)
1592{ 1592{