From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Ram Pai <linuxram@us.ibm.com>,
Steven Pratt <slpratt@austin.ibm.com>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH 1/2] readahead: simplify ra->size testing
Date: Wed, 02 Mar 2005 22:08:28 +0300 [thread overview]
Message-ID: <42260F2C.FCAA1915@tv-sign.ru> (raw)
On top of "readahead: cleanup blockable_page_cache_readahead()",
see http://marc.theaimsgroup.com/?l=linux-kernel&m=110927049500942
Currently page_cache_readahead() treats ra->size == 0 (first read)
and ra->size == -1 (ra_off was called) separately, but does exactly
the same in both cases.
With this patch we may assume that the reading starts in 'ra_off()'
state, so we don't need to consider the first read as a special case.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.11/mm/readahead.c~ 2005-02-04 21:33:40.000000000 +0300
+++ 2.6.11/mm/readahead.c 2005-02-04 21:33:57.000000000 +0300
@@ -55,7 +55,7 @@ static inline void ra_off(struct file_ra
{
ra->start = 0;
ra->flags = 0;
- ra->size = -1;
+ ra->size = 0;
ra->ahead_start = 0;
ra->ahead_size = 0;
return;
@@ -452,7 +452,7 @@ page_cache_readahead(struct address_spac
* perturbing the readahead window expansion logic.
* If size is zero, there is no read ahead window so we need one
*/
- if (offset == ra->prev_page && req_size == 1 && ra->size != 0)
+ if (offset == ra->prev_page && req_size == 1)
goto out;
ra->prev_page = offset;
@@ -471,9 +471,7 @@ page_cache_readahead(struct address_spac
* at start of file, and grow the window fast. Or detect first
* sequential access
*/
- if ((ra->size == 0 && offset == 0) /* first io and start of file */
- || (ra->size == -1 && sequential)) {
- /* First sequential */
+ if (sequential && ra->size == 0) {
ra->size = get_init_ra_size(newsize, max);
ra->start = offset;
if (!blockable_page_cache_readahead(mapping, filp, offset,
@@ -499,7 +497,7 @@ page_cache_readahead(struct address_spac
* partial page reads and first access were handled above,
* so this must be the next page otherwise it is random
*/
- if (!sequential || (ra->size == 0)) {
+ if (!sequential) {
ra_off(ra);
blockable_page_cache_readahead(mapping, filp, offset,
newsize, ra, 1);
next reply other threads:[~2005-03-02 18:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-02 19:08 Oleg Nesterov [this message]
2005-03-03 1:59 ` [PATCH 1/2] readahead: simplify ra->size testing Andrew Morton
2005-03-03 10:08 ` Oleg Nesterov
2005-03-03 9:28 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42260F2C.FCAA1915@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxram@us.ibm.com \
--cc=slpratt@austin.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox