ecryptfs: Convert ecryptfs_encrypt_page() to take a folio

All three callers have a folio, so pass it in and use it throughout.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20241025190822.1319162-8-willy@infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-10-25 20:08:17 +01:00 committed by Christian Brauner
parent de5ced2721
commit 6b9c0e8137
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
4 changed files with 10 additions and 10 deletions

View File

@ -392,7 +392,7 @@ static int crypt_extent(struct ecryptfs_crypt_stat *crypt_stat,
/**
* ecryptfs_encrypt_page
* @page: Page mapped from the eCryptfs inode for the file; contains
* @folio: Folio mapped from the eCryptfs inode for the file; contains
* decrypted content that needs to be encrypted (to a temporary
* page; not in place) and written out to the lower file
*
@ -406,7 +406,7 @@ static int crypt_extent(struct ecryptfs_crypt_stat *crypt_stat,
*
* Returns zero on success; negative on error
*/
int ecryptfs_encrypt_page(struct page *page)
int ecryptfs_encrypt_page(struct folio *folio)
{
struct inode *ecryptfs_inode;
struct ecryptfs_crypt_stat *crypt_stat;
@ -416,7 +416,7 @@ int ecryptfs_encrypt_page(struct page *page)
loff_t lower_offset;
int rc = 0;
ecryptfs_inode = page->mapping->host;
ecryptfs_inode = folio->mapping->host;
crypt_stat =
&(ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat);
BUG_ON(!(crypt_stat->flags & ECRYPTFS_ENCRYPTED));
@ -431,8 +431,8 @@ int ecryptfs_encrypt_page(struct page *page)
for (extent_offset = 0;
extent_offset < (PAGE_SIZE / crypt_stat->extent_size);
extent_offset++) {
rc = crypt_extent(crypt_stat, enc_extent_page, page,
extent_offset, ENCRYPT);
rc = crypt_extent(crypt_stat, enc_extent_page,
folio_page(folio, 0), extent_offset, ENCRYPT);
if (rc) {
printk(KERN_ERR "%s: Error encrypting extent; "
"rc = [%d]\n", __func__, rc);
@ -440,7 +440,7 @@ int ecryptfs_encrypt_page(struct page *page)
}
}
lower_offset = lower_offset_for_page(crypt_stat, page);
lower_offset = lower_offset_for_page(crypt_stat, &folio->page);
enc_extent_virt = kmap_local_page(enc_extent_page);
rc = ecryptfs_write_lower(ecryptfs_inode, enc_extent_virt, lower_offset,
PAGE_SIZE);

View File

@ -569,7 +569,7 @@ void ecryptfs_destroy_mount_crypt_stat(
struct ecryptfs_mount_crypt_stat *mount_crypt_stat);
int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat);
int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode);
int ecryptfs_encrypt_page(struct page *page);
int ecryptfs_encrypt_page(struct folio *folio);
int ecryptfs_decrypt_page(struct page *page);
int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry,
struct inode *ecryptfs_inode);

View File

@ -34,7 +34,7 @@ static int ecryptfs_writepages(struct address_space *mapping,
int error;
while ((folio = writeback_iter(mapping, wbc, folio, &error))) {
error = ecryptfs_encrypt_page(&folio->page);
error = ecryptfs_encrypt_page(folio);
if (error) {
ecryptfs_printk(KERN_WARNING,
"Error encrypting folio (index [0x%.16lx])\n",
@ -476,7 +476,7 @@ static int ecryptfs_write_end(struct file *file,
"zeros in page with index = [0x%.16lx]\n", index);
goto out;
}
rc = ecryptfs_encrypt_page(&folio->page);
rc = ecryptfs_encrypt_page(folio);
if (rc) {
ecryptfs_printk(KERN_WARNING, "Error encrypting page (upper "
"index [0x%.16lx])\n", index);

View File

@ -168,7 +168,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
folio_mark_uptodate(ecryptfs_folio);
folio_unlock(ecryptfs_folio);
if (crypt_stat->flags & ECRYPTFS_ENCRYPTED)
rc = ecryptfs_encrypt_page(&ecryptfs_folio->page);
rc = ecryptfs_encrypt_page(ecryptfs_folio);
else
rc = ecryptfs_write_lower_page_segment(ecryptfs_inode,
ecryptfs_folio,