aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <[email protected]>2020-06-01 21:46:36 -0700
committerLinus Torvalds <[email protected]>2020-06-02 10:59:06 -0700
commitef8153b609aa9302f1e727218068b84ac8b060e4 (patch)
tree611006e2d0ca119e22ea4a954091c7f21165f132
parentc2c7ad74b16206e0e6e9e80af962e63da778acf9 (diff)
mm: remove 'page_offset' from readahead loop
Replace the page_offset variable with 'index + i'. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: John Hubbard <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: William Kucharski <[email protected]> Cc: Chao Yu <[email protected]> Cc: Cong Wang <[email protected]> Cc: Darrick J. Wong <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Eric Biggers <[email protected]> Cc: Gao Xiang <[email protected]> Cc: Jaegeuk Kim <[email protected]> Cc: Joseph Qi <[email protected]> Cc: Junxiao Bi <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Zi Yan <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Miklos Szeredi <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/readahead.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/readahead.c b/mm/readahead.c
index 7ce320854bad..ddc63d3b07b8 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -180,12 +180,10 @@ void __do_page_cache_readahead(struct address_space *mapping,
* Preallocate as many pages as we will need.
*/
for (i = 0; i < nr_to_read; i++) {
- pgoff_t page_offset = index + i;
-
- if (page_offset > end_index)
+ if (index + i > end_index)
break;
- page = xa_load(&mapping->i_pages, page_offset);
+ page = xa_load(&mapping->i_pages, index + i);
if (page && !xa_is_value(page)) {
/*
* Page already present? Kick off the current batch of
@@ -199,7 +197,7 @@ void __do_page_cache_readahead(struct address_space *mapping,
page = __page_cache_alloc(gfp_mask);
if (!page)
break;
- page->index = page_offset;
+ page->index = index + i;
list_add(&page->lru, &page_pool);
if (i == nr_to_read - lookahead_size)
SetPageReadahead(page);