mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
readahead: improve heuristic detecting sequential reads
Introduce ra.offset and store in it an offset where the previous read ended. This way we can detect whether reads are really sequential (and thus we should not mark the page as accessed repeatedly) or whether they are random and just happen to be in the same page (and the page should really be marked accessed again). Signed-off-by: Jan Kara <jack@suse.cz> Acked-by: Nick Piggin <nickpiggin@yahoo.com.au> Cc: WU Fengguang <wfg@mail.ustc.edu.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b813e931b4
commit
ec0f163722
3 changed files with 10 additions and 3 deletions
|
@ -702,6 +702,7 @@ struct file_ra_state {
|
|||
unsigned long 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 */
|
||||
unsigned int offset; /* Offset where last read() ended in a page */
|
||||
};
|
||||
#define RA_FLAG_MISS 0x01 /* a cache miss occured against this file */
|
||||
#define RA_FLAG_INCACHE 0x02 /* file is already in cache */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue