aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2009-06-16 18:31:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 22:47:28 -0400
commitf7e839dd36fd940b0202cfb7d39b2a1b2dc59b1b (patch)
tree5c99332a62aa8135bd58485e7f3c22634ecdc90c
parent1ebf26a9b338534def47f307c6c8694b6dfc0a79 (diff)
readahead: move max_sane_readahead() calls into force_page_cache_readahead()
Impact: code simplification. Cc: Nick Piggin <npiggin@suse.de> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Ying Han <yinghan@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/fadvise.c2
-rw-r--r--mm/filemap.c3
-rw-r--r--mm/madvise.c3
-rw-r--r--mm/readahead.c1
4 files changed, 4 insertions, 5 deletions
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 54a0f8040afa..e43359214f6f 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -101,7 +101,7 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
101 101
102 ret = force_page_cache_readahead(mapping, file, 102 ret = force_page_cache_readahead(mapping, file,
103 start_index, 103 start_index,
104 max_sane_readahead(nrpages)); 104 nrpages);
105 if (ret > 0) 105 if (ret > 0)
106 ret = 0; 106 ret = 0;
107 break; 107 break;
diff --git a/mm/filemap.c b/mm/filemap.c
index 1b60f30cebfa..dcef9fd6b92e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1390,8 +1390,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
1390 if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) 1390 if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
1391 return -EINVAL; 1391 return -EINVAL;
1392 1392
1393 force_page_cache_readahead(mapping, filp, index, 1393 force_page_cache_readahead(mapping, filp, index, nr);
1394 max_sane_readahead(nr));
1395 return 0; 1394 return 0;
1396} 1395}
1397 1396
diff --git a/mm/madvise.c b/mm/madvise.c
index b9ce574827c8..e994dcb479d6 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -123,8 +123,7 @@ static long madvise_willneed(struct vm_area_struct * vma,
123 end = vma->vm_end; 123 end = vma->vm_end;
124 end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; 124 end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
125 125
126 force_page_cache_readahead(file->f_mapping, 126 force_page_cache_readahead(file->f_mapping, file, start, end - start);
127 file, start, max_sane_readahead(end - start));
128 return 0; 127 return 0;
129} 128}
130 129
diff --git a/mm/readahead.c b/mm/readahead.c
index 133b6d525513..a224182a3a63 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -210,6 +210,7 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
210 if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages)) 210 if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
211 return -EINVAL; 211 return -EINVAL;
212 212
213 nr_to_read = max_sane_readahead(nr_to_read);
213 while (nr_to_read) { 214 while (nr_to_read) {
214 int err; 215 int err;
215 216