Skip to content

Commit 562d060

Browse files
Matthew Wilcox (Oracle)aalexandrovich
authored andcommitted
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) <[email protected]> [[email protected]: skip using folio_end_read] Signed-off-by: Konstantin Komarov <[email protected]>
1 parent d0c3df6 commit 562d060

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

fs/ntfs3/attrib.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -288,22 +288,21 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
288288
if (err)
289289
goto out2;
290290
} else if (!page) {
291-
char *kaddr;
292-
293-
page = grab_cache_page(ni->vfs_inode.i_mapping, 0);
294-
if (!page) {
295-
err = -ENOMEM;
291+
struct address_space *mapping = ni->vfs_inode.i_mapping;
292+
struct folio *folio;
293+
294+
folio = __filemap_get_folio(mapping, 0,
295+
FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
296+
mapping_gfp_mask(mapping));
297+
if (IS_ERR(folio)) {
298+
err = PTR_ERR(folio);
296299
goto out2;
297300
}
298-
kaddr = kmap_atomic(page);
299-
memcpy(kaddr, data, rsize);
300-
memset(kaddr + rsize, 0, PAGE_SIZE - rsize);
301-
kunmap_atomic(kaddr);
302-
flush_dcache_page(page);
303-
SetPageUptodate(page);
304-
set_page_dirty(page);
305-
unlock_page(page);
306-
put_page(page);
301+
folio_fill_tail(folio, 0, data, rsize);
302+
folio_mark_uptodate(folio);
303+
folio_mark_dirty(folio);
304+
folio_unlock(folio);
305+
folio_put(folio);
307306
}
308307
}
309308

0 commit comments

Comments
 (0)