summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mm/readahead.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/readahead.c b/mm/readahead.c
index 16378b90843e..d7c6e143a129 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);
}