From: Tal Zussman <tz2294@columbia.edu>
To: Tyler Hicks <code@tyhicks.com>, Erez Zadok <ezk@cs.sunysb.edu>,
Phillip Hellewell <phillip@hellewell.homeip.net>,
Badari Pulavarty <pbadari@us.ibm.com>,
Theodore Ts'o <tytso@mit.edu>,
Andrew Morton <akpm@linux-foundation.org>
Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Stephan Mueller <smueller@chronox.de>,
Adrian Bunk <bunk@stusta.de>,
Michael Halcrow <mhalcrow@us.ibm.com>,
Randy Dunlap <rdunlap@infradead.org>,
Tal Zussman <tz2294@columbia.edu>
Subject: [PATCH v3 10/10] ecryptfs: refer to folios in comments and printk strings
Date: Mon, 16 Nov 2026 17:08:16 -0500 [thread overview]
Message-ID: <20261116-ecryptfs-folio-v3-10-1aba8e620eda@columbia.edu> (raw)
In-Reply-To: <20261116-ecryptfs-folio-v3-0-1aba8e620eda@columbia.edu>
Update the comments and printk strings to refer to folios instead of
pages. While at it, join the strings that were split across lines, use
pr_err() for the printk(KERN_ERR) calls among them, and fix the block
comment style.
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
---
fs/ecryptfs/crypto.c | 17 ++++++++---------
fs/ecryptfs/mmap.c | 36 +++++++++++++++++-------------------
fs/ecryptfs/read_write.c | 36 ++++++++++++++++++------------------
3 files changed, 43 insertions(+), 46 deletions(-)
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index bbaeb9a38db0..d426dc95517c 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -214,7 +214,7 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,
/*
* lower_offset_for_folio
*
- * Convert an eCryptfs page index into a lower byte offset
+ * Convert an eCryptfs folio index into a lower byte offset
*/
static loff_t lower_offset_for_folio(struct ecryptfs_crypt_stat *crypt_stat,
struct folio *folio)
@@ -263,9 +263,8 @@ static int crypt_extent(struct ecryptfs_crypt_stat *crypt_stat,
rc = crypt_scatterlist(crypt_stat, dst_sgp, &src_sg, extent_size,
extent_iv, op);
if (rc < 0) {
- printk(KERN_ERR "%s: Error attempting to crypt page with "
- "page_index = [%ld], extent_offset = [%ld]; "
- "rc = [%d]\n", __func__, page_index, extent_offset, rc);
+ pr_err("%s: Error attempting to crypt folio with page_index = [%ld], extent_offset = [%ld]; rc = [%d]\n",
+ __func__, page_index, extent_offset, rc);
goto out;
}
rc = 0;
@@ -279,8 +278,8 @@ static int crypt_extent(struct ecryptfs_crypt_stat *crypt_stat,
* decrypted content that needs to be encrypted (to a temporary
* buffer; not in place) and written out to the lower file
*
- * Encrypt an eCryptfs page. This is done on a per-extent basis. Note
- * that eCryptfs pages may straddle the lower pages -- for instance,
+ * Encrypt an eCryptfs folio. This is done on a per-extent basis. Note
+ * that eCryptfs folios may straddle the lower pages -- for instance,
* if the file was created on a machine with an 8K page size
* (resulting in an 8K header), and then the file is copied onto a
* host with a 32K page size, then when reading page 0 of the eCryptfs
@@ -341,10 +340,10 @@ int ecryptfs_encrypt_folio(struct folio *folio)
* ecryptfs_decrypt_folio
* @folio: Folio mapped from the eCryptfs inode for the file; data read
* and decrypted from the lower file will be written into this
- * page
+ * folio
*
- * Decrypt an eCryptfs page. This is done on a per-extent basis. Note
- * that eCryptfs pages may straddle the lower pages -- for instance,
+ * Decrypt an eCryptfs folio. This is done on a per-extent basis. Note
+ * that eCryptfs folios may straddle the lower pages -- for instance,
* if the file was created on a machine with an 8K page size
* (resulting in an 8K header), and then the file is copied onto a
* host with a 32K page size, then when reading page 0 of the eCryptfs
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index d841610644ed..305231cd5336 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -188,16 +188,16 @@ static int ecryptfs_read_folio(struct file *file, struct folio *folio)
folio->index, 0, folio_size(folio),
inode);
if (err) {
- printk(KERN_ERR "Error reading page; err = "
- "[%d]\n", err);
+ pr_err("Error reading folio; err = [%d]\n",
+ err);
goto out;
}
}
} else {
err = ecryptfs_decrypt_folio(folio);
if (err) {
- ecryptfs_printk(KERN_ERR, "Error decrypting page; "
- "err = [%d]\n", err);
+ ecryptfs_printk(KERN_ERR, "Error decrypting folio; err = [%d]\n",
+ err);
goto out;
}
}
@@ -264,8 +264,7 @@ static int ecryptfs_write_begin(const struct kiocb *iocb,
rc = ecryptfs_read_lower_folio_segment(
folio, index, 0, PAGE_SIZE, mapping->host);
if (rc) {
- printk(KERN_ERR "%s: Error attempting to read "
- "lower page segment; rc = [%d]\n",
+ pr_err("%s: Error attempting to read lower folio segment; rc = [%d]\n",
__func__, rc);
folio_clear_uptodate(folio);
goto out;
@@ -291,8 +290,7 @@ static int ecryptfs_write_begin(const struct kiocb *iocb,
folio, index, 0, PAGE_SIZE,
mapping->host);
if (rc) {
- printk(KERN_ERR "%s: Error reading "
- "page; rc = [%d]\n",
+ pr_err("%s: Error reading folio; rc = [%d]\n",
__func__, rc);
folio_clear_uptodate(folio);
goto out;
@@ -307,9 +305,7 @@ static int ecryptfs_write_begin(const struct kiocb *iocb,
} else if (len < PAGE_SIZE) {
rc = ecryptfs_decrypt_folio(folio);
if (rc) {
- printk(KERN_ERR "%s: Error decrypting "
- "page at index [%ld]; "
- "rc = [%d]\n",
+ pr_err("%s: Error decrypting folio at index [%ld]; rc = [%d]\n",
__func__, folio->index, rc);
folio_clear_uptodate(folio);
goto out;
@@ -333,8 +329,10 @@ static int ecryptfs_write_begin(const struct kiocb *iocb,
}
}
}
- /* Writing to a new page, and creating a small hole from start
- * of page? Zero it out. */
+ /*
+ * Writing to a new folio, and creating a small hole from start
+ * of folio? Zero it out.
+ */
if ((i_size_read(mapping->host) == prev_page_end_size)
&& (pos != 0))
folio_zero_range(folio, 0, PAGE_SIZE);
@@ -443,8 +441,8 @@ static int ecryptfs_write_end(const struct kiocb *iocb,
&ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
int rc;
- ecryptfs_printk(KERN_DEBUG, "Calling fill_zeros_to_end_of_folio"
- "(page w/ index = [0x%.16lx], to = [%d])\n", index, to);
+ ecryptfs_printk(KERN_DEBUG, "Calling fill_zeros_to_end_of_folio(folio w/ index = [0x%.16lx], to = [%d])\n",
+ index, to);
if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
rc = ecryptfs_write_lower_folio_segment(ecryptfs_inode,
folio, 0, to);
@@ -465,14 +463,14 @@ static int ecryptfs_write_end(const struct kiocb *iocb,
/* Fills in zeros if 'to' goes beyond inode size */
rc = fill_zeros_to_end_of_folio(folio, to);
if (rc) {
- ecryptfs_printk(KERN_WARNING, "Error attempting to fill "
- "zeros in page with index = [0x%.16lx]\n", index);
+ ecryptfs_printk(KERN_WARNING, "Error attempting to fill zeros in folio with index = [0x%.16lx]\n",
+ index);
goto out;
}
rc = ecryptfs_encrypt_folio(folio);
if (rc) {
- ecryptfs_printk(KERN_WARNING, "Error encrypting page (upper "
- "index [0x%.16lx])\n", index);
+ ecryptfs_printk(KERN_WARNING, "Error encrypting folio (upper index [0x%.16lx])\n",
+ index);
goto out;
}
if (pos + copied > i_size_read(ecryptfs_inode)) {
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
index fa876eef85ad..8c2527eb828e 100644
--- a/fs/ecryptfs/read_write.c
+++ b/fs/ecryptfs/read_write.c
@@ -48,8 +48,8 @@ int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
* @size: The amount of data from @folio_for_lower to write to the
* lower file
*
- * Determines the byte offset in the file for the given page and
- * offset within the page, maps the page, and makes the call to write
+ * Determines the byte offset in the file for the given folio and
+ * offset within the folio, maps the folio, and makes the call to write
* the contents of @folio_for_lower to the lower inode.
*
* Returns zero on success; non-zero otherwise
@@ -80,7 +80,7 @@ int ecryptfs_write_lower_folio_segment(struct inode *ecryptfs_inode,
* @size: The number of bytes to write from @data
*
* Write an arbitrary amount of data to an arbitrary location in the
- * eCryptfs inode page cache. This is done on a page-by-page, and then
+ * eCryptfs inode page cache. This is done on a folio-by-folio, and then
* by an extent-by-extent, basis; individual extents are encrypted and
* written to the lower page cache (via VFS writes). This function
* takes care of all the address translation to locations in the lower
@@ -133,10 +133,8 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
ecryptfs_page_idx, NULL);
if (IS_ERR(ecryptfs_folio)) {
rc = PTR_ERR(ecryptfs_folio);
- printk(KERN_ERR "%s: Error getting page at "
- "index [%ld] from eCryptfs inode "
- "mapping; rc = [%d]\n", __func__,
- ecryptfs_page_idx, rc);
+ pr_err("%s: Error getting folio at index [%ld] from eCryptfs inode mapping; rc = [%d]\n",
+ __func__, ecryptfs_page_idx, rc);
goto out;
}
folio_lock(ecryptfs_folio);
@@ -146,11 +144,13 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
* pos: where we're now writing, offset: where the request was
* If current pos is before request, we are filling zeros
* If we are at or beyond request, we are writing the *data*
- * If we're in a fresh page beyond eof, zero it in either case
+ * If we're in a fresh folio beyond eof, zero it in either case
*/
if (pos < offset || !start_offset_in_page) {
- /* We are extending past the previous end of the file.
- * Fill in zero values to the end of the page */
+ /*
+ * We are extending past the previous end of the file.
+ * Fill in zero values to the end of the folio.
+ */
memset(((char *)ecryptfs_page_virt
+ start_offset_in_page), 0,
PAGE_SIZE - start_offset_in_page);
@@ -178,8 +178,8 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
folio_unlock(ecryptfs_folio);
folio_put(ecryptfs_folio);
if (rc) {
- printk(KERN_ERR "%s: Error encrypting "
- "page; rc = [%d]\n", __func__, rc);
+ pr_err("%s: Error encrypting folio; rc = [%d]\n",
+ __func__, rc);
goto out;
}
pos += num_bytes;
@@ -232,16 +232,16 @@ int ecryptfs_read_lower(char *data, loff_t offset, size_t size,
* ecryptfs_read_lower_folio_segment
* @folio_for_ecryptfs: The folio into which data for eCryptfs will be
* written
- * @page_index: Page index in @page_for_ecryptfs from which to start
+ * @page_index: Page index in @folio_for_ecryptfs from which to start
* writing
- * @offset_in_page: Offset in @page_for_ecryptfs from which to start
+ * @offset_in_page: Offset in @folio_for_ecryptfs from which to start
* writing
- * @size: The number of bytes to write into @page_for_ecryptfs
+ * @size: The number of bytes to write into @folio_for_ecryptfs
* @ecryptfs_inode: The eCryptfs inode
*
- * Determines the byte offset in the file for the given page and
- * offset within the page, maps the page, and makes the call to read
- * the contents of @page_for_ecryptfs from the lower inode.
+ * Determines the byte offset in the file for the given folio and
+ * offset within the folio, maps the folio, and makes the call to read
+ * the contents of @folio_for_ecryptfs from the lower inode.
*
* Returns zero on success; non-zero otherwise
*/
--
2.39.5
prev parent reply other threads:[~2026-11-16 22:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 22:08 [PATCH v3 00/10] ecryptfs: remove the remaining struct page usage Tal Zussman
2026-11-16 22:08 ` [PATCH v3 01/10] ecryptfs: write from the right offset in ecryptfs_write_lower_page_segment() Tal Zussman
2026-11-16 22:08 ` [PATCH v3 02/10] ecryptfs: reject zero-length encrypted session keys Tal Zussman
2026-11-16 22:08 ` [PATCH v3 03/10] ecryptfs: keep the folio locked while ecryptfs_write() writes it out Tal Zussman
2026-11-16 22:08 ` [PATCH v3 04/10] ecryptfs: remove struct ecryptfs_page_crypt_context Tal Zussman
2026-11-16 22:08 ` [PATCH v3 05/10] ecryptfs: use a folio and a buffer in crypt_extent() Tal Zussman
2026-11-16 22:08 ` [PATCH v3 06/10] ecryptfs: use kzalloc() for the header buffer Tal Zussman
2026-11-16 22:08 ` [PATCH v3 07/10] ecryptfs: use sg_init_one() instead of virt_to_scatterlist() Tal Zussman
2026-11-16 22:08 ` [PATCH v3 08/10] ecryptfs: zero the tail of the last folio in place on truncate Tal Zussman
2026-11-16 22:08 ` [PATCH v3 09/10] ecryptfs: rename functions to refer to folios Tal Zussman
2026-11-16 22:08 ` Tal Zussman [this message]
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=20261116-ecryptfs-folio-v3-10-1aba8e620eda@columbia.edu \
--to=tz2294@columbia.edu \
--cc=akpm@linux-foundation.org \
--cc=bunk@stusta.de \
--cc=code@tyhicks.com \
--cc=ecryptfs@vger.kernel.org \
--cc=ezk@cs.sunysb.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=mhalcrow@us.ibm.com \
--cc=pbadari@us.ibm.com \
--cc=phillip@hellewell.homeip.net \
--cc=rdunlap@infradead.org \
--cc=smueller@chronox.de \
--cc=tytso@mit.edu \
--cc=willy@infradead.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
all inboxes | Powered by JetHome®