Skip to content

Commit 7b774aa

Browse files
author
Matthew Wilcox (Oracle)
committed
shmem: Convert part of shmem_undo_range() to use a folio
find_lock_entries() never returns tail pages. We cannot use page_folio() here as the pagevec may also contain swap entries, so simply cast for now. This is an intermediate step which will be fully removed by the end of this series. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: William Kucharski <[email protected]>
1 parent 3506659 commit 7b774aa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mm/shmem.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -936,22 +936,22 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
936936
while (index < end && find_lock_entries(mapping, index, end - 1,
937937
&pvec, indices)) {
938938
for (i = 0; i < pagevec_count(&pvec); i++) {
939-
struct page *page = pvec.pages[i];
939+
struct folio *folio = (struct folio *)pvec.pages[i];
940940

941941
index = indices[i];
942942

943-
if (xa_is_value(page)) {
943+
if (xa_is_value(folio)) {
944944
if (unfalloc)
945945
continue;
946946
nr_swaps_freed += !shmem_free_swap(mapping,
947-
index, page);
947+
index, folio);
948948
continue;
949949
}
950-
index += thp_nr_pages(page) - 1;
950+
index += folio_nr_pages(folio) - 1;
951951

952-
if (!unfalloc || !PageUptodate(page))
953-
truncate_inode_page(mapping, page);
954-
unlock_page(page);
952+
if (!unfalloc || !folio_test_uptodate(folio))
953+
truncate_inode_page(mapping, &folio->page);
954+
folio_unlock(folio);
955955
}
956956
pagevec_remove_exceptionals(&pvec);
957957
pagevec_release(&pvec);

0 commit comments

Comments
 (0)