diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2024-07-08 17:44:48 -0400 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-08-07 11:31:52 +0200 |
commit | f4a20e53aba74b406f3becf28cc3776ad38153e7 (patch) | |
tree | 25745736ecd5c14e06cf3c7b9330bd34a276f4f0 /fs/ufs/dir.c | |
parent | 767bd0af25e59e8b75801847ddc7bf0ab186bf3c (diff) |
ufs: Convert ufs_make_empty() to use a folio
Removes a few hidden calls to compound_head() and uses kmap_local
instead of kmap.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/ufs/dir.c')
-rw-r--r-- | fs/ufs/dir.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 945fff87b385..6a2a6af38097 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -540,26 +540,25 @@ int ufs_make_empty(struct inode * inode, struct inode *dir) { struct super_block * sb = dir->i_sb; struct address_space *mapping = inode->i_mapping; - struct page *page = grab_cache_page(mapping, 0); + struct folio *folio = filemap_grab_folio(mapping, 0); const unsigned int chunk_size = UFS_SB(sb)->s_uspi->s_dirblksize; struct ufs_dir_entry * de; - char *base; int err; + char *kaddr; - if (!page) - return -ENOMEM; + if (IS_ERR(folio)) + return PTR_ERR(folio); - err = ufs_prepare_chunk(page, 0, chunk_size); + err = ufs_prepare_chunk(&folio->page, 0, chunk_size); if (err) { - unlock_page(page); + folio_unlock(folio); goto fail; } - kmap(page); - base = (char*)page_address(page); - memset(base, 0, PAGE_SIZE); + kaddr = kmap_local_folio(folio, 0); + memset(kaddr, 0, folio_size(folio)); - de = (struct ufs_dir_entry *) base; + de = (struct ufs_dir_entry *)kaddr; de->d_ino = cpu_to_fs32(sb, inode->i_ino); ufs_set_de_type(sb, de, inode->i_mode); @@ -573,12 +572,12 @@ int ufs_make_empty(struct inode * inode, struct inode *dir) de->d_reclen = cpu_to_fs16(sb, chunk_size - UFS_DIR_REC_LEN(1)); ufs_set_de_namlen(sb, de, 2); strcpy (de->d_name, ".."); - kunmap(page); + kunmap_local(kaddr); - ufs_commit_chunk(page, 0, chunk_size); + ufs_commit_chunk(&folio->page, 0, chunk_size); err = ufs_handle_dirsync(inode); fail: - put_page(page); + folio_put(folio); return err; } |