2006-05-30 08:47:32

by Wu Fengguang

[permalink] [raw]
Subject: [patch 3/4] readahead: context based method - fix *remain counting

*remain in query_page_cache_segment() is over counted by 1, fix it.

Signed-off-by: Wu Fengguang <[email protected]>
---


--- linux-2.6.17-rc4-mm3.orig/mm/readahead.c
+++ linux-2.6.17-rc4-mm3/mm/readahead.c
@@ -1334,7 +1334,7 @@ static unsigned long query_page_cache_se
index = radix_tree_scan_hole_backward(&mapping->page_tree,
offset - 1, ra_max);

- *remain = offset - index;
+ *remain = (offset - 1) - index;

if (offset == ra->readahead_index && ra_cache_hit_ok(ra))
count = *remain;

--