提交 f7e839dd 编写于 作者: W Wu Fengguang 提交者: Linus Torvalds

readahead: move max_sane_readahead() calls into force_page_cache_readahead()

Impact: code simplification.

Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
Cc: Ying Han <yinghan@google.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 1ebf26a9
...@@ -101,7 +101,7 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) ...@@ -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, ret = force_page_cache_readahead(mapping, file,
start_index, start_index,
max_sane_readahead(nrpages)); nrpages);
if (ret > 0) if (ret > 0)
ret = 0; ret = 0;
break; break;
......
...@@ -1390,8 +1390,7 @@ do_readahead(struct address_space *mapping, struct file *filp, ...@@ -1390,8 +1390,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage)
return -EINVAL; return -EINVAL;
force_page_cache_readahead(mapping, filp, index, force_page_cache_readahead(mapping, filp, index, nr);
max_sane_readahead(nr));
return 0; return 0;
} }
......
...@@ -123,8 +123,7 @@ static long madvise_willneed(struct vm_area_struct * vma, ...@@ -123,8 +123,7 @@ static long madvise_willneed(struct vm_area_struct * vma,
end = vma->vm_end; end = vma->vm_end;
end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
force_page_cache_readahead(file->f_mapping, force_page_cache_readahead(file->f_mapping, file, start, end - start);
file, start, max_sane_readahead(end - start));
return 0; return 0;
} }
......
...@@ -210,6 +210,7 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp, ...@@ -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)) if (unlikely(!mapping->a_ops->readpage && !mapping->a_ops->readpages))
return -EINVAL; return -EINVAL;
nr_to_read = max_sane_readahead(nr_to_read);
while (nr_to_read) { while (nr_to_read) {
int err; int err;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册