diff --git a/mm/readahead.c b/mm/readahead.c index 16378b90843eccad3b5ec76da1565672a6577b3b..d7c6e143a1297fc4866b18b28f04be2f9aaf2ecb 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -421,6 +421,16 @@ ondemand_readahead(struct address_space *mapping, ra->async_size = ra->size > req_size ? ra->size - req_size : ra->size; readit: + /* + * Will this read hit the readahead marker made by itself? + * If so, trigger the readahead marker hit now, and merge + * the resulted next readahead window into the current one. + */ + if (offset == ra->start && ra->size == ra->async_size) { + ra->async_size = get_next_ra_size(ra, max); + ra->size += ra->async_size; + } + return ra_submit(ra, mapping, filp); }