From: clameter@sgi.com
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@infradead.org>
Subject: [patch 14/14] Use page_cache_xx in fs/splice.c
Date: Thu, 14 Jun 2007 12:38:53 -0700 [thread overview]
Message-ID: <20070614194055.697260443@sgi.com> (raw)
In-Reply-To: 20070614193839.878721298@sgi.com
[-- Attachment #1: vps_fs_splice --]
[-- Type: text/plain, Size: 2822 bytes --]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/splice.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
Index: vps/fs/splice.c
===================================================================
--- vps.orig/fs/splice.c 2007-06-09 22:18:02.000000000 -0700
+++ vps/fs/splice.c 2007-06-09 22:22:08.000000000 -0700
@@ -282,9 +282,9 @@ __generic_file_splice_read(struct file *
.ops = &page_cache_pipe_buf_ops,
};
- index = *ppos >> PAGE_CACHE_SHIFT;
- loff = *ppos & ~PAGE_CACHE_MASK;
- nr_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
+ loff = page_cache_offset(mapping, *ppos);
+ nr_pages = page_cache_next(mapping, len + loff);
if (nr_pages > PIPE_BUFFERS)
nr_pages = PIPE_BUFFERS;
@@ -345,7 +345,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++) {
@@ -357,7 +357,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))
@@ -416,7 +417,7 @@ __generic_file_splice_read(struct file *
* i_size must be checked after ->readpage().
*/
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;
@@ -425,7 +426,8 @@ __generic_file_splice_read(struct file *
* the length and stop
*/
if (end_index == index) {
- loff = PAGE_CACHE_SIZE - (isize & ~PAGE_CACHE_MASK);
+ loff = page_cache_size(mapping)
+ - page_cache_offset(mapping, isize);
if (total_len + loff > isize)
break;
/*
@@ -557,6 +559,7 @@ static int pipe_to_file(struct pipe_inod
struct page *page;
void *fsdata;
int ret;
+ int pagesize = page_cache_size(mapping);
/*
* make sure the data in this buffer is uptodate
@@ -565,11 +568,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 > pagesize)
+ this_len = pagesize - offset;
ret = pagecache_write_begin(file, mapping, sd->pos, sd->len,
AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
--
next prev parent reply other threads:[~2007-06-14 19:45 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-14 19:38 [patch 00/14] Page cache cleanup in anticipation of Large Blocksize support clameter
2007-06-14 19:38 ` [patch 01/14] Define functions for page cache handling clameter
2007-06-14 19:56 ` Sam Ravnborg
2007-06-14 19:58 ` Christoph Lameter
2007-06-14 20:07 ` Sam Ravnborg
2007-06-14 19:38 ` [patch 02/14] Pagecache zeroing: zero_user_segment, zero_user_segments and zero_user clameter
2007-06-14 19:38 ` [patch 03/14] Use page_cache_xx function in mm/filemap.c clameter
2007-06-14 19:38 ` [patch 04/14] Use page_cache_xxx in mm/page-writeback.c clameter
2007-06-14 19:38 ` [patch 05/14] Use page_cache_xxx in mm/truncate.c clameter
2007-06-14 19:38 ` [patch 06/14] Use page_cache_xxx in mm/rmap.c clameter
2007-06-14 19:38 ` [patch 07/14] Use page_cache_xx in mm/filemap_xip.c clameter
2007-06-14 19:38 ` [patch 08/14] Use page_cache_xx in mm/migrate.c clameter
2007-06-14 19:38 ` [patch 09/14] Use page_cache_xx in fs/libfs.c clameter
2007-06-14 19:38 ` [patch 10/14] Use page_cache_xx in fs/sync clameter
2007-06-14 19:38 ` [patch 11/14] Use page_cache_xx in fs/buffer.c clameter
2007-06-14 19:38 ` [patch 12/14] Use page_cache_xxx in mm/mpage.c clameter
2007-06-14 19:38 ` [patch 13/14] Use page_cache_xxx in mm/fadvise.c clameter
2007-06-14 19:38 ` clameter [this message]
2007-06-14 20:06 ` [patch 00/14] Page cache cleanup in anticipation of Large Blocksize support Andrew Morton
2007-06-14 21:07 ` Christoph Hellwig
2007-06-14 21:25 ` Dave McCracken
2007-06-14 21:20 ` Christoph Lameter
2007-06-14 21:32 ` Andrew Morton
2007-06-14 21:37 ` Christoph Lameter
2007-06-14 22:04 ` Andrew Morton
2007-06-14 22:22 ` Christoph Lameter
2007-06-14 22:49 ` Andrew Morton
2007-06-15 0:45 ` Christoph Lameter
2007-06-15 1:40 ` Andrew Morton
2007-06-15 2:04 ` Christoph Lameter
2007-06-15 2:23 ` Andrew Morton
2007-06-15 2:37 ` Christoph Lameter
2007-06-15 9:03 ` David Chinner
2007-06-14 23:30 ` David Chinner
2007-06-14 23:41 ` Andrew Morton
2007-06-15 0:29 ` David Chinner
2007-06-15 15:05 ` Dave Kleikamp
2007-06-17 1:25 ` Arjan van de Ven
2007-06-17 5:02 ` Matt Mackall
2007-06-18 2:08 ` Christoph Lameter
2007-06-18 3:00 ` Arjan van de Ven
2007-06-18 4:50 ` William Lee Irwin III
2007-06-14 23:54 ` David Chinner
2007-07-02 18:16 ` Badari Pulavarty
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=20070614194055.697260443@sgi.com \
--to=clameter@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.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