mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-31 16:38:12 +00:00
ext2: Convert ext2_empty_dir() to use a folio
Save two calls to compound_head() by using the folio API. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230921200746.3303942-6-willy@infradead.org>
This commit is contained in:
parent
1de0736c3a
commit
f4b830cfce
1 changed files with 5 additions and 5 deletions
|
@ -669,16 +669,16 @@ int ext2_make_empty(struct inode *inode, struct inode *parent)
|
|||
/*
|
||||
* routine to check that the specified directory is empty (for rmdir)
|
||||
*/
|
||||
int ext2_empty_dir (struct inode * inode)
|
||||
int ext2_empty_dir(struct inode *inode)
|
||||
{
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
char *kaddr;
|
||||
unsigned long i, npages = dir_pages(inode);
|
||||
|
||||
for (i = 0; i < npages; i++) {
|
||||
ext2_dirent *de;
|
||||
|
||||
kaddr = ext2_get_page(inode, i, 0, &page);
|
||||
kaddr = ext2_get_folio(inode, i, 0, &folio);
|
||||
if (IS_ERR(kaddr))
|
||||
return 0;
|
||||
|
||||
|
@ -707,12 +707,12 @@ int ext2_empty_dir (struct inode * inode)
|
|||
}
|
||||
de = ext2_next_entry(de);
|
||||
}
|
||||
ext2_put_page(page, kaddr);
|
||||
folio_release_kmap(folio, kaddr);
|
||||
}
|
||||
return 1;
|
||||
|
||||
not_empty:
|
||||
ext2_put_page(page, kaddr);
|
||||
folio_release_kmap(folio, kaddr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue