summaryrefslogtreecommitdiffstats
path: root/mm/readahead.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-06-01 21:46:36 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-06-02 10:59:06 -0700
commitef8153b609aa9302f1e727218068b84ac8b060e4 (patch)
tree611006e2d0ca119e22ea4a954091c7f21165f132 /mm/readahead.c
parentc2c7ad74b16206e0e6e9e80af962e63da778acf9 (diff)
downloadlinux-ef8153b609aa9302f1e727218068b84ac8b060e4.tar.gz
linux-ef8153b609aa9302f1e727218068b84ac8b060e4.tar.bz2
linux-ef8153b609aa9302f1e727218068b84ac8b060e4.zip
mm: remove 'page_offset' from readahead loop
Replace the page_offset variable with 'index + i'. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Cc: Chao Yu <yuchao0@huawei.com> Cc: Cong Wang <xiyou.wangcong@gmail.com> Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: Dave Chinner <dchinner@redhat.com> Cc: Eric Biggers <ebiggers@google.com> Cc: Gao Xiang <gaoxiang25@huawei.com> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Zi Yan <ziy@nvidia.com> Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com> Cc: Miklos Szeredi <mszeredi@redhat.com> Link: http://lkml.kernel.org/r/20200414150233.24495-10-willy@infradead.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/readahead.c')
-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);