From: Christoph Lameter <clameter@sgi.com>
To: akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Cc: David Chinner <dgc@sgi.com>
Subject: [patch 13/18] Use page_cache_xxx in fs/splice.c
Date: Fri, 15 Feb 2008 16:47:31 -0800 [thread overview]
Message-ID: <20080216004808.555486121@sgi.com> (raw)
In-Reply-To: 20080216004718.047808297@sgi.com
[-- Attachment #1: 0014-Use-page_cache_xxx-in-fs-splice.c.patch --]
[-- Type: text/plain, Size: 3454 bytes --]
Use page_cache_xxx in fs/splice.c
Reviewed-by: Dave Chinner <dgc@sgi.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/splice.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
Index: linux-2.6/fs/splice.c
===================================================================
--- linux-2.6.orig/fs/splice.c 2008-02-14 15:19:13.645515948 -0800
+++ linux-2.6/fs/splice.c 2008-02-15 16:15:07.021124374 -0800
@@ -285,9 +285,9 @@ __generic_file_splice_read(struct file *
.spd_release = spd_release_page,
};
- index = *ppos >> PAGE_CACHE_SHIFT;
- loff = *ppos & ~PAGE_CACHE_MASK;
- req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
+ loff = page_cache_offset(mapping, *ppos);
+ req_pages = page_cache_next(mapping, len + loff);
nr_pages = min(req_pages, (unsigned)PIPE_BUFFERS);
/*
@@ -342,7 +342,7 @@ __generic_file_splice_read(struct file *
* Now loop over the map and see if we need to start IO on any
* pages, fill in the partial map, etc.
*/
- index = *ppos >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
nr_pages = spd.nr_pages;
spd.nr_pages = 0;
for (page_nr = 0; page_nr < nr_pages; page_nr++) {
@@ -354,7 +354,8 @@ __generic_file_splice_read(struct file *
/*
* this_len is the max we'll use from this page
*/
- this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff);
+ this_len = min_t(unsigned long, len,
+ page_cache_size(mapping) - loff);
page = pages[page_nr];
if (PageReadahead(page))
@@ -414,7 +415,7 @@ fill_it:
* i_size must be checked after PageUptodate.
*/
isize = i_size_read(mapping->host);
- end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(mapping, isize - 1);
if (unlikely(!isize || index > end_index))
break;
@@ -428,7 +429,7 @@ fill_it:
/*
* max good bytes in this page
*/
- plen = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
+ plen = page_cache_offset(mapping, isize - 1) + 1;
if (plen <= loff)
break;
@@ -453,7 +454,7 @@ fill_it:
*/
while (page_nr < nr_pages)
page_cache_release(pages[page_nr++]);
- in->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
+ in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
if (spd.nr_pages)
return splice_to_pipe(pipe, &spd);
@@ -579,11 +580,11 @@ static int pipe_to_file(struct pipe_inod
if (unlikely(ret))
return ret;
- offset = sd->pos & ~PAGE_CACHE_MASK;
+ offset = page_cache_offset(mapping, sd->pos);
this_len = sd->len;
- if (this_len + offset > PAGE_CACHE_SIZE)
- this_len = PAGE_CACHE_SIZE - offset;
+ if (this_len + offset > page_cache_size(mapping))
+ this_len = page_cache_size(mapping) - offset;
ret = pagecache_write_begin(file, mapping, sd->pos, this_len,
AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
@@ -790,7 +791,7 @@ generic_file_splice_write_nolock(struct
unsigned long nr_pages;
*ppos += ret;
- nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ nr_pages = page_cache_next(mapping, ret);
/*
* If file or inode is SYNC and we actually wrote some data,
@@ -852,7 +853,7 @@ generic_file_splice_write(struct pipe_in
unsigned long nr_pages;
*ppos += ret;
- nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ nr_pages = page_cache_next(mapping, ret);
/*
* If file or inode is SYNC and we actually wrote some data,
--
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Lameter <clameter@sgi.com>
To: akpm@linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
David Chinner <dgc@sgi.com>
Subject: [patch 13/18] Use page_cache_xxx in fs/splice.c
Date: Fri, 15 Feb 2008 16:47:31 -0800 [thread overview]
Message-ID: <20080216004808.555486121@sgi.com> (raw)
In-Reply-To: 20080216004718.047808297@sgi.com
[-- Attachment #1: 0014-Use-page_cache_xxx-in-fs-splice.c.patch --]
[-- Type: text/plain, Size: 3680 bytes --]
Use page_cache_xxx in fs/splice.c
Reviewed-by: Dave Chinner <dgc@sgi.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/splice.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
Index: linux-2.6/fs/splice.c
===================================================================
--- linux-2.6.orig/fs/splice.c 2008-02-14 15:19:13.645515948 -0800
+++ linux-2.6/fs/splice.c 2008-02-15 16:15:07.021124374 -0800
@@ -285,9 +285,9 @@ __generic_file_splice_read(struct file *
.spd_release = spd_release_page,
};
- index = *ppos >> PAGE_CACHE_SHIFT;
- loff = *ppos & ~PAGE_CACHE_MASK;
- req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
+ loff = page_cache_offset(mapping, *ppos);
+ req_pages = page_cache_next(mapping, len + loff);
nr_pages = min(req_pages, (unsigned)PIPE_BUFFERS);
/*
@@ -342,7 +342,7 @@ __generic_file_splice_read(struct file *
* Now loop over the map and see if we need to start IO on any
* pages, fill in the partial map, etc.
*/
- index = *ppos >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
nr_pages = spd.nr_pages;
spd.nr_pages = 0;
for (page_nr = 0; page_nr < nr_pages; page_nr++) {
@@ -354,7 +354,8 @@ __generic_file_splice_read(struct file *
/*
* this_len is the max we'll use from this page
*/
- this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff);
+ this_len = min_t(unsigned long, len,
+ page_cache_size(mapping) - loff);
page = pages[page_nr];
if (PageReadahead(page))
@@ -414,7 +415,7 @@ fill_it:
* i_size must be checked after PageUptodate.
*/
isize = i_size_read(mapping->host);
- end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(mapping, isize - 1);
if (unlikely(!isize || index > end_index))
break;
@@ -428,7 +429,7 @@ fill_it:
/*
* max good bytes in this page
*/
- plen = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
+ plen = page_cache_offset(mapping, isize - 1) + 1;
if (plen <= loff)
break;
@@ -453,7 +454,7 @@ fill_it:
*/
while (page_nr < nr_pages)
page_cache_release(pages[page_nr++]);
- in->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
+ in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
if (spd.nr_pages)
return splice_to_pipe(pipe, &spd);
@@ -579,11 +580,11 @@ static int pipe_to_file(struct pipe_inod
if (unlikely(ret))
return ret;
- offset = sd->pos & ~PAGE_CACHE_MASK;
+ offset = page_cache_offset(mapping, sd->pos);
this_len = sd->len;
- if (this_len + offset > PAGE_CACHE_SIZE)
- this_len = PAGE_CACHE_SIZE - offset;
+ if (this_len + offset > page_cache_size(mapping))
+ this_len = page_cache_size(mapping) - offset;
ret = pagecache_write_begin(file, mapping, sd->pos, this_len,
AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
@@ -790,7 +791,7 @@ generic_file_splice_write_nolock(struct
unsigned long nr_pages;
*ppos += ret;
- nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ nr_pages = page_cache_next(mapping, ret);
/*
* If file or inode is SYNC and we actually wrote some data,
@@ -852,7 +853,7 @@ generic_file_splice_write(struct pipe_in
unsigned long nr_pages;
*ppos += ret;
- nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ nr_pages = page_cache_next(mapping, ret);
/*
* If file or inode is SYNC and we actually wrote some data,
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-02-16 0:48 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-16 0:47 [patch 00/18] Page cache: Replace PAGE_CACHE_xx with inline functions V4 Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 01/18] Define functions for page cache handling Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-23 23:27 ` Andrew Morton
2008-02-23 23:27 ` Andrew Morton
2008-02-27 19:20 ` Christoph Lameter
2008-02-27 19:20 ` Christoph Lameter
2008-02-16 0:47 ` [patch 02/18] Use page_cache_xxx functions in mm/filemap.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 03/18] Use page_cache_xxx in mm/page-writeback.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 04/18] Use page_cache_xxx in mm/truncate.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 05/18] Use page_cache_xxx in mm/rmap.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 06/18] Use page_cache_xxx in mm/filemap_xip.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 07/18] Use page_cache_xxx in mm/migrate.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 08/18] Use page_cache_xxx in fs/libfs.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 09/18] Use page_cache_xxx in fs/sync Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 10/18] Use page_cache_xxx in fs/buffer.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 11/18] Use page_cache_xxx in mm/mpage.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 12/18] Use page_cache_xxx in mm/fadvise.c Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter [this message]
2008-02-16 0:47 ` [patch 13/18] Use page_cache_xxx in fs/splice.c Christoph Lameter
2008-02-16 0:47 ` [patch 14/18] Use page_cache_xxx in ext2 Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 15/18] Use page_cache_xxx in fs/ext3 Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 16/18] Use page_cache_xxx in fs/ext4 Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 17/18] Use page_cache_xxx in fs/reiserfs Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
2008-02-16 0:47 ` [patch 18/18] Use page_cache_xxx for fs/xfs Christoph Lameter
2008-02-16 0:47 ` Christoph Lameter
-- strict thread matches above, loose matches on Subject: below --
2007-12-27 5:32 [patch 00/18] Page cache: Replace PAGE_CACHE_xx with inline functions V3 Christoph Lameter
2007-12-27 5:32 ` [patch 13/18] Use page_cache_xxx in fs/splice.c Christoph Lameter
2007-12-27 5:32 ` Christoph Lameter
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=20080216004808.555486121@sgi.com \
--to=clameter@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.