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>
This commit is contained in:
parent
c2c7ad74b1
commit
ef8153b609
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue