* 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
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);