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 2/4] page_cache_readahead: remove duplicated code
Date: Tue, 25 Jan 2005 14:59:15 +0300 [thread overview]
Message-ID: <41F63493.309B0ADB@tv-sign.ru> (raw)
Cases "no ahead window" and "crossed into ahead window"
can be unified.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 2.6.11-rc2/mm/readahead.c~ 2005-01-25 14:28:22.000000000 +0300
+++ 2.6.11-rc2/mm/readahead.c 2005-01-25 15:17:13.000000000 +0300
@@ -483,43 +483,24 @@ page_cache_readahead(struct address_spac
* occurence (ie we have an existing window)
*/
- if (ra->ahead_start == 0) { /* no ahead window yet */
- ra->ahead_size = get_next_ra_size(ra->size, max, min,
- &ra->flags);
- ra->ahead_start = ra->start + ra->size;
- block = ((offset + newsize -1) >= ra->ahead_start);
- if (!blockable_page_cache_readahead(mapping, filp,
- ra->ahead_start, ra->ahead_size, ra, block)) {
- /* A read failure in blocking mode, implies pages are
- * all cached. So we can safely assume we have taken
- * care of all the pages requested in this call. A read
- * failure in non-blocking mode, implies we are reading
- * more pages than requested in this call. So we safely
- * assume we have taken care of all the pages requested
- * in this call.
- *
- * Just reset the ahead window in case we failed due to
- * congestion. The ahead window will any way be closed
- * in case we failed due to exessive page cache hits.
- */
- ra->ahead_start = 0;
- ra->ahead_size = 0;
- goto out;
- }
- }
/*
- * Already have an ahead window, check if we crossed into it.
+ * Check if we crossed into ahead window.
* If so, shift windows and issue a new ahead window.
* Only return the #pages that are in the current window, so that
* we get called back on the first page of the ahead window which
* will allow us to submit more IO.
*/
if ((offset + newsize - 1) >= ra->ahead_start) {
- ra->start = ra->ahead_start;
- ra->size = ra->ahead_size;
- ra->ahead_start = ra->ahead_start + ra->ahead_size;
- ra->ahead_size = get_next_ra_size(ra->ahead_size,
- max, min, &ra->flags);
+ /* Check if we already have an ahead window */
+ if (ra->ahead_start != 0) {
+ ra->start = ra->ahead_start;
+ ra->size = ra->ahead_size;
+ }
+
+ ra->ahead_size = get_next_ra_size(ra->size, max, min,
+ &ra->flags);
+ ra->ahead_start = ra->start + ra->size;
+
block = ((offset + newsize - 1) >= ra->ahead_start);
if (!blockable_page_cache_readahead(mapping, filp,
ra->ahead_start, ra->ahead_size, ra, block)) {
next reply other threads:[~2005-01-25 10:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-25 11:59 Oleg Nesterov [this message]
2005-01-25 21:46 ` [PATCH 2/4] page_cache_readahead: remove duplicated code Steven Pratt
2005-01-26 0:08 ` Ram
2005-01-26 0:16 ` Steven Pratt
2005-01-26 12:02 ` Oleg Nesterov
2005-01-28 20:13 ` Ram
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=41F63493.309B0ADB@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;
as well as URLs for NNTP newsgroup(s).