]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
readahead: mmap read-around simplification
authorFengguang Wu <wfg@mail.ustc.edu.cn>
Tue, 16 Oct 2007 08:24:32 +0000 (01:24 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 16 Oct 2007 16:42:52 +0000 (09:42 -0700)
Fold file_ra_state.mmap_hit into file_ra_state.mmap_miss and make it an int.

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>
include/linux/fs.h
mm/filemap.c

index 7a998c49a0863bcefd87f7a29fc85b11b5ed4b0e..8250811081ff09e7f0a3dd55d5d019402aeb5ffd 100644 (file)
@@ -703,8 +703,7 @@ struct file_ra_state {
                                           there are only # of pages ahead */
 
        unsigned int ra_pages;          /* Maximum readahead window */
-       unsigned long mmap_hit;         /* Cache hit stat for mmap accesses */
-       unsigned long mmap_miss;        /* Cache miss stat for mmap accesses */
+       int mmap_miss;                  /* Cache miss stat for mmap accesses */
        unsigned long prev_index;       /* Cache last read() position */
        unsigned int prev_offset;       /* Offset where last read() ended in a page */
 };
index 15c8413ee929200006e4eb5e8a96bf5b04f0f213..5dc18d76e7032f390aa2b1686f3ee1d9664d1e2c 100644 (file)
@@ -1349,7 +1349,7 @@ retry_find:
                 * Do we miss much more than hit in this file? If so,
                 * stop bothering with read-ahead. It will only hurt.
                 */
-               if (ra->mmap_miss > ra->mmap_hit + MMAP_LOTSAMISS)
+               if (ra->mmap_miss > MMAP_LOTSAMISS)
                        goto no_cached_page;
 
                /*
@@ -1375,7 +1375,7 @@ retry_find:
        }
 
        if (!did_readaround)
-               ra->mmap_hit++;
+               ra->mmap_miss--;
 
        /*
         * We have a locked page in the page cache, now we need to check