Commit 72e849b5 authored by Chi Zhiling's avatar Chi Zhiling Committed by Greg Kroah-Hartman
Browse files

readahead: fix return value of page_cache_next_miss() when no hole is found

commit bbcaee20 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: 901a269f ("filemap: fix page_cache_next_miss() when no hole found")
Signed-off-by: default avatarChi Zhiling <chizhiling@kylinos.cn>
Reviewed-by: default avatarJan 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 617a8d14
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment