readahead: move max_sane_readahead() calls into force_page_cache_readahead()
authorWu Fengguang <fengguang.wu@intel.com>
Tue, 16 Jun 2009 22:31:20 +0000 (15:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Jun 2009 02:47:28 +0000 (19:47 -0700)
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>
mm/fadvise.c
mm/filemap.c
mm/madvise.c
mm/readahead.c

index 54a0f8040afa339a7e2f0cb459fd5b23c3d16acf..e43359214f6ff15020b6f05cc07aa5e6ddcb4162 100644 (file)
@@ -101,7 +101,7 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
                
                ret = force_page_cache_readahead(mapping, file,
                                start_index,
-                               max_sane_readahead(nrpages));
+                               nrpages);
                if (ret > 0)
                        ret = 0;
                break;
index 1b60f30cebfa88aa135c17173ec9ce831612fa90..dcef9fd6b92e30327d6c92da5e3d3de8532cbeba 100644 (file)
@@ -1390,8 +1390,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
        if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
                return -EINVAL;
 
-       force_page_cache_readahead(mapping, filp, index,
-                                       max_sane_readahead(nr));
+       force_page_cache_readahead(mapping, filp, index, nr);
        return 0;
 }
 
index b9ce574827c8a2a48b972f0261decc234edf9e27..e994dcb479d6126719d49a9f7a04b0511d3cef0c 100644 (file)
@@ -123,8 +123,7 @@ static long madvise_willneed(struct vm_area_struct * vma,
                end = vma->vm_end;
        end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
-       force_page_cache_readahead(file->f_mapping,
-                       file, start, max_sane_readahead(end - start));
+       force_page_cache_readahead(file->f_mapping, file, start, end - start);
        return 0;
 }
 
index 133b6d525513a886247ce3adc5eff41ef4e91752..a224182a3a63c36cbaea10411f1697173e724ca4 100644 (file)
@@ -210,6 +210,7 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
        if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
                return -EINVAL;
 
+       nr_to_read = max_sane_readahead(nr_to_read);
        while (nr_to_read) {
                int err;