Skip to content

Commit

Permalink
readahead: move max_sane_readahead() calls into force_page_cache_read…
Browse files Browse the repository at this point in the history
…ahead()

Impact: code simplification.

Cc: Nick Piggin <[email protected]>
Signed-off-by: Wu Fengguang <[email protected]>
Cc: Ying Han <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wu Fengguang authored and torvalds committed Jun 17, 2009
1 parent 1ebf26a commit f7e839d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mm/fadvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions mm/readahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit f7e839d

Please sign in to comment.