Skip to contentSkip to conversation

mm/readahead: Handle ractl nr_pages being modified

PATCH New Matthew Wilcox (Oracle) 1 participant 1 message Apr 21, 2021

Subsystems (3)
lore
Share & tools
lore

Matthew Wilcox (Oracle)

author maintainer
#0 lore raw

PATCH v2 1/1 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.

---
 mm/readahead.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/readahead.c +2 -2
index f02dbebf1cef..d589f147f4c2 100644
@@ -198,8 +198,6 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
 	for (i = 0; i < nr_to_read; i++) {
 		struct page *page = xa_load(&mapping->i_pages, index + i);
 
-		BUG_ON(index + i != ractl->_index + ractl->_nr_pages);
-
 		if (page && !xa_is_value(page)) {
 			/*
 			 * Page already present?  Kick off the current batch
@@ -210,6 +208,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
 			 * not worth getting one just for that.
 			 */
 			read_pages(ractl, &page_pool, true);
+			i = ractl->_index + ractl->_nr_pages - index - 1;
 			continue;
 		}
 
@@ -223,6 +222,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
 					gfp_mask) < 0) {
 			put_page(page);
 			read_pages(ractl, &page_pool, true);
+			i = ractl->_index + ractl->_nr_pages - index - 1;
 			continue;
 		}
 		if (i == nr_to_read - lookahead_size)
Signature · 1 line
2.30.2