Commit f48d0ebf authored by Miquel van Smoorenburg's avatar Miquel van Smoorenburg Committed by Linus Torvalds

[PATCH] mark-page-accessed in filemap.c not quite right

I just discovered there's a thinko in the mark-page-accessed change in
do_generic_mapping_read() in 2.6.11-rc1.  ra.prev_page is compared to index
to see if we read from this page before - except that prev_page is actually
set to the recent page or even a page in front of the current page.

So we should store ra.prev_page in a seperate variable at the start of
do_generic_mapping_read().
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 32616461
...@@ -693,6 +693,7 @@ void do_generic_mapping_read(struct address_space *mapping, ...@@ -693,6 +693,7 @@ void do_generic_mapping_read(struct address_space *mapping,
unsigned long offset; unsigned long offset;
unsigned long req_size; unsigned long req_size;
unsigned long next_index; unsigned long next_index;
unsigned long prev_index;
loff_t isize; loff_t isize;
struct page *cached_page; struct page *cached_page;
int error; int error;
...@@ -701,6 +702,7 @@ void do_generic_mapping_read(struct address_space *mapping, ...@@ -701,6 +702,7 @@ void do_generic_mapping_read(struct address_space *mapping,
cached_page = NULL; cached_page = NULL;
index = *ppos >> PAGE_CACHE_SHIFT; index = *ppos >> PAGE_CACHE_SHIFT;
next_index = index; next_index = index;
prev_index = ra.prev_page;
req_size = (desc->count + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; req_size = (desc->count + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
offset = *ppos & ~PAGE_CACHE_MASK; offset = *ppos & ~PAGE_CACHE_MASK;
...@@ -754,8 +756,9 @@ void do_generic_mapping_read(struct address_space *mapping, ...@@ -754,8 +756,9 @@ void do_generic_mapping_read(struct address_space *mapping,
* When (part of) the same page is read multiple times * When (part of) the same page is read multiple times
* in succession, only mark it as accessed the first time. * in succession, only mark it as accessed the first time.
*/ */
if (ra.prev_page != index) if (prev_index != index)
mark_page_accessed(page); mark_page_accessed(page);
prev_index = index;
/* /*
* Ok, we have the page, and it's up-to-date, so * Ok, we have the page, and it's up-to-date, so
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment