[PATCH 6/9] readahead: save mmap read-around states in file_ra_state
From: Fengguang Wu
Date: Fri Dec 21 2007 - 20:35:57 EST
Change mmap read-around to share the same code style and data structure
with readahead code.
Signed-off-by: Fengguang Wu <wfg@xxxxxxxxxxxxxxxx>
---
mm/filemap.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
--- linux-2.6.24-rc5-mm1.orig/mm/filemap.c
+++ linux-2.6.24-rc5-mm1/mm/filemap.c
@@ -1334,13 +1334,15 @@ static void do_sync_mmap_readahead(struc
if (ra->mmap_miss > MMAP_LOTSAMISS)
return;
+ /*
+ * mmap read-around
+ */
ra_pages = max_sane_readahead(ra->ra_pages);
if (ra_pages) {
- pgoff_t start = 0;
-
- if (offset > ra_pages / 2)
- start = offset - ra_pages / 2;
- do_page_cache_readahead(mapping, file, start, ra_pages);
+ ra->start = max_t(long, 0, offset - ra_pages / 2);
+ ra->size = ra_pages;
+ ra->async_size = 0;
+ ra_submit(ra, mapping, file);
}
}
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/