diff options
author | Fengguang Wu <wfg@mail.ustc.edu.cn> | 2007-07-19 04:47:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:44 -0400 |
commit | 5ce1110b92b31d079aa443e967f43a2294e01194 (patch) | |
tree | eff95b4c8ede07d0777ca68a30d686d1acbb5c73 /mm | |
parent | f615bfca468c9b80ed2d09be5fdbaf470a32c045 (diff) |
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 <wfg@mail.ustc.edu.cn>
Cc: Steven Pratt <slpratt@austin.ibm.com>
Cc: Ram Pai <linuxram@us.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/readahead.c | 19 |
1 files changed, 19 insertions, 0 deletions
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) | |||
592 | return min(nr, (node_page_state(numa_node_id(), NR_INACTIVE) | 592 | return min(nr, (node_page_state(numa_node_id(), NR_INACTIVE) |
593 | + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); | 593 | + node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2); |
594 | } | 594 | } |
595 | |||
596 | /* | ||
597 | * Submit IO for the read-ahead request in file_ra_state. | ||
598 | */ | ||
599 | unsigned long ra_submit(struct file_ra_state *ra, | ||
600 | struct address_space *mapping, struct file *filp) | ||
601 | { | ||
602 | unsigned long ra_size; | ||
603 | unsigned long la_size; | ||
604 | int actual; | ||
605 | |||
606 | ra_size = ra_readahead_size(ra); | ||
607 | la_size = ra_lookahead_size(ra); | ||
608 | actual = __do_page_cache_readahead(mapping, filp, | ||
609 | ra->ra_index, ra_size, la_size); | ||
610 | |||
611 | return actual; | ||
612 | } | ||
613 | EXPORT_SYMBOL_GPL(ra_submit); | ||