lkml.org 
[lkml]   [2005]   [Feb]   [3]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
 
Messages in this thread
/
DateThu, 03 Feb 2005 14:32:34 +0300
FromOleg Nesterov <>
SubjectRe: [PATCH 3/4] readahead: factor out duplicated code
Steven Pratt wrote:
>
> >+static int make_ahead_window(struct address_space *mapping, struct file *filp,
> >+		struct file_ra_state *ra, int force)
> >+{
> >+	int block, ret;
> >+
> >+	block = force || (ra->prev_page >= ra->ahead_start);
> >+	ret = blockable_page_cache_readahead(mapping, filp,
> >+			ra->ahead_start, ra->ahead_size, ra, block);
> >+
> >+	if (!ret && !force) {
> >
> This really needs to be
>
>     if (!ret && !block) {
>

Current code:

	block = offset + newsize-1 >= ra->ahead_start;
	if (!blockable_page_cache_readahead(..., block) {
		ra->ahead_start = 0;
		ra->ahead_size = 0;
	}
Patched code:
	make_ahead_window(..., 0); // force == 0
So i think the patch is correct.

> otherwise we can have an aheadwindow which was never populated which
> will cause slow reads which we want to avoid in all cases.

may be, but this patch tries not to change the current behavior.

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

\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2008