]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
mm: remove 'page_offset' from readahead loop
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 2 Jun 2020 04:46:36 +0000 (21:46 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 2 Jun 2020 17:59:06 +0000 (10:59 -0700)
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>
mm/readahead.c

index 7ce320854badca6201782763b86c2553c39e8cc8..ddc63d3b07b8ddaa1ad48a71c67061eabacf9122 100644 (file)
@@ -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);