[PATCH 02/10] filemap: Fix page_cache_next_miss() when no hole found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 mm/filemap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 876cc64aadd7..015efc261468 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);
 
-- 
2.35.3





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux