2007-01-27 08:25:00

by Wu Fengguang

[permalink] [raw]
Subject: [PATCH 7/8] readahead: call scheme: fix thrashed unaligned read

When doing unaligned/subpages sequential reads, and thrashing happened,
it is possible that (offset == prev_page),
besides the normal (offset == prev_page + 1).

We do not have such problem for the state based method.

Signed-off-by: Fengguang Wu <[email protected]>
---
mm/readahead.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.20-rc4-mm1.orig/mm/readahead.c
+++ linux-2.6.20-rc4-mm1/mm/readahead.c
@@ -1618,7 +1618,7 @@ page_cache_readahead_adaptive(struct add
/*
* Recover from possible thrashing.
*/
- if (!page && offset == ra->prev_page + 1 && ra_has_index(ra, offset))
+ if (!page && offset - ra->prev_page <= 1 && ra_has_index(ra, offset))
return thrashing_recovery_readahead(mapping, filp, ra,
offset, ra_max);


--