public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][BUG 10227] readahead ret value fix
@ 2008-03-14 10:49 Dave Young
  2008-03-14 11:08 ` Dave Young
       [not found] ` <E1Ja8Ih-0005kr-0V@localhost>
  0 siblings, 2 replies; 3+ messages in thread
From: Dave Young @ 2008-03-14 10:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: wfg, akpm, jack, chris

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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][BUG 10227] readahead ret value fix
  2008-03-14 10:49 [PATCH][BUG 10227] readahead ret value fix Dave Young
@ 2008-03-14 11:08 ` Dave Young
       [not found] ` <E1Ja8Ih-0005kr-0V@localhost>
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Young @ 2008-03-14 11:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: wfg, akpm, jack, chris

On Fri, Mar 14, 2008 at 6:49 PM, Dave Young <hidave.darkstar@gmail.com> wrote:
> 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);
>

It's not right at all,  sorry for the wrong quick patch.

Anyway, please see the following debug info of me
Mar 14 18:33:51 darkstar kernel: [   19.073085] 3c59x: Donald Becker and others.
Mar 14 18:34:39 darkstar kernel: [  117.837850] #0 page_offset : 0,
end_index : 2 ret: 0
Mar 14 18:34:39 darkstar kernel: [  117.837854] #1 page_offset : 0,
end_index : 2
Mar 14 18:34:39 darkstar kernel: [  117.837861] #0 page_offset : 1,
end_index : 2 ret: 1
Mar 14 18:34:39 darkstar kernel: [  117.837873] #1 page_offset : 1,
end_index : 2
Mar 14 18:34:39 darkstar kernel: [  117.837888] #0 page_offset : 2,
end_index : 2 ret: 2
Mar 14 18:34:39 darkstar kernel: [  117.837911] #1 page_offset : 2,
end_index : 2
Mar 14 18:34:39 darkstar kernel: [  117.837922] #0 page_offset : 3,
end_index : 2 ret: 3
Mar 14 18:34:40 darkstar kernel: [  118.051620] #0 page_offset : 3,
end_index : 2 ret: 0
Mar 14 18:34:40 darkstar kernel: [  118.051626] zisofs : req invalid

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][BUG 10227] readahead ret value fix
       [not found] ` <E1Ja8Ih-0005kr-0V@localhost>
@ 2008-03-14 11:42   ` Fengguang Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Fengguang Wu @ 2008-03-14 11:42 UTC (permalink / raw)
  To: Dave Young; +Cc: linux-kernel, akpm, jack, chris

On Fri, Mar 14, 2008 at 06:49:06PM +0800, Dave Young wrote:
> If the page_offset > end_index, the return value should be updated to 0,
> avoiding the redundant read_pages

No, we don't need to fix it, hehe.
It's really trivial overhead.

The principle is to not add dispensable code :-)

Thank you,
Fengguang


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-14 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-14 10:49 [PATCH][BUG 10227] readahead ret value fix Dave Young
2008-03-14 11:08 ` Dave Young
     [not found] ` <E1Ja8Ih-0005kr-0V@localhost>
2008-03-14 11:42   ` Fengguang Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox