Skip to content

Commit 901a269

Browse files
jankaraakpm00
authored andcommitted
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]>
1 parent 8051b82 commit 901a269

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/filemap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,12 +1752,12 @@ pgoff_t page_cache_next_miss(struct address_space *mapping,
17521752
while (max_scan--) {
17531753
void *entry = xas_next(&xas);
17541754
if (!entry || xa_is_value(entry))
1755-
break;
1755+
return xas.xa_index;
17561756
if (xas.xa_index == 0)
1757-
break;
1757+
return 0;
17581758
}
17591759

1760-
return xas.xa_index;
1760+
return index + max_scan;
17611761
}
17621762
EXPORT_SYMBOL(page_cache_next_miss);
17631763

0 commit comments

Comments
 (0)