Commit 57f6b96c authored by Fengguang Wu's avatar Fengguang Wu Committed by Linus Torvalds

filemap: convert some unsigned long to pgoff_t

Convert some 'unsigned long' to pgoff_t.
Signed-off-by: default avatarFengguang Wu <wfg@mail.ustc.edu.cn>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b2c3843b
...@@ -84,11 +84,11 @@ static inline struct page *page_cache_alloc_cold(struct address_space *x) ...@@ -84,11 +84,11 @@ static inline struct page *page_cache_alloc_cold(struct address_space *x)
typedef int filler_t(void *, struct page *); typedef int filler_t(void *, struct page *);
extern struct page * find_get_page(struct address_space *mapping, extern struct page * find_get_page(struct address_space *mapping,
unsigned long index); pgoff_t index);
extern struct page * find_lock_page(struct address_space *mapping, extern struct page * find_lock_page(struct address_space *mapping,
unsigned long index); pgoff_t index);
extern struct page * find_or_create_page(struct address_space *mapping, extern struct page * find_or_create_page(struct address_space *mapping,
unsigned long index, gfp_t gfp_mask); pgoff_t index, gfp_t gfp_mask);
unsigned find_get_pages(struct address_space *mapping, pgoff_t start, unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
unsigned int nr_pages, struct page **pages); unsigned int nr_pages, struct page **pages);
unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, unsigned 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,41 +99,42 @@ unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
/* /*
* Returns locked page at given index in given cache, creating it if needed. * Returns locked page at given index in given cache, creating it if needed.
*/ */
static inline struct page *grab_cache_page(struct address_space *mapping, unsigned long index) static inline struct page *grab_cache_page(struct address_space *mapping,
pgoff_t index)
{ {
return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); return find_or_create_page(mapping, index, mapping_gfp_mask(mapping));
} }
extern struct page * grab_cache_page_nowait(struct address_space *mapping, extern struct page * grab_cache_page_nowait(struct address_space *mapping,
unsigned long index); pgoff_t index);
extern struct page * read_cache_page_async(struct address_space *mapping, extern struct page * read_cache_page_async(struct address_space *mapping,
unsigned long index, filler_t *filler, pgoff_t index, filler_t *filler,
void *data); void *data);
extern struct page * read_cache_page(struct address_space *mapping, extern struct page * read_cache_page(struct address_space *mapping,
unsigned long index, filler_t *filler, pgoff_t index, filler_t *filler,
void *data); void *data);
extern int read_cache_pages(struct address_space *mapping, extern int read_cache_pages(struct address_space *mapping,
struct list_head *pages, filler_t *filler, void *data); struct list_head *pages, filler_t *filler, void *data);
static inline struct page *read_mapping_page_async( static inline struct page *read_mapping_page_async(
struct address_space *mapping, struct address_space *mapping,
unsigned long index, void *data) pgoff_t index, void *data)
{ {
filler_t *filler = (filler_t *)mapping->a_ops->readpage; filler_t *filler = (filler_t *)mapping->a_ops->readpage;
return read_cache_page_async(mapping, index, filler, data); return read_cache_page_async(mapping, index, filler, data);
} }
static inline struct page *read_mapping_page(struct address_space *mapping, static inline struct page *read_mapping_page(struct address_space *mapping,
unsigned long index, void *data) pgoff_t index, void *data)
{ {
filler_t *filler = (filler_t *)mapping->a_ops->readpage; filler_t *filler = (filler_t *)mapping->a_ops->readpage;
return read_cache_page(mapping, index, filler, data); return read_cache_page(mapping, index, filler, data);
} }
int add_to_page_cache(struct page *page, struct address_space *mapping, int add_to_page_cache(struct page *page, struct address_space *mapping,
unsigned long index, gfp_t gfp_mask); pgoff_t index, gfp_t gfp_mask);
int add_to_page_cache_lru(struct page *page, struct address_space *mapping, int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
unsigned long index, gfp_t gfp_mask); pgoff_t index, gfp_t gfp_mask);
extern void remove_from_page_cache(struct page *page); extern void remove_from_page_cache(struct page *page);
extern void __remove_from_page_cache(struct page *page); extern void __remove_from_page_cache(struct page *page);
......
...@@ -593,7 +593,7 @@ void fastcall __lock_page_nosync(struct page *page) ...@@ -593,7 +593,7 @@ void fastcall __lock_page_nosync(struct page *page)
* Is there a pagecache struct page at the given (mapping, offset) tuple? * Is there a pagecache struct page at the given (mapping, offset) tuple?
* If yes, increment its refcount and return it; if no, return NULL. * If yes, increment its refcount and return it; if no, return NULL.
*/ */
struct page * find_get_page(struct address_space *mapping, unsigned long offset) struct page * find_get_page(struct address_space *mapping, pgoff_t offset)
{ {
struct page *page; struct page *page;
...@@ -617,7 +617,7 @@ EXPORT_SYMBOL(find_get_page); ...@@ -617,7 +617,7 @@ EXPORT_SYMBOL(find_get_page);
* Returns zero if the page was not present. find_lock_page() may sleep. * Returns zero if the page was not present. find_lock_page() may sleep.
*/ */
struct page *find_lock_page(struct address_space *mapping, struct page *find_lock_page(struct address_space *mapping,
unsigned long offset) pgoff_t offset)
{ {
struct page *page; struct page *page;
...@@ -663,7 +663,7 @@ EXPORT_SYMBOL(find_lock_page); ...@@ -663,7 +663,7 @@ EXPORT_SYMBOL(find_lock_page);
* memory exhaustion. * memory exhaustion.
*/ */
struct page *find_or_create_page(struct address_space *mapping, struct page *find_or_create_page(struct address_space *mapping,
unsigned long index, gfp_t gfp_mask) pgoff_t index, gfp_t gfp_mask)
{ {
struct page *page, *cached_page = NULL; struct page *page, *cached_page = NULL;
int err; int err;
...@@ -797,7 +797,7 @@ EXPORT_SYMBOL(find_get_pages_tag); ...@@ -797,7 +797,7 @@ EXPORT_SYMBOL(find_get_pages_tag);
* and deadlock against the caller's locked page. * and deadlock against the caller's locked page.
*/ */
struct page * struct page *
grab_cache_page_nowait(struct address_space *mapping, unsigned long index) grab_cache_page_nowait(struct address_space *mapping, pgoff_t index)
{ {
struct page *page = find_get_page(mapping, index); struct page *page = find_get_page(mapping, index);
...@@ -866,10 +866,10 @@ void do_generic_mapping_read(struct address_space *mapping, ...@@ -866,10 +866,10 @@ void do_generic_mapping_read(struct address_space *mapping,
read_actor_t actor) read_actor_t actor)
{ {
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
unsigned long index; pgoff_t index;
unsigned long offset; pgoff_t last_index;
unsigned long last_index; pgoff_t prev_index;
unsigned long prev_index; unsigned long offset; /* offset into pagecache page */
unsigned int prev_offset; unsigned int prev_offset;
struct page *cached_page; struct page *cached_page;
int error; int error;
...@@ -883,7 +883,7 @@ void do_generic_mapping_read(struct address_space *mapping, ...@@ -883,7 +883,7 @@ void do_generic_mapping_read(struct address_space *mapping,
for (;;) { for (;;) {
struct page *page; struct page *page;
unsigned long end_index; pgoff_t end_index;
loff_t isize; loff_t isize;
unsigned long nr, ret; unsigned long nr, ret;
...@@ -1217,7 +1217,7 @@ EXPORT_SYMBOL(generic_file_aio_read); ...@@ -1217,7 +1217,7 @@ EXPORT_SYMBOL(generic_file_aio_read);
static ssize_t static ssize_t
do_readahead(struct address_space *mapping, struct file *filp, do_readahead(struct address_space *mapping, struct file *filp,
unsigned long index, unsigned long nr) pgoff_t index, unsigned long nr)
{ {
if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
return -EINVAL; return -EINVAL;
...@@ -1237,8 +1237,8 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) ...@@ -1237,8 +1237,8 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
if (file) { if (file) {
if (file->f_mode & FMODE_READ) { if (file->f_mode & FMODE_READ) {
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
unsigned long start = offset >> PAGE_CACHE_SHIFT; pgoff_t start = offset >> PAGE_CACHE_SHIFT;
unsigned long end = (offset + count - 1) >> PAGE_CACHE_SHIFT; pgoff_t end = (offset + count - 1) >> PAGE_CACHE_SHIFT;
unsigned long len = end - start + 1; unsigned long len = end - start + 1;
ret = do_readahead(mapping, file, start, len); ret = do_readahead(mapping, file, start, len);
} }
...@@ -1256,7 +1256,7 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count) ...@@ -1256,7 +1256,7 @@ asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count)
* This adds the requested page to the page cache if it isn't already there, * This adds the requested page to the page cache if it isn't already there,
* and schedules an I/O to read in its contents from disk. * and schedules an I/O to read in its contents from disk.
*/ */
static int fastcall page_cache_read(struct file * file, unsigned long offset) static int fastcall page_cache_read(struct file * file, pgoff_t offset)
{ {
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
struct page *page; struct page *page;
...@@ -1497,7 +1497,7 @@ EXPORT_SYMBOL(generic_file_mmap); ...@@ -1497,7 +1497,7 @@ EXPORT_SYMBOL(generic_file_mmap);
EXPORT_SYMBOL(generic_file_readonly_mmap); EXPORT_SYMBOL(generic_file_readonly_mmap);
static struct page *__read_cache_page(struct address_space *mapping, static struct page *__read_cache_page(struct address_space *mapping,
unsigned long index, pgoff_t index,
int (*filler)(void *,struct page*), int (*filler)(void *,struct page*),
void *data) void *data)
{ {
...@@ -1538,7 +1538,7 @@ static struct page *__read_cache_page(struct address_space *mapping, ...@@ -1538,7 +1538,7 @@ static struct page *__read_cache_page(struct address_space *mapping,
* after submitting it to the filler. * after submitting it to the filler.
*/ */
struct page *read_cache_page_async(struct address_space *mapping, struct page *read_cache_page_async(struct address_space *mapping,
unsigned long index, pgoff_t index,
int (*filler)(void *,struct page*), int (*filler)(void *,struct page*),
void *data) void *data)
{ {
...@@ -1586,7 +1586,7 @@ EXPORT_SYMBOL(read_cache_page_async); ...@@ -1586,7 +1586,7 @@ EXPORT_SYMBOL(read_cache_page_async);
* If the page does not get brought uptodate, return -EIO. * If the page does not get brought uptodate, return -EIO.
*/ */
struct page *read_cache_page(struct address_space *mapping, struct page *read_cache_page(struct address_space *mapping,
unsigned long index, pgoff_t index,
int (*filler)(void *,struct page*), int (*filler)(void *,struct page*),
void *data) void *data)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment