diff --git a/mm/readahead.c b/mm/readahead.c index 12d8707c36e0..73fcc8671261 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -376,10 +376,10 @@ static int try_context_readahead(struct address_space *mapping, size = count_history_pages(mapping, ra, offset, max); /* - * no history pages: + * not enough history pages: * it could be a random read */ - if (!size) + if (size <= req_size) return 0; /* @@ -390,8 +390,8 @@ static int try_context_readahead(struct address_space *mapping, size *= 2; ra->start = offset; - ra->size = get_init_ra_size(size + req_size, max); - ra->async_size = ra->size; + ra->size = min(size + req_size, max); + ra->async_size = 1; return 1; }