ntfs3: Convert attr_make_nonresident to use a folio

Fetch a folio from the page cache instead of a page and operate on it.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
[almaz.alexandrovich@paragon-software.com: skip using folio_end_read]
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-04-22 20:31:56 +01:00 committed by Konstantin Komarov
parent d0c3df6277
commit 562d060bed
No known key found for this signature in database
GPG Key ID: A9B0331F832407B6

View File

@ -288,22 +288,21 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
if (err) if (err)
goto out2; goto out2;
} else if (!page) { } else if (!page) {
char *kaddr; struct address_space *mapping = ni->vfs_inode.i_mapping;
struct folio *folio;
page = grab_cache_page(ni->vfs_inode.i_mapping, 0); folio = __filemap_get_folio(mapping, 0,
if (!page) { FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
err = -ENOMEM; mapping_gfp_mask(mapping));
if (IS_ERR(folio)) {
err = PTR_ERR(folio);
goto out2; goto out2;
} }
kaddr = kmap_atomic(page); folio_fill_tail(folio, 0, data, rsize);
memcpy(kaddr, data, rsize); folio_mark_uptodate(folio);
memset(kaddr + rsize, 0, PAGE_SIZE - rsize); folio_mark_dirty(folio);
kunmap_atomic(kaddr); folio_unlock(folio);
flush_dcache_page(page); folio_put(folio);
SetPageUptodate(page);
set_page_dirty(page);
unlock_page(page);
put_page(page);
} }
} }