mm/shmem: fix shmem folio swapoff hang

Shmem swapoff makes no progress: the index to indices is not incremented. 
But "ret" is no longer a return value, so use folio_batch_count() instead.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: da08e9b793 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()")
Signed-off-by: Hugh Dickins <[email protected]>
Reviewed-by: Miaohe Lin <[email protected]>
Tested-by: Miaohe Lin <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
Hugh Dickins authored and akpm committed 2022-05-25 10:47:47 -07:00
1 parent 7fb6378701
commit e384200e70
1 file changed
+1 -2
+1 -2
View File
@@ -1164,7 +1164,6 @@ static int shmem_find_swap_entries(struct address_space *mapping,
XA_STATE(xas, &mapping->i_pages, start);
struct folio *folio;
swp_entry_t entry;
unsigned int ret = 0;
rcu_read_lock();
xas_for_each(&xas, folio, ULONG_MAX) {
@@ -1178,7 +1177,7 @@ static int shmem_find_swap_entries(struct address_space *mapping,
if (swp_type(entry) != type)
continue;
indices[ret] = xas.xa_index;
indices[folio_batch_count(fbatch)] = xas.xa_index;
if (!folio_batch_add(fbatch, folio))
break;