aboutsummaryrefslogtreecommitdiffstats
path: root/mm/readahead.c
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2009-06-16 18:31:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 22:47:29 -0400
commitd30a11004e3411909f2448546f036a011978062e (patch)
treec1980adb410d9fabd2c2eb8af9f0ed8ee4b656da /mm/readahead.c
parent2fad6f5deee5556f511eab58da78737a23ddb35d (diff)
readahead: record mmap read-around states in file_ra_state
Mmap read-around now shares the same code style and data structure with readahead code. This also removes do_page_cache_readahead(). Its last user, mmap read-around, has been changed to call ra_submit(). The no-readahead-if-congested logic is dumped by the way. Users will be pretty sensitive about the slow loading of executables. So it's unfavorable to disabled mmap read-around on a congested queue. [akpm@linux-foundation.org: coding-style fixes] Cc: Nick Piggin <npiggin@suse.de> Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn> Cc: Ying Han <yinghan@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/readahead.c')
-rw-r--r--mm/readahead.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/mm/readahead.c b/mm/readahead.c
index d7c6e143a129..a7f01fcce9e7 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -133,15 +133,12 @@ out:
133} 133}
134 134
135/* 135/*
136 * do_page_cache_readahead actually reads a chunk of disk. It allocates all 136 * __do_page_cache_readahead() actually reads a chunk of disk. It allocates all
137 * the pages first, then submits them all for I/O. This avoids the very bad 137 * the pages first, then submits them all for I/O. This avoids the very bad
138 * behaviour which would occur if page allocations are causing VM writeback. 138 * behaviour which would occur if page allocations are causing VM writeback.
139 * We really don't want to intermingle reads and writes like that. 139 * We really don't want to intermingle reads and writes like that.
140 * 140 *
141 * Returns the number of pages requested, or the maximum amount of I/O allowed. 141 * Returns the number of pages requested, or the maximum amount of I/O allowed.
142 *
143 * do_page_cache_readahead() returns -1 if it encountered request queue
144 * congestion.
145 */ 142 */
146static int 143static int
147__do_page_cache_readahead(struct address_space *mapping, struct file *filp, 144__do_page_cache_readahead(struct address_space *mapping, struct file *filp,
@@ -232,22 +229,6 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
232} 229}
233 230
234/* 231/*
235 * This version skips the IO if the queue is read-congested, and will tell the
236 * block layer to abandon the readahead if request allocation would block.
237 *
238 * force_page_cache_readahead() will ignore queue congestion and will block on
239 * request queues.
240 */
241int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
242 pgoff_t offset, unsigned long nr_to_read)
243{
244 if (bdi_read_congested(mapping->backing_dev_info))
245 return -1;
246
247 return __do_page_cache_readahead(mapping, filp, offset, nr_to_read, 0);
248}
249
250/*
251 * Given a desired number of PAGE_CACHE_SIZE readahead pages, return a 232 * Given a desired number of PAGE_CACHE_SIZE readahead pages, return a
252 * sensible upper limit. 233 * sensible upper limit.
253 */ 234 */
@@ -260,7 +241,7 @@ unsigned long max_sane_readahead(unsigned long nr)
260/* 241/*
261 * Submit IO for the read-ahead request in file_ra_state. 242 * Submit IO for the read-ahead request in file_ra_state.
262 */ 243 */
263static unsigned long ra_submit(struct file_ra_state *ra, 244unsigned long ra_submit(struct file_ra_state *ra,
264 struct address_space *mapping, struct file *filp) 245 struct address_space *mapping, struct file *filp)
265{ 246{
266 int actual; 247 int actual;