--- mm/filemap.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) Index: slub/mm/filemap.c =================================================================== --- slub.orig/mm/filemap.c 2007-06-04 14:56:23.000000000 -0700 +++ slub/mm/filemap.c 2007-06-04 15:12:31.000000000 -0700 @@ -927,7 +927,8 @@ find_page: if (!page) { page_cache_readahead_ondemand(mapping, &ra, filp, page, - index, last_index - index); + index, last_index - index, + NULL, 0); page = find_get_page(mapping, index); if (unlikely(page == NULL)) goto no_cached_page; @@ -935,7 +936,8 @@ find_page: if (PageReadahead(page)) { page_cache_readahead_ondemand(mapping, &ra, filp, page, - index, last_index - index); + index, last_index - index, + NULL, 0); } if (!PageUptodate(page)) goto page_not_up_to_date; @@ -1288,13 +1290,15 @@ EXPORT_SYMBOL(generic_file_sendfile); static ssize_t do_readahead(struct address_space *mapping, struct file *filp, - unsigned long index, unsigned long nr) + unsigned long index, unsigned long nr, + struct vm_area_struct *vma, unsigned long addr) { if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) return -EINVAL; force_page_cache_readahead(mapping, filp, index, - max_sane_readahead(nr)); + max_sane_readahead(nr), + vma, addr); return 0; } @@ -1311,7 +1315,7 @@ asmlinkage ssize_t sys_readahead(int fd, unsigned long start = offset >> PAGE_CACHE_SHIFT; unsigned long end = (offset + count - 1) >> PAGE_CACHE_SHIFT; unsigned long len = end - start + 1; - ret = do_readahead(mapping, file, start, len); + ret = do_readahead(mapping, file, start, len, NULL, 0); } fput(file); } @@ -1319,7 +1323,6 @@ asmlinkage ssize_t sys_readahead(int fd, } #ifdef CONFIG_MMU -static int FASTCALL(page_cache_read(struct file * file, unsigned long offset)); /** * page_cache_read - adds requested page to the page cache if not already there * @file: file to read @@ -1328,14 +1331,15 @@ static int FASTCALL(page_cache_read(stru * This adds the requested page to the page cache if it isn't already there, * and schedules an I/O to read in its contents from disk. */ -static int fastcall page_cache_read(struct file * file, unsigned long offset) +static int fastcall page_cache_read(struct file * file, unsigned long offset, + struct vm_area_struct *vma, unsigned long addr) { struct address_space *mapping = file->f_mapping; struct page *page; int ret; do { - page = page_cache_alloc_cold(mapping, NULL, 0); + page = page_cache_alloc_cold(mapping, vma, addr); if (!page) return -ENOMEM; @@ -1400,14 +1404,14 @@ retry_find: if (VM_SequentialReadHint(vma)) { if (!page) { page_cache_readahead_ondemand(mapping, ra, file, page, - fdata->pgoff, 1); + fdata->pgoff, 1, vma, fdata->address); page = find_lock_page(mapping, fdata->pgoff); if (!page) goto no_cached_page; } if (PageReadahead(page)) { page_cache_readahead_ondemand(mapping, ra, file, page, - fdata->pgoff, 1); + fdata->pgoff, 1, vma, fdata->address); } } @@ -1438,7 +1442,8 @@ retry_find: if (fdata->pgoff > ra_pages / 2) start = fdata->pgoff - ra_pages / 2; - do_page_cache_readahead(mapping, file, start, ra_pages); + do_page_cache_readahead(mapping, file, start, ra_pages, + vma, fdata->address); } page = find_lock_page(mapping, fdata->pgoff); if (!page) @@ -1484,7 +1489,7 @@ no_cached_page: * We're only likely to ever get here if MADV_RANDOM is in * effect. */ - error = page_cache_read(file, fdata->pgoff); + error = page_cache_read(file, fdata->pgoff, vma, fdata->address); /* * The page we want has now been added to the page cache.