readahead: apply max_sane_readahead() limit in ondemand_readahead()
authorWu Fengguang <fengguang.wu@intel.com>
Tue, 16 Jun 2009 22:31:21 +0000 (15:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Jun 2009 02:47:28 +0000 (19:47 -0700)
Just in case someone aggressively sets a huge readahead size.

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/readahead.c

index a224182a3a63c36cbaea10411f1697173e724ca4..bd0f0e88b0a124a2872a349287fb2cf4e36d2f48 100644 (file)
@@ -357,7 +357,7 @@ ondemand_readahead(struct address_space *mapping,
                   bool hit_readahead_marker, pgoff_t offset,
                   unsigned long req_size)
 {
-       int     max = ra->ra_pages;     /* max readahead pages */
+       unsigned long max = max_sane_readahead(ra->ra_pages);
        pgoff_t prev_offset;
        int     sequential;