mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
readahead: fix return value of page_cache_next_miss() when no hole is found
commitbbcaee20e0
upstream. max_scan in page_cache_next_miss always decreases to zero when no hole is found, causing the return value to be index + 0. Fix this by preserving the max_scan value throughout the loop. Jan said "From what I know and have seen in the past, wrong responses from page_cache_next_miss() can lead to readahead window reduction and thus reduced read speeds." Link: https://lkml.kernel.org/r/20250605054935.2323451-1-chizhiling@163.com Fixes:901a269ff3
("filemap: fix page_cache_next_miss() when no hole found") Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Josef Bacik <josef@toxicpanda.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
617a8d148d
commit
72e849b5b1
|
@ -1750,8 +1750,9 @@ pgoff_t page_cache_next_miss(struct address_space *mapping,
|
|||
pgoff_t index, unsigned long max_scan)
|
||||
{
|
||||
XA_STATE(xas, &mapping->i_pages, index);
|
||||
unsigned long nr = max_scan;
|
||||
|
||||
while (max_scan--) {
|
||||
while (nr--) {
|
||||
void *entry = xas_next(&xas);
|
||||
if (!entry || xa_is_value(entry))
|
||||
return xas.xa_index;
|
||||
|
|
Loading…
Reference in New Issue
Block a user