From 5ce1110b92b31d079aa443e967f43a2294e01194 Mon Sep 17 00:00:00 2001 From: Fengguang Wu Date: Thu, 19 Jul 2007 01:47:59 -0700 Subject: readahead: data structure and routines Extend struct file_ra_state to support the on-demand readahead logic. Also define some helpers for it. Signed-off-by: Fengguang Wu Cc: Steven Pratt Cc: Ram Pai Cc: Rusty Russell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/readahead.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mm') diff --git a/mm/readahead.c b/mm/readahead.c index 7f9bf588c936..072ce8f8357d 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -592,3 +592,22 @@ unsigned long max_sane_readahead(unsigned long nr) return min(nr, (node_page_state(numa_node_id(), NR_INACTIVE) + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); } + +/* + * Submit IO for the read-ahead request in file_ra_state. + */ +unsigned long ra_submit(struct file_ra_state *ra, + struct address_space *mapping, struct file *filp) +{ + unsigned long ra_size; + unsigned long la_size; + int actual; + + ra_size = ra_readahead_size(ra); + la_size = ra_lookahead_size(ra); + actual = __do_page_cache_readahead(mapping, filp, + ra->ra_index, ra_size, la_size); + + return actual; +} +EXPORT_SYMBOL_GPL(ra_submit); -- cgit v1.2.2