Skip to content

Commit f615bd5

Browse files
Matthew Wilcox (Oracle)dhowells
authored andcommitted
mm/readahead: Handle ractl nr_pages being modified
Filesystems are not currently permitted to modify the number of pages in the ractl. An upcoming patch to add readahead_expand() changes that rule, so remove the check and resync the loop counter after every call to the filesystem. Tested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: David Howells <dhowells@redhat.com> Link: https://lore.kernel.org/r/20210420200116.3715790-1-willy@infradead.org/ Link: https://lore.kernel.org/r/20210421170923.4005574-1-willy@infradead.org/ # v2
1 parent c790fbf commit f615bd5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mm/readahead.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
198198
for (i = 0; i < nr_to_read; i++) {
199199
struct page *page = xa_load(&mapping->i_pages, index + i);
200200

201-
BUG_ON(index + i != ractl->_index + ractl->_nr_pages);
202-
203201
if (page && !xa_is_value(page)) {
204202
/*
205203
* Page already present? Kick off the current batch
@@ -210,6 +208,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
210208
* not worth getting one just for that.
211209
*/
212210
read_pages(ractl, &page_pool, true);
211+
i = ractl->_index + ractl->_nr_pages - index - 1;
213212
continue;
214213
}
215214

@@ -223,6 +222,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
223222
gfp_mask) < 0) {
224223
put_page(page);
225224
read_pages(ractl, &page_pool, true);
225+
i = ractl->_index + ractl->_nr_pages - index - 1;
226226
continue;
227227
}
228228
if (i == nr_to_read - lookahead_size)

0 commit comments

Comments
 (0)