Skip to content

Commit 584f60b

Browse files
Matthew Wilcox (Oracle)aalexandrovich
authored andcommitted
ntfs3: Convert ntfs_get_frame_pages() to use a folio
The function still takes an array of pages, but use a folio internally. This function would deadlock against itself if used with large folios (as it locks each page), so we can be a little sloppy with the conversion back from folio to page for now. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent 326a6fd commit 584f60b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

fs/ntfs3/file.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -821,23 +821,24 @@ static int ntfs_get_frame_pages(struct address_space *mapping, pgoff_t index,
821821
*frame_uptodate = true;
822822

823823
for (npages = 0; npages < pages_per_frame; npages++, index++) {
824-
struct page *page;
824+
struct folio *folio;
825825

826-
page = find_or_create_page(mapping, index, gfp_mask);
827-
if (!page) {
826+
folio = __filemap_get_folio(mapping, index,
827+
FGP_LOCK | FGP_ACCESSED | FGP_CREAT, gfp_mask);
828+
if (IS_ERR(folio)) {
828829
while (npages--) {
829-
page = pages[npages];
830-
unlock_page(page);
831-
put_page(page);
830+
folio = page_folio(pages[npages]);
831+
folio_unlock(folio);
832+
folio_put(folio);
832833
}
833834

834835
return -ENOMEM;
835836
}
836837

837-
if (!PageUptodate(page))
838+
if (!folio_test_uptodate(folio))
838839
*frame_uptodate = false;
839840

840-
pages[npages] = page;
841+
pages[npages] = &folio->page;
841842
}
842843

843844
return 0;

0 commit comments

Comments
 (0)