Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61566
b: refs/heads/master
c: 46fc3e7
h: refs/heads/master
v: v3
  • Loading branch information
Fengguang Wu authored and Linus Torvalds committed Jul 19, 2007
1 parent 78d8091 commit 2f79f35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d77c2d7cc5126639a47d73300b40d461f2811a0f
refs/heads/master: 46fc3e7b4e7233a0ac981ac9084b55217318d04d
15 changes: 9 additions & 6 deletions trunk/mm/readahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ static int read_pages(struct address_space *mapping, struct file *filp,
*/
static int
__do_page_cache_readahead(struct address_space *mapping, struct file *filp,
pgoff_t offset, unsigned long nr_to_read)
pgoff_t offset, unsigned long nr_to_read,
unsigned long lookahead_size)
{
struct inode *inode = mapping->host;
struct page *page;
Expand All @@ -278,7 +279,7 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
if (isize == 0)
goto out;

end_index = ((isize - 1) >> PAGE_CACHE_SHIFT);
end_index = ((isize - 1) >> PAGE_CACHE_SHIFT);

/*
* Preallocate as many pages as we will need.
Expand All @@ -301,6 +302,8 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
break;
page->index = page_offset;
list_add(&page->lru, &page_pool);
if (page_idx == nr_to_read - lookahead_size)
SetPageReadahead(page);
ret++;
}
read_unlock_irq(&mapping->tree_lock);
Expand Down Expand Up @@ -337,7 +340,7 @@ int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
if (this_chunk > nr_to_read)
this_chunk = nr_to_read;
err = __do_page_cache_readahead(mapping, filp,
offset, this_chunk);
offset, this_chunk, 0);
if (err < 0) {
ret = err;
break;
Expand Down Expand Up @@ -384,7 +387,7 @@ int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
if (bdi_read_congested(mapping->backing_dev_info))
return -1;

return __do_page_cache_readahead(mapping, filp, offset, nr_to_read);
return __do_page_cache_readahead(mapping, filp, offset, nr_to_read, 0);
}

/*
Expand All @@ -404,7 +407,7 @@ blockable_page_cache_readahead(struct address_space *mapping, struct file *filp,
if (!block && bdi_read_congested(mapping->backing_dev_info))
return 0;

actual = __do_page_cache_readahead(mapping, filp, offset, nr_to_read);
actual = __do_page_cache_readahead(mapping, filp, offset, nr_to_read, 0);

return check_ra_success(ra, nr_to_read, actual);
}
Expand Down Expand Up @@ -449,7 +452,7 @@ static int make_ahead_window(struct address_space *mapping, struct file *filp,
* @req_size: hint: total size of the read which the caller is performing in
* PAGE_CACHE_SIZE units
*
* page_cache_readahead() is the main function. If performs the adaptive
* page_cache_readahead() is the main function. It performs the adaptive
* readahead window size management and submits the readahead I/O.
*
* Note that @filp is purely used for passing on to the ->readpage[s]()
Expand Down

0 comments on commit 2f79f35

Please sign in to comment.