diff options
Diffstat (limited to 'mm/readahead.c')
-rw-r--r-- | mm/readahead.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mm/readahead.c b/mm/readahead.c index e4ed04149785..7cdbb44aa90b 100644 --- a/mm/readahead.c +++ b/mm/readahead.c | |||
@@ -401,6 +401,7 @@ ondemand_readahead(struct address_space *mapping, | |||
401 | unsigned long req_size) | 401 | unsigned long req_size) |
402 | { | 402 | { |
403 | unsigned long max = max_sane_readahead(ra->ra_pages); | 403 | unsigned long max = max_sane_readahead(ra->ra_pages); |
404 | pgoff_t prev_offset; | ||
404 | 405 | ||
405 | /* | 406 | /* |
406 | * start of file | 407 | * start of file |
@@ -452,8 +453,11 @@ ondemand_readahead(struct address_space *mapping, | |||
452 | 453 | ||
453 | /* | 454 | /* |
454 | * sequential cache miss | 455 | * sequential cache miss |
456 | * trivial case: (offset - prev_offset) == 1 | ||
457 | * unaligned reads: (offset - prev_offset) == 0 | ||
455 | */ | 458 | */ |
456 | if (offset - (ra->prev_pos >> PAGE_CACHE_SHIFT) <= 1UL) | 459 | prev_offset = (unsigned long long)ra->prev_pos >> PAGE_CACHE_SHIFT; |
460 | if (offset - prev_offset <= 1UL) | ||
457 | goto initial_readahead; | 461 | goto initial_readahead; |
458 | 462 | ||
459 | /* | 463 | /* |
@@ -569,7 +573,7 @@ static ssize_t | |||
569 | do_readahead(struct address_space *mapping, struct file *filp, | 573 | do_readahead(struct address_space *mapping, struct file *filp, |
570 | pgoff_t index, unsigned long nr) | 574 | pgoff_t index, unsigned long nr) |
571 | { | 575 | { |
572 | if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) | 576 | if (!mapping || !mapping->a_ops) |
573 | return -EINVAL; | 577 | return -EINVAL; |
574 | 578 | ||
575 | force_page_cache_readahead(mapping, filp, index, nr); | 579 | force_page_cache_readahead(mapping, filp, index, nr); |