From b710231f8499f8e86c831e446ce36a10104b5176 Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Tue, 16 Jun 2009 15:31:30 -0700 Subject: [PATCH] --- yaml --- r: 151511 b: refs/heads/master c: d30a11004e3411909f2448546f036a011978062e h: refs/heads/master i: 151509: 9068e76b085690f7a34655ea84d727c632d2f27a 151507: 951bba1af942ea80bdec48f38d5ebfdb4b60a2a9 151503: c2f91bcf949f2cc85dc52fbd993bb29c7fe56ec0 v: v3 --- [refs] | 2 +- trunk/include/linux/mm.h | 5 +++-- trunk/mm/filemap.c | 12 +++++++----- trunk/mm/readahead.c | 23 ++--------------------- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/[refs] b/[refs] index bb0f747f577e..d4600c62f0b7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2fad6f5deee5556f511eab58da78737a23ddb35d +refs/heads/master: d30a11004e3411909f2448546f036a011978062e diff --git a/trunk/include/linux/mm.h b/trunk/include/linux/mm.h index ad613ed66ab0..33da7f538841 100644 --- a/trunk/include/linux/mm.h +++ b/trunk/include/linux/mm.h @@ -1178,8 +1178,6 @@ void task_dirty_inc(struct task_struct *tsk); #define VM_MAX_READAHEAD 128 /* kbytes */ #define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ -int do_page_cache_readahead(struct address_space *mapping, struct file *filp, - pgoff_t offset, unsigned long nr_to_read); int force_page_cache_readahead(struct address_space *mapping, struct file *filp, pgoff_t offset, unsigned long nr_to_read); @@ -1197,6 +1195,9 @@ void page_cache_async_readahead(struct address_space *mapping, unsigned long size); unsigned long max_sane_readahead(unsigned long nr); +unsigned long ra_submit(struct file_ra_state *ra, + struct address_space *mapping, + struct file *filp); /* Do stack extension */ extern int expand_stack(struct vm_area_struct *vma, unsigned long address); diff --git a/trunk/mm/filemap.c b/trunk/mm/filemap.c index 5c0c6518f341..734891d0663d 100644 --- a/trunk/mm/filemap.c +++ b/trunk/mm/filemap.c @@ -1488,13 +1488,15 @@ static void do_sync_mmap_readahead(struct vm_area_struct *vma, 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); } } diff --git a/trunk/mm/readahead.c b/trunk/mm/readahead.c index d7c6e143a129..a7f01fcce9e7 100644 --- a/trunk/mm/readahead.c +++ b/trunk/mm/readahead.c @@ -133,15 +133,12 @@ static int read_pages(struct address_space *mapping, struct file *filp, } /* - * do_page_cache_readahead actually reads a chunk of disk. It allocates all + * __do_page_cache_readahead() actually reads a chunk of disk. It allocates all * the pages first, then submits them all for I/O. This avoids the very bad * behaviour which would occur if page allocations are causing VM writeback. * We really don't want to intermingle reads and writes like that. * * Returns the number of pages requested, or the maximum amount of I/O allowed. - * - * do_page_cache_readahead() returns -1 if it encountered request queue - * congestion. */ static int __do_page_cache_readahead(struct address_space *mapping, struct file *filp, @@ -231,22 +228,6 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp, return ret; } -/* - * This version skips the IO if the queue is read-congested, and will tell the - * block layer to abandon the readahead if request allocation would block. - * - * force_page_cache_readahead() will ignore queue congestion and will block on - * request queues. - */ -int do_page_cache_readahead(struct address_space *mapping, struct file *filp, - pgoff_t offset, unsigned long nr_to_read) -{ - if (bdi_read_congested(mapping->backing_dev_info)) - return -1; - - return __do_page_cache_readahead(mapping, filp, offset, nr_to_read, 0); -} - /* * Given a desired number of PAGE_CACHE_SIZE readahead pages, return a * sensible upper limit. @@ -260,7 +241,7 @@ unsigned long max_sane_readahead(unsigned long nr) /* * Submit IO for the read-ahead request in file_ra_state. */ -static unsigned long ra_submit(struct file_ra_state *ra, +unsigned long ra_submit(struct file_ra_state *ra, struct address_space *mapping, struct file *filp) { int actual;