Commit 584f60ba authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Konstantin Komarov

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: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 326a6fd9
...@@ -821,23 +821,24 @@ static int ntfs_get_frame_pages(struct address_space *mapping, pgoff_t index, ...@@ -821,23 +821,24 @@ static int ntfs_get_frame_pages(struct address_space *mapping, pgoff_t index,
*frame_uptodate = true; *frame_uptodate = true;
for (npages = 0; npages < pages_per_frame; npages++, index++) { for (npages = 0; npages < pages_per_frame; npages++, index++) {
struct page *page; struct folio *folio;
page = find_or_create_page(mapping, index, gfp_mask); folio = __filemap_get_folio(mapping, index,
if (!page) { FGP_LOCK | FGP_ACCESSED | FGP_CREAT, gfp_mask);
if (IS_ERR(folio)) {
while (npages--) { while (npages--) {
page = pages[npages]; folio = page_folio(pages[npages]);
unlock_page(page); folio_unlock(folio);
put_page(page); folio_put(folio);
} }
return -ENOMEM; return -ENOMEM;
} }
if (!PageUptodate(page)) if (!folio_test_uptodate(folio))
*frame_uptodate = false; *frame_uptodate = false;
pages[npages] = page; pages[npages] = &folio->page;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment