Commit 0bb7ba6b authored by Fengguang Wu's avatar Fengguang Wu Committed by Linus Torvalds

readahead: mmap read-around simplification

Fold file_ra_state.mmap_hit into file_ra_state.mmap_miss and make it an int.
Signed-off-by: default avatarFengguang Wu <wfg@mail.ustc.edu.cn>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 937085aa
...@@ -703,8 +703,7 @@ struct file_ra_state { ...@@ -703,8 +703,7 @@ struct file_ra_state {
there are only # of pages ahead */ there are only # of pages ahead */
unsigned int ra_pages; /* Maximum readahead window */ unsigned int ra_pages; /* Maximum readahead window */
unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ int mmap_miss; /* Cache miss stat for mmap accesses */
unsigned long mmap_miss; /* Cache miss stat for mmap accesses */
unsigned long prev_index; /* Cache last read() position */ unsigned long prev_index; /* Cache last read() position */
unsigned int prev_offset; /* Offset where last read() ended in a page */ unsigned int prev_offset; /* Offset where last read() ended in a page */
}; };
......
...@@ -1349,7 +1349,7 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -1349,7 +1349,7 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
* Do we miss much more than hit in this file? If so, * Do we miss much more than hit in this file? If so,
* stop bothering with read-ahead. It will only hurt. * 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; goto no_cached_page;
/* /*
...@@ -1375,7 +1375,7 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -1375,7 +1375,7 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
} }
if (!did_readaround) if (!did_readaround)
ra->mmap_hit++; ra->mmap_miss--;
/* /*
* We have a locked page in the page cache, now we need to check * We have a locked page in the page cache, now we need to check
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment