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_make_empty() to use a folio

Remove two calls to compound_head() and switch from kmap_atomic to
kmap_local.

Link: https://lkml.kernel.org/r/20231127143036.2425-16-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
0743230f 18f03ddf

+9 -9
+9 -9
fs/nilfs2/dir.c
··· 559 559 int nilfs_make_empty(struct inode *inode, struct inode *parent) 560 560 { 561 561 struct address_space *mapping = inode->i_mapping; 562 - struct page *page = grab_cache_page(mapping, 0); 562 + struct folio *folio = filemap_grab_folio(mapping, 0); 563 563 unsigned int chunk_size = nilfs_chunk_size(inode); 564 564 struct nilfs_dir_entry *de; 565 565 int err; 566 566 void *kaddr; 567 567 568 - if (!page) 569 - return -ENOMEM; 568 + if (IS_ERR(folio)) 569 + return PTR_ERR(folio); 570 570 571 - err = nilfs_prepare_chunk(page, 0, chunk_size); 571 + err = nilfs_prepare_chunk(&folio->page, 0, chunk_size); 572 572 if (unlikely(err)) { 573 - unlock_page(page); 573 + folio_unlock(folio); 574 574 goto fail; 575 575 } 576 - kaddr = kmap_atomic(page); 576 + kaddr = kmap_local_folio(folio, 0); 577 577 memset(kaddr, 0, chunk_size); 578 578 de = (struct nilfs_dir_entry *)kaddr; 579 579 de->name_len = 1; ··· 588 588 de->inode = cpu_to_le64(parent->i_ino); 589 589 memcpy(de->name, "..\0", 4); 590 590 nilfs_set_de_type(de, inode); 591 - kunmap_atomic(kaddr); 592 - nilfs_commit_chunk(page, mapping, 0, chunk_size); 591 + kunmap_local(kaddr); 592 + nilfs_commit_chunk(&folio->page, mapping, 0, chunk_size); 593 593 fail: 594 - put_page(page); 594 + folio_put(folio); 595 595 return err; 596 596 } 597 597