diff options
| author | Jan Kara <[email protected]> | 2024-06-25 10:18:52 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-07-04 02:30:27 +0000 |
| commit | 901a269ff3d59c9ee0e6be35c6044dc4bf2c0fdf (patch) | |
| tree | ae361b503c084f389eb319eecda6ca11120de5b9 /mm/filemap.c | |
| parent | readahead: make sure sync readahead reads needed page (diff) | |
| download | kernel-901a269ff3d59c9ee0e6be35c6044dc4bf2c0fdf.tar.gz kernel-901a269ff3d59c9ee0e6be35c6044dc4bf2c0fdf.zip | |
filemap: fix page_cache_next_miss() when no hole found
page_cache_next_miss() should return value outside of the specified range
when no hole is found. However currently it will return the last index
*in* the specified range confusing ondemand_readahead() to think there's a
hole in the searched range and upsetting readahead logic.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Jan Kara <[email protected]>
Reviewed-by: Josef Bacik <[email protected]>
Tested-by: Zhang Peng <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/filemap.c')
| -rw-r--r-- | mm/filemap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index ea2d44fcd326..f8858429508b 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1752,12 +1752,12 @@ pgoff_t page_cache_next_miss(struct address_space *mapping, while (max_scan--) { void *entry = xas_next(&xas); if (!entry || xa_is_value(entry)) - break; + return xas.xa_index; if (xas.xa_index == 0) - break; + return 0; } - return xas.xa_index; + return index + max_scan; } EXPORT_SYMBOL(page_cache_next_miss); |
