Skip to contentSkip to conversation

readahead-properly-shorten-readahead-when-falling-back-to-do_page_cache_ra.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jun 29, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: readahead: properly shorten readahead when falling back to do_page_cache_ra()
has been removed from the -mm tree. Its filename was
readahead-properly-shorten-readahead-when-falling-back-to-do_page_cache_ra.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Jan Kara <[email protected]>
Subject: readahead: properly shorten readahead when falling back to do_page_cache_ra()
Date: Tue, 25 Jun 2024 12:18:53 +0200

When we succeed in creating some folios in page_cache_ra_order() but then need to fallback to single page folios, we don't shorten the amount to read passed to do_page_cache_ra() by the amount we've already read. This then results in reading more and also in placing another readahead mark in the middle of the readahead window which confuses readahead code. Fix the problem by properly reducing number of pages to read.

---

 mm/readahead.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/readahead.c renamed from mm/readahead.c~readahead-properly-shorten-readahead-when-falling-back-to-do_page_cache_ra +3 -2
@@ -491,7 +491,8 @@ void page_cache_ra_order(struct readahea
 		struct file_ra_state *ra, unsigned int new_order)
 {
 	struct address_space *mapping = ractl->mapping;
-	pgoff_t index = readahead_index(ractl);
+	pgoff_t start = readahead_index(ractl);
+	pgoff_t index = start;
 	pgoff_t limit = (i_size_read(mapping->host) - 1) >> PAGE_SHIFT;
 	pgoff_t mark = index + ra->size - ra->async_size;
 	unsigned int nofs;
@@ -544,7 +545,7 @@ void page_cache_ra_order(struct readahea
 	if (!err)
 		return;
 fallback:
-	do_page_cache_ra(ractl, ra->size, ra->async_size);
+	do_page_cache_ra(ractl, ra->size - (index - start), ra->async_size);
 }
 
 /*

_

Patches currently in -mm which might be from [email protected] are