2005-01-25 10:55:45

by Oleg Nesterov

[permalink] [raw]
Subject: [PATCH 1/4] page_cache_readahead: unneeded prev_page assignments

There is no point in setting ra->prev_page before 'goto out',
it will be overwritten anyway.

Signed-off-by: Oleg Nesterov <[email protected]>

--- 2.6.11-rc2/mm/readahead.c~ Wed Jan 12 11:44:55 2005
+++ 2.6.11-rc2/mm/readahead.c Mon Jan 24 20:19:38 2005
@@ -432,7 +432,6 @@ page_cache_readahead(struct address_spac

if (newsize == 0 || (ra->flags & RA_FLAG_INCACHE)) {
newsize = 1;
- ra->prev_page = offset;
goto out; /* No readahead or file already in cache */
}
/*
@@ -443,7 +442,6 @@ page_cache_readahead(struct address_spac
if ((ra->size == 0 && offset == 0) /* first io and start of file */
|| (ra->size == -1 && ra->prev_page == offset - 1)) {
/* First sequential */
- ra->prev_page = offset + newsize - 1;
ra->size = get_init_ra_size(newsize, max);
ra->start = offset;
if (!blockable_page_cache_readahead(mapping, filp, offset,
@@ -475,7 +473,6 @@ page_cache_readahead(struct address_spac
*/
if ((offset != (ra->prev_page+1) || (ra->size == 0))) {
ra_off(ra);
- ra->prev_page = offset + newsize - 1;
blockable_page_cache_readahead(mapping, filp, offset,
newsize, ra, 1);
goto out;
@@ -545,7 +542,7 @@ page_cache_readahead(struct address_spac

out:
ra->prev_page = offset + newsize - 1;
- return(newsize);
+ return newsize;
}

/*


2005-01-25 22:42:55

by Steven Pratt

[permalink] [raw]
Subject: Re: [PATCH 1/4] page_cache_readahead: unneeded prev_page assignments

Looks fine, thought we had some reason for it in the past, but it will
definitly be overwritten.

Signed-off-by: Steven Pratt <[email protected]>

Oleg Nesterov wrote:

>There is no point in setting ra->prev_page before 'goto out',
>it will be overwritten anyway.
>
>Signed-off-by: Oleg Nesterov <[email protected]>
>
>--- 2.6.11-rc2/mm/readahead.c~ Wed Jan 12 11:44:55 2005
>+++ 2.6.11-rc2/mm/readahead.c Mon Jan 24 20:19:38 2005
>@@ -432,7 +432,6 @@ page_cache_readahead(struct address_spac
>
> if (newsize == 0 || (ra->flags & RA_FLAG_INCACHE)) {
> newsize = 1;
>- ra->prev_page = offset;
> goto out; /* No readahead or file already in cache */
> }
> /*
>@@ -443,7 +442,6 @@ page_cache_readahead(struct address_spac
> if ((ra->size == 0 && offset == 0) /* first io and start of file */
> || (ra->size == -1 && ra->prev_page == offset - 1)) {
> /* First sequential */
>- ra->prev_page = offset + newsize - 1;
> ra->size = get_init_ra_size(newsize, max);
> ra->start = offset;
> if (!blockable_page_cache_readahead(mapping, filp, offset,
>@@ -475,7 +473,6 @@ page_cache_readahead(struct address_spac
> */
> if ((offset != (ra->prev_page+1) || (ra->size == 0))) {
> ra_off(ra);
>- ra->prev_page = offset + newsize - 1;
> blockable_page_cache_readahead(mapping, filp, offset,
> newsize, ra, 1);
> goto out;
>@@ -545,7 +542,7 @@ page_cache_readahead(struct address_spac
>
> out:
> ra->prev_page = offset + newsize - 1;
>- return(newsize);
>+ return newsize;
> }
>
> /*
>
>