mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Cc: Steven Pratt <[email protected]> Cc: Ram Pai <[email protected]> Cc: Rusty Russell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
f615bfca46
commit
5ce1110b92
2 changed files with 83 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue