Skip to content

Commit b4e089d

Browse files
Christoph HellwigMatthew Wilcox (Oracle)
authored andcommitted
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
1 parent dfd8b4f commit b4e089d

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

mm/readahead.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
142142
}
143143
EXPORT_SYMBOL_GPL(file_ra_state_init);
144144

145-
static void read_pages(struct readahead_control *rac, bool skip_page)
145+
static void read_pages(struct readahead_control *rac)
146146
{
147147
const struct address_space_operations *aops = rac->mapping->a_ops;
148148
struct page *page;
149149
struct blk_plug plug;
150150

151151
if (!readahead_count(rac))
152-
goto out;
152+
return;
153153

154154
blk_start_plug(&plug);
155155

@@ -179,10 +179,6 @@ static void read_pages(struct readahead_control *rac, bool skip_page)
179179
blk_finish_plug(&plug);
180180

181181
BUG_ON(readahead_count(rac));
182-
183-
out:
184-
if (skip_page)
185-
rac->_index++;
186182
}
187183

188184
/**
@@ -235,7 +231,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
235231
* have a stable reference to this page, and it's
236232
* not worth getting one just for that.
237233
*/
238-
read_pages(ractl, true);
234+
read_pages(ractl);
235+
ractl->_index++;
239236
i = ractl->_index + ractl->_nr_pages - index - 1;
240237
continue;
241238
}
@@ -246,7 +243,8 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
246243
if (filemap_add_folio(mapping, folio, index + i,
247244
gfp_mask) < 0) {
248245
folio_put(folio);
249-
read_pages(ractl, true);
246+
read_pages(ractl);
247+
ractl->_index++;
250248
i = ractl->_index + ractl->_nr_pages - index - 1;
251249
continue;
252250
}
@@ -260,7 +258,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
260258
* uptodate then the caller will launch readpage again, and
261259
* will then handle the error.
262260
*/
263-
read_pages(ractl, false);
261+
read_pages(ractl);
264262
filemap_invalidate_unlock_shared(mapping);
265263
memalloc_nofs_restore(nofs);
266264
}
@@ -534,7 +532,7 @@ void page_cache_ra_order(struct readahead_control *ractl,
534532
ra->async_size += index - limit - 1;
535533
}
536534

537-
read_pages(ractl, false);
535+
read_pages(ractl);
538536

539537
/*
540538
* If there were already pages in the page cache, then we may have

0 commit comments

Comments
 (0)