From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 10/10] filemap: convert some unsigned long to pgoff_t
Date: Tue, 24 Jul 2007 10:00:19 +0800 [thread overview]
Message-ID: <385243123.75006@ustc.edu.cn> (raw)
Message-ID: <20070724020043.189132028@mail.ustc.edu.cn> (raw)
In-Reply-To: 20070724020009.677809022@mail.ustc.edu.cn
[-- Attachment #1: pgoff_t.patch --]
[-- Type: text/plain, Size: 7072 bytes --]
Convert some 'unsigned long' to pgoff_t.
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
include/linux/pagemap.h | 23 ++++++++++++-----------
mm/filemap.c | 32 ++++++++++++++++----------------
2 files changed, 28 insertions(+), 27 deletions(-)
--- linux-2.6.22-rc6-mm1.orig/include/linux/pagemap.h
+++ linux-2.6.22-rc6-mm1/include/linux/pagemap.h
@@ -83,11 +83,11 @@ static inline struct page *page_cache_al
typedef int filler_t(void *, struct page *);
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,
- unsigned long index);
+ pgoff_t index);
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 int nr_pages, struct page **pages);
unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
@@ -100,41 +100,42 @@ struct page *__grab_cache_page(struct ad
/*
* 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));
}
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,
- unsigned long index, filler_t *filler,
+ pgoff_t index, filler_t *filler,
void *data);
extern struct page * read_cache_page(struct address_space *mapping,
- unsigned long index, filler_t *filler,
+ pgoff_t index, filler_t *filler,
void *data);
extern int read_cache_pages(struct address_space *mapping,
struct list_head *pages, filler_t *filler, void *data);
static inline struct page *read_mapping_page_async(
struct address_space *mapping,
- unsigned long index, void *data)
+ pgoff_t index, void *data)
{
filler_t *filler = (filler_t *)mapping->a_ops->readpage;
return read_cache_page_async(mapping, index, filler, data);
}
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;
return read_cache_page(mapping, index, filler, data);
}
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,
- 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);
--- linux-2.6.22-rc6-mm1.orig/mm/filemap.c
+++ linux-2.6.22-rc6-mm1/mm/filemap.c
@@ -594,7 +594,7 @@ void fastcall __lock_page_nosync(struct
* Is there a pagecache struct page at the given (mapping, offset) tuple?
* 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;
@@ -618,7 +618,7 @@ EXPORT_SYMBOL(find_get_page);
* Returns zero if the page was not present. find_lock_page() may sleep.
*/
struct page *find_lock_page(struct address_space *mapping,
- unsigned long offset)
+ pgoff_t offset)
{
struct page *page;
@@ -664,7 +664,7 @@ EXPORT_SYMBOL(find_lock_page);
* memory exhaustion.
*/
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;
int err;
@@ -794,7 +794,7 @@ EXPORT_SYMBOL(find_get_pages_tag);
* and deadlock against the caller's locked 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);
@@ -870,10 +870,10 @@ void do_generic_mapping_read(struct addr
read_actor_t actor)
{
struct inode *inode = mapping->host;
- unsigned long index;
- unsigned long offset;
- unsigned long last_index;
- unsigned long prev_index;
+ pgoff_t index;
+ pgoff_t last_index;
+ pgoff_t prev_index;
+ unsigned long offset; /* offset into pagecache page */
unsigned int prev_offset;
int error;
@@ -885,7 +885,7 @@ void do_generic_mapping_read(struct addr
for (;;) {
struct page *page;
- unsigned long end_index;
+ pgoff_t end_index;
loff_t isize;
unsigned long nr, ret;
@@ -1255,7 +1255,7 @@ EXPORT_SYMBOL(generic_file_sendfile);
static ssize_t
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)
return -EINVAL;
@@ -1275,8 +1275,8 @@ asmlinkage ssize_t sys_readahead(int fd,
if (file) {
if (file->f_mode & FMODE_READ) {
struct address_space *mapping = file->f_mapping;
- unsigned long start = offset >> PAGE_CACHE_SHIFT;
- unsigned long end = (offset + count - 1) >> PAGE_CACHE_SHIFT;
+ pgoff_t start = offset >> PAGE_CACHE_SHIFT;
+ pgoff_t end = (offset + count - 1) >> PAGE_CACHE_SHIFT;
unsigned long len = end - start + 1;
ret = do_readahead(mapping, file, start, len);
}
@@ -1294,7 +1294,7 @@ asmlinkage ssize_t sys_readahead(int fd,
* 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.
*/
-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 page *page;
@@ -1540,7 +1540,7 @@ EXPORT_SYMBOL(generic_file_mmap);
EXPORT_SYMBOL(generic_file_readonly_mmap);
static struct page *__read_cache_page(struct address_space *mapping,
- unsigned long index,
+ pgoff_t index,
int (*filler)(void *,struct page*),
void *data)
{
@@ -1574,7 +1574,7 @@ repeat:
* after submitting it to the filler.
*/
struct page *read_cache_page_async(struct address_space *mapping,
- unsigned long index,
+ pgoff_t index,
int (*filler)(void *,struct page*),
void *data)
{
@@ -1623,7 +1623,7 @@ EXPORT_SYMBOL(read_cache_page_async);
* If the page does not get brought uptodate, return -EIO.
*/
struct page *read_cache_page(struct address_space *mapping,
- unsigned long index,
+ pgoff_t index,
int (*filler)(void *,struct page*),
void *data)
{
--
prev parent reply other threads:[~2007-07-24 2:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070724020009.677809022@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 00/10] readahead cleanups and interleaved readahead take 4 Fengguang Wu
[not found] ` <20070724020041.774421091@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 01/10] readahead: compacting file_ra_state Fengguang Wu
[not found] ` <20070724020042.028909529@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 02/10] readahead: mmap read-around simplification Fengguang Wu
[not found] ` <20070724020042.135275161@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 03/10] readahead: combine file_ra_state.prev_index/prev_offset into prev_pos Fengguang Wu
2007-07-24 3:52 ` Andrew Morton
[not found] ` <20070724034801.GA7310@mail.ustc.edu.cn>
2007-07-24 3:48 ` Fengguang Wu
2007-07-24 3:55 ` Andrew Morton
[not found] ` <20070724043215.GA6317@mail.ustc.edu.cn>
2007-07-24 4:32 ` Fengguang Wu
2007-07-24 4:53 ` Andrew Morton
[not found] ` <20070724062744.GA6686@mail.ustc.edu.cn>
2007-07-24 6:27 ` Fengguang Wu
[not found] ` <20070724043708.GA6627@mail.ustc.edu.cn>
2007-07-24 4:37 ` Fengguang Wu
[not found] ` <20070724020042.319225909@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 04/10] radixtree: introduce radix_tree_scan_hole() Fengguang Wu
[not found] ` <20070724020042.426486651@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 05/10] readahead: basic support of interleaved reads Fengguang Wu
[not found] ` <20070724020042.588573597@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 06/10] readahead: remove the local copy of ra in do_generic_mapping_read() Fengguang Wu
[not found] ` <20070724020042.758542876@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 07/10] readahead: remove several readahead macros Fengguang Wu
[not found] ` <20070724020042.882116065@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 08/10] readahead: remove the limit max_sectors_kb imposed on max_readahead_kb Fengguang Wu
[not found] ` <20070724020043.064974174@mail.ustc.edu.cn>
2007-07-24 2:00 ` [PATCH 09/10] filemap: trivial code cleanups Fengguang Wu
[not found] ` <20070724020043.189132028@mail.ustc.edu.cn>
2007-07-24 2:00 ` Fengguang Wu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=385243123.75006@ustc.edu.cn \
--to=wfg@mail.ustc.edu.cn \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox