]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ecryptfs: Convert ecryptfs_write_lower_page_segment() to take a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 25 Oct 2024 19:08:16 +0000 (20:08 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 5 Nov 2024 16:19:59 +0000 (17:19 +0100)
Both callers now 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-7-willy@infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/ecryptfs/ecryptfs_kernel.h
fs/ecryptfs/mmap.c
fs/ecryptfs/read_write.c

index f04aa24f6bcd986ecd18ea0a15f04be04bb1425b..0cac8d3155aed275d8cb456bbf955672a87789a8 100644 (file)
@@ -653,7 +653,7 @@ int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key,
 int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
                         loff_t offset, size_t size);
 int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
-                                     struct page *page_for_lower,
+                                     struct folio *folio_for_lower,
                                      size_t offset_in_page, size_t size);
 int ecryptfs_write(struct inode *inode, char *data, loff_t offset, size_t size);
 int ecryptfs_read_lower(char *data, loff_t offset, size_t size,
index f6b9390e720a1743ce123ece86f39e5f847fdd98..1c1eb9437505772f160fa6229184b0f72e949a6b 100644 (file)
@@ -454,7 +454,7 @@ static int ecryptfs_write_end(struct file *file,
                        "(page w/ index = [0x%.16lx], to = [%d])\n", index, to);
        if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
                rc = ecryptfs_write_lower_page_segment(ecryptfs_inode,
-                               &folio->page, 0, to);
+                               folio, 0, to);
                if (!rc) {
                        rc = copied;
                        fsstack_copy_inode_size(ecryptfs_inode,
index cddfdfced879abaee85eedb6879fc4aa8a8f9507..665bcd7d1c8e5228b66488bde23e9842f52cfd77 100644 (file)
@@ -41,30 +41,29 @@ int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
 /**
  * ecryptfs_write_lower_page_segment
  * @ecryptfs_inode: The eCryptfs inode
- * @page_for_lower: The page containing the data to be written to the
+ * @folio_for_lower: The folio containing the data to be written to the
  *                  lower file
- * @offset_in_page: The offset in the @page_for_lower from which to
+ * @offset_in_page: The offset in the @folio_for_lower from which to
  *                  start writing the data
- * @size: The amount of data from @page_for_lower to write to the
+ * @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
- * the contents of @page_for_lower to the lower inode.
+ * the contents of @folio_for_lower to the lower inode.
  *
  * Returns zero on success; non-zero otherwise
  */
 int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
-                                     struct page *page_for_lower,
+                                     struct folio *folio_for_lower,
                                      size_t offset_in_page, size_t size)
 {
        char *virt;
        loff_t offset;
        int rc;
 
-       offset = ((((loff_t)page_for_lower->index) << PAGE_SHIFT)
-                 + offset_in_page);
-       virt = kmap_local_page(page_for_lower);
+       offset = (loff_t)folio_for_lower->index * PAGE_SIZE + offset_in_page;
+       virt = kmap_local_folio(folio_for_lower, 0);
        rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size);
        if (rc > 0)
                rc = 0;
@@ -172,7 +171,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
                        rc = ecryptfs_encrypt_page(&ecryptfs_folio->page);
                else
                        rc = ecryptfs_write_lower_page_segment(ecryptfs_inode,
-                                               &ecryptfs_folio->page,
+                                               ecryptfs_folio,
                                                start_offset_in_page,
                                                data_offset);
                folio_put(ecryptfs_folio);