summaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorFengguang Wu <wfg@mail.ustc.edu.cn>2007-07-19 01:48:08 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 10:04:44 -0700
commitf9acc8c7b35a100f3a9e0e6977f7807b0169f9a5 (patch)
tree6a4dcd227bb698a217a1d42d37e3f0135a444ea4 /include/linux/fs.h
parentcf914a7d656e62b9dd3e0dffe4f62b953ae6048d (diff)
downloadkernel-crypto-f9acc8c7b35a100f3a9e0e6977f7807b0169f9a5.tar.gz
kernel-crypto-f9acc8c7b35a100f3a9e0e6977f7807b0169f9a5.tar.xz
kernel-crypto-f9acc8c7b35a100f3a9e0e6977f7807b0169f9a5.zip
readahead: sanify file_ra_state names
Rename some file_ra_state variables and remove some accessors. It results in much simpler code. Kudos to Rusty! Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h61
1 files changed, 6 insertions, 55 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 29cb32d3a84..d33beadd9a4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -695,16 +695,12 @@ struct fown_struct {
/*
* Track a single file's readahead state
- *
- * ================#============|==================#==================|
- * ^ ^ ^ ^
- * file_ra_state.la_index .ra_index .lookahead_index .readahead_index
*/
struct file_ra_state {
- pgoff_t la_index; /* enqueue time */
- pgoff_t ra_index; /* begin offset */
- pgoff_t lookahead_index; /* time to do next readahead */
- pgoff_t readahead_index; /* end offset */
+ pgoff_t start; /* where readahead started */
+ unsigned long size; /* # of readahead pages */
+ unsigned long async_size; /* do asynchronous readahead when
+ there are only # of pages ahead */
unsigned long ra_pages; /* Maximum readahead window */
unsigned long mmap_hit; /* Cache hit stat for mmap accesses */
@@ -714,59 +710,14 @@ struct file_ra_state {
};
/*
- * Measuring read-ahead sizes.
- *
- * |----------- readahead size ------------>|
- * ===#============|==================#=====================|
- * |------- invoke interval ------>|-- lookahead size -->|
- */
-static inline unsigned long ra_readahead_size(struct file_ra_state *ra)
-{
- return ra->readahead_index - ra->ra_index;
-}
-
-static inline unsigned long ra_lookahead_size(struct file_ra_state *ra)
-{
- return ra->readahead_index - ra->lookahead_index;
-}
-
-static inline unsigned long ra_invoke_interval(struct file_ra_state *ra)
-{
- return ra->lookahead_index - ra->la_index;
-}
-
-/*
* Check if @index falls in the readahead windows.
*/
static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
{
- return (index >= ra->la_index &&
- index < ra->readahead_index);
-}
-
-/*
- * Where is the old read-ahead and look-ahead?
- */
-static inline void ra_set_index(struct file_ra_state *ra,
- pgoff_t la_index, pgoff_t ra_index)
-{
- ra->la_index = la_index;
- ra->ra_index = ra_index;
+ return (index >= ra->start &&
+ index < ra->start + ra->size);
}
-/*
- * Where is the new read-ahead and look-ahead?
- */
-static inline void ra_set_size(struct file_ra_state *ra,
- unsigned long ra_size, unsigned long la_size)
-{
- ra->readahead_index = ra->ra_index + ra_size;
- ra->lookahead_index = ra->ra_index + ra_size - la_size;
-}
-
-unsigned long ra_submit(struct file_ra_state *ra,
- struct address_space *mapping, struct file *filp);
-
struct file {
/*
* fu_list becomes invalid after file_free is called and queued via