qnx6: Convert qnx6_iget() to use a folio

Removes a use of kmap() and a couple of conversions between folios and
pages.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-07-10 08:30:23 -04:00 committed by Christian Brauner
parent 29c42e8b8a
commit 1d49228f27
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -518,7 +518,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino)
struct inode *inode;
struct qnx6_inode_info *ei;
struct address_space *mapping;
struct page *page;
struct folio *folio;
u32 n, offs;
inode = iget_locked(sb, ino);
@ -538,17 +538,16 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino)
return ERR_PTR(-EIO);
}
n = (ino - 1) >> (PAGE_SHIFT - QNX6_INODE_SIZE_BITS);
offs = (ino - 1) & (~PAGE_MASK >> QNX6_INODE_SIZE_BITS);
mapping = sbi->inodes->i_mapping;
page = read_mapping_page(mapping, n, NULL);
if (IS_ERR(page)) {
folio = read_mapping_folio(mapping, n, NULL);
if (IS_ERR(folio)) {
pr_err("major problem: unable to read inode from dev %s\n",
sb->s_id);
iget_failed(inode);
return ERR_CAST(page);
return ERR_CAST(folio);
}
kmap(page);
raw_inode = ((struct qnx6_inode_entry *)page_address(page)) + offs;
offs = offset_in_folio(folio, (ino - 1) << QNX6_INODE_SIZE_BITS);
raw_inode = kmap_local_folio(folio, offs);
inode->i_mode = fs16_to_cpu(sbi, raw_inode->di_mode);
i_uid_write(inode, (uid_t)fs32_to_cpu(sbi, raw_inode->di_uid));
@ -578,7 +577,7 @@ struct inode *qnx6_iget(struct super_block *sb, unsigned ino)
inode->i_mapping->a_ops = &qnx6_aops;
} else
init_special_inode(inode, inode->i_mode, 0);
qnx6_put_page(page);
folio_release_kmap(folio, raw_inode);
unlock_new_inode(inode);
return inode;
}