Thread (28 messages) 28 messages, 2 authors, 2012-10-17
STALE4995d

[PATCH 2/5] mm/readahead: Change the condition for SetPageReadahead

From: <hidden>
Date: 2012-09-22 10:33:41
Subsystem: memory management, page cache, the rest · Maintainers: Andrew Morton, Matthew Wilcox, Linus Torvalds

From: Raghavendra D Prabhu <redacted>

If page lookup from radix_tree_lookup is successful and its index page_idx ==
nr_to_read - lookahead_size, then SetPageReadahead never gets called, so this
fixes that.

Signed-off-by: Raghavendra D Prabhu <redacted>
---
 mm/readahead.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/readahead.c b/mm/readahead.c
index 461fcc0..fec726c 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -189,8 +189,10 @@ __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)
+		if (page_idx >= nr_to_read - lookahead_size) {
 			SetPageReadahead(page);
+			lookahead_size = 0;
+		}
 		ret++;
 	}
 
-- 
1.7.12.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help