Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nilfs2: convert nilfs_empty_dir() to use a folio

Remove three calls to compound_head() by using the folio API.

Link: https://lkml.kernel.org/r/20231127143036.2425-15-konishi.ryusuke@gmail.com
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
18f03ddf f59bb60f

+4 -15
+4 -15
fs/nilfs2/dir.c
··· 203 203 return ERR_PTR(-EIO); 204 204 } 205 205 206 - static void *nilfs_get_page(struct inode *dir, unsigned long n, 207 - struct page **pagep) 208 - { 209 - struct folio *folio; 210 - void *kaddr = nilfs_get_folio(dir, n, &folio); 211 - 212 - if (!IS_ERR(kaddr)) 213 - *pagep = &folio->page; 214 - return kaddr; 215 - } 216 - 217 206 /* 218 207 * NOTE! unlike strncmp, nilfs_match returns 1 for success, 0 for failure. 219 208 * ··· 600 611 */ 601 612 int nilfs_empty_dir(struct inode *inode) 602 613 { 603 - struct page *page = NULL; 614 + struct folio *folio = NULL; 604 615 char *kaddr; 605 616 unsigned long i, npages = dir_pages(inode); 606 617 607 618 for (i = 0; i < npages; i++) { 608 619 struct nilfs_dir_entry *de; 609 620 610 - kaddr = nilfs_get_page(inode, i, &page); 621 + kaddr = nilfs_get_folio(inode, i, &folio); 611 622 if (IS_ERR(kaddr)) 612 623 continue; 613 624 ··· 636 647 } 637 648 de = nilfs_next_entry(de); 638 649 } 639 - unmap_and_put_page(page, kaddr); 650 + folio_release_kmap(folio, kaddr); 640 651 } 641 652 return 1; 642 653 643 654 not_empty: 644 - unmap_and_put_page(page, kaddr); 655 + folio_release_kmap(folio, kaddr); 645 656 return 0; 646 657 } 647 658