[PATCH 03/14] readahead: state based method: cancel lookahead gracefully

From: Fengguang Wu
Date: Fri Mar 16 2007 - 04:55:44 EST


When canceling lookahead, update ra->lookahead_index to the next invoke index.
So that we see a consistent state in the next time.

Signed-off-by: Fengguang Wu <wfg@xxxxxxxxxxxxxxxx>
---
mm/readahead.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

--- linux-2.6.21-rc3-mm2.orig/mm/readahead.c
+++ linux-2.6.21-rc3-mm2/mm/readahead.c
@@ -1094,7 +1094,7 @@ state_based_readahead(struct address_spa

if (page && remain_space <= la_size) {
rescue_pages(page, la_size);
- return 0;
+ goto cancel_lookahead;
}

growth_limit = req_size;
@@ -1104,7 +1104,7 @@ state_based_readahead(struct address_spa
growth_limit = ra_max;

if (!adjust_rala(growth_limit, &ra_size, &la_size))
- return 0;
+ goto cancel_lookahead;

limit_rala(growth_limit, la_old, &ra_size, &la_size);

@@ -1113,6 +1113,10 @@ state_based_readahead(struct address_spa
ra_set_size(ra, ra_size, la_size);

return ra_submit(ra, mapping, filp);
+
+cancel_lookahead:
+ ra->lookahead_index = ra->readahead_index;
+ return 0;
}

#endif /* CONFIG_ADAPTIVE_READAHEAD */

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/