From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Tyler Hicks <code@tyhicks.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
ecryptfs@vger.kernel.org, Christian Brauner <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 07/10] ecryptfs: Convert ecryptfs_encrypt_page() to take a folio
Date: Thu, 17 Oct 2024 16:17:02 +0100 [thread overview]
Message-ID: <20241017151709.2713048-8-willy@infradead.org> (raw)
In-Reply-To: <20241017151709.2713048-1-willy@infradead.org>
All three callers have a folio, so pass it in and use it throughout.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ecryptfs/crypto.c | 10 +++++-----
fs/ecryptfs/ecryptfs_kernel.h | 2 +-
fs/ecryptfs/mmap.c | 4 ++--
fs/ecryptfs/read_write.c | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 827278525fd9..424233177b43 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -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);
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 0cac8d3155ae..bffced0c1d8f 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -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);
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index acbef67d9c85..1bf46d2c6a82 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -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",
@@ -479,7 +479,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);
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
index 665bcd7d1c8e..b3b451c2b941 100644
--- a/fs/ecryptfs/read_write.c
+++ b/fs/ecryptfs/read_write.c
@@ -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,
--
2.43.0
next prev parent reply other threads:[~2024-10-17 15:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 15:16 [PATCH 00/10] Convert ecryptfs to use folios Matthew Wilcox (Oracle)
2024-10-17 15:16 ` [PATCH 01/10] ecryptfs: Convert ecryptfs_writepage() to ecryptfs_writepages() Matthew Wilcox (Oracle)
2024-10-18 6:23 ` Pankaj Raghav (Samsung)
2024-10-25 17:56 ` Matthew Wilcox
2024-10-17 15:16 ` [PATCH 02/10] ecryptfs: Use a folio throughout ecryptfs_read_folio() Matthew Wilcox (Oracle)
2024-10-18 6:21 ` Pankaj Raghav (Samsung)
2024-10-25 18:50 ` Matthew Wilcox
2024-10-17 15:16 ` [PATCH 03/10] ecryptfs: Convert ecryptfs_copy_up_encrypted_with_header() to take a folio Matthew Wilcox (Oracle)
2024-10-18 3:43 ` kernel test robot
2024-10-18 6:33 ` Pankaj Raghav (Samsung)
2024-10-17 15:16 ` [PATCH 04/10] ecryptfs: Convert ecryptfs_read_lower_page_segment() " Matthew Wilcox (Oracle)
2024-10-17 15:17 ` [PATCH 05/10] ecryptfs: Convert ecryptfs_write() to use " Matthew Wilcox (Oracle)
2024-10-18 8:07 ` Pankaj Raghav (Samsung)
2024-10-17 15:17 ` [PATCH 06/10] ecryptfs: Convert ecryptfs_write_lower_page_segment() to take " Matthew Wilcox (Oracle)
2024-10-17 15:17 ` Matthew Wilcox (Oracle) [this message]
2024-10-18 5:06 ` [PATCH 07/10] ecryptfs: Convert ecryptfs_encrypt_page() " kernel test robot
2024-10-17 15:17 ` [PATCH 08/10] ecryptfs: Convert ecryptfs_decrypt_page() " Matthew Wilcox (Oracle)
2024-10-18 6:39 ` kernel test robot
2024-10-17 15:17 ` [PATCH 09/10] ecryptfs: Convert lower_offset_for_page() " Matthew Wilcox (Oracle)
2024-10-17 15:17 ` [PATCH 10/10] ecryptfs: Pass the folio index to crypt_extent() Matthew Wilcox (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241017151709.2713048-8-willy@infradead.org \
--to=willy@infradead.org \
--cc=brauner@kernel.org \
--cc=code@tyhicks.com \
--cc=ecryptfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).