Commit b4e089d7 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Matthew Wilcox (Oracle)

mm: remove the skip_page argument to read_pages

The skip_page argument to read_pages controls if rac->_index is
incremented before returning from the function.  Just open code that in
the callers.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
parent dfd8b4fc
...@@ -142,14 +142,14 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping) ...@@ -142,14 +142,14 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
} }
EXPORT_SYMBOL_GPL(file_ra_state_init); EXPORT_SYMBOL_GPL(file_ra_state_init);
static void read_pages(struct readahead_control *rac, bool skip_page) static void read_pages(struct readahead_control *rac)
{ {
const struct address_space_operations *aops = rac->mapping->a_ops; const struct address_space_operations *aops = rac->mapping->a_ops;
struct page *page; struct page *page;
struct blk_plug plug; struct blk_plug plug;
if (!readahead_count(rac)) if (!readahead_count(rac))
goto out; return;
blk_start_plug(&plug); blk_start_plug(&plug);
...@@ -179,10 +179,6 @@ static void read_pages(struct readahead_control *rac, bool skip_page) ...@@ -179,10 +179,6 @@ static void read_pages(struct readahead_control *rac, bool skip_page)
blk_finish_plug(&plug); blk_finish_plug(&plug);
BUG_ON(readahead_count(rac)); BUG_ON(readahead_count(rac));
out:
if (skip_page)
rac->_index++;
} }
/** /**
...@@ -235,7 +231,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, ...@@ -235,7 +231,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
* have a stable reference to this page, and it's * have a stable reference to this page, and it's
* not worth getting one just for that. * not worth getting one just for that.
*/ */
read_pages(ractl, true); read_pages(ractl);
ractl->_index++;
i = ractl->_index + ractl->_nr_pages - index - 1; i = ractl->_index + ractl->_nr_pages - index - 1;
continue; continue;
} }
...@@ -246,7 +243,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, ...@@ -246,7 +243,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
if (filemap_add_folio(mapping, folio, index + i, if (filemap_add_folio(mapping, folio, index + i,
gfp_mask) < 0) { gfp_mask) < 0) {
folio_put(folio); folio_put(folio);
read_pages(ractl, true); read_pages(ractl);
ractl->_index++;
i = ractl->_index + ractl->_nr_pages - index - 1; i = ractl->_index + ractl->_nr_pages - index - 1;
continue; continue;
} }
...@@ -260,7 +258,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl, ...@@ -260,7 +258,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
* uptodate then the caller will launch readpage again, and * uptodate then the caller will launch readpage again, and
* will then handle the error. * will then handle the error.
*/ */
read_pages(ractl, false); read_pages(ractl);
filemap_invalidate_unlock_shared(mapping); filemap_invalidate_unlock_shared(mapping);
memalloc_nofs_restore(nofs); memalloc_nofs_restore(nofs);
} }
...@@ -534,7 +532,7 @@ void page_cache_ra_order(struct readahead_control *ractl, ...@@ -534,7 +532,7 @@ void page_cache_ra_order(struct readahead_control *ractl,
ra->async_size += index - limit - 1; ra->async_size += index - limit - 1;
} }
read_pages(ractl, false); read_pages(ractl);
/* /*
* If there were already pages in the page cache, then we may have * If there were already pages in the page cache, then we may have
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment