[PATCH 9/9] readahead: call max_sane_readahead() in ondemand_readahead()

Fengguang Wu
2007-12-16T12:05:44Z

[-- Attachment #1: readahead-check-max_sane_readahead2.patch --]
[-- Type: text/plain, Size: 747 bytes --]

Apply the max_sane_readahead() limit in ondemand_readahead().
Just in case someone aggressively set a huge readahead size.

Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
---
mm/readahead.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.24-rc4-mm1.orig/mm/readahead.c
+++ linux-2.6.24-rc4-mm1/mm/readahead.c
@@ -324,9 +324,9 @@ ondemand_readahead(struct address_space
bool hit_readahead_marker, pgoff_t offset,
unsigned long req_size)
{
- int max = ra->ra_pages; /* max readahead pages */
pgoff_t prev_offset;
- int sequential;
+ int sequential;
+ int max = max_sane_readahead(ra->ra_pages); /* max readahead pages */

/*
* It's the expected callback offset, assume sequential access.

--