Skip to content

Commit da3a849

Browse files
Matthew Wilcox (Oracle)jankara
authored andcommitted
ext2: Convert ext2_make_empty() to use a folio
Remove two hidden calls to compound_head() by using the folio API. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Jan Kara <[email protected]> Message-Id: <[email protected]>
1 parent c2d2049 commit da3a849

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/ext2/dir.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,21 +618,21 @@ int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct folio *folio)
618618
*/
619619
int ext2_make_empty(struct inode *inode, struct inode *parent)
620620
{
621-
struct page *page = grab_cache_page(inode->i_mapping, 0);
621+
struct folio *folio = filemap_grab_folio(inode->i_mapping, 0);
622622
unsigned chunk_size = ext2_chunk_size(inode);
623623
struct ext2_dir_entry_2 * de;
624624
int err;
625625
void *kaddr;
626626

627-
if (!page)
628-
return -ENOMEM;
627+
if (IS_ERR(folio))
628+
return PTR_ERR(folio);
629629

630-
err = ext2_prepare_chunk(page, 0, chunk_size);
630+
err = ext2_prepare_chunk(&folio->page, 0, chunk_size);
631631
if (err) {
632-
unlock_page(page);
632+
folio_unlock(folio);
633633
goto fail;
634634
}
635-
kaddr = kmap_local_page(page);
635+
kaddr = kmap_local_folio(folio, 0);
636636
memset(kaddr, 0, chunk_size);
637637
de = (struct ext2_dir_entry_2 *)kaddr;
638638
de->name_len = 1;
@@ -648,10 +648,10 @@ int ext2_make_empty(struct inode *inode, struct inode *parent)
648648
memcpy (de->name, "..\0", 4);
649649
ext2_set_de_type (de, inode);
650650
kunmap_local(kaddr);
651-
ext2_commit_chunk(page, 0, chunk_size);
651+
ext2_commit_chunk(&folio->page, 0, chunk_size);
652652
err = ext2_handle_dirsync(inode);
653653
fail:
654-
put_page(page);
654+
folio_put(folio);
655655
return err;
656656
}
657657

0 commit comments

Comments
 (0)