[PATCH][BUG 10227] readahead ret value fix

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dave Young
Date: Friday, March 14, 2008 - 3:49 am

If the page_offset > end_index, the return value should be updated to 0,
avoiding the redundant read_pages

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

---
mm/readahead.c |    4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff -upr linux/mm/readahead.c linux.new/mm/readahead.c
--- linux/mm/readahead.c	2008-03-14 18:38:12.000000000 +0800
+++ linux.new/mm/readahead.c	2008-03-14 18:38:58.000000000 +0800
@@ -144,8 +144,10 @@ __do_page_cache_readahead(struct address
 	for (page_idx = 0; page_idx < nr_to_read; page_idx++) {
 		pgoff_t page_offset = offset + page_idx;
 
-		if (page_offset > end_index)
+		if (page_offset > end_index) {
+			ret = 0;
 			break;
+		}
 
 		rcu_read_lock();
 		page = radix_tree_lookup(&mapping->page_tree, page_offset);
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH][BUG 10227] readahead ret value fix, Dave Young, (Fri Mar 14, 3:49 am)
Re: [PATCH][BUG 10227] readahead ret value fix, Dave Young, (Fri Mar 14, 4:08 am)
Re: [PATCH][BUG 10227] readahead ret value fix, Fengguang Wu, (Fri Mar 14, 4:42 am)