[PATCH v2 6/6] ceph: Remove gfp_t argument from ceph_fscrypt_encrypt_*()

Eric Biggers posted 6 patches 2 months, 4 weeks ago
[PATCH v2 6/6] ceph: Remove gfp_t argument from ceph_fscrypt_encrypt_*()
Posted by Eric Biggers 2 months, 4 weeks ago
This argument is no longer used, so remove it.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 fs/ceph/crypto.c | 10 ++++------
 fs/ceph/crypto.h | 10 ++++------
 fs/ceph/file.c   |  3 +--
 fs/ceph/inode.c  |  3 +--
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c
index 6d04d528ed038..91e62db0c2050 100644
--- a/fs/ceph/crypto.c
+++ b/fs/ceph/crypto.c
@@ -514,12 +514,11 @@ int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
 	return fscrypt_decrypt_block_inplace(inode, page, len, offs, lblk_num);
 }
 
 int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
 				  struct page *page, unsigned int len,
-				  unsigned int offs, u64 lblk_num,
-				  gfp_t gfp_flags)
+				  unsigned int offs, u64 lblk_num)
 {
 	struct ceph_client *cl = ceph_inode_to_client(inode);
 
 	doutc(cl, "%p %llx.%llx len %u offs %u blk %llu\n", inode,
 	      ceph_vinop(inode), len, offs, lblk_num);
@@ -639,21 +638,20 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
  * ceph_fscrypt_encrypt_pages - encrypt an array of pages
  * @inode: pointer to inode associated with these pages
  * @page: pointer to page array
  * @off: offset into the file that the data starts
  * @len: max length to encrypt
- * @gfp: gfp flags to use for allocation
  *
- * Decrypt an array of cleartext pages and return the amount of
+ * Encrypt an array of cleartext pages and return the amount of
  * data encrypted. Any data in the page prior to the start of the
  * first complete block in the read is ignored. Any incomplete
  * crypto blocks at the end of the array are ignored.
  *
  * Returns the length of the encrypted data or a negative errno.
  */
 int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
-				int len, gfp_t gfp)
+				int len)
 {
 	int i, num_blocks;
 	u64 baseblk = off >> CEPH_FSCRYPT_BLOCK_SHIFT;
 	int ret = 0;
 
@@ -670,11 +668,11 @@ int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
 		unsigned int pgoffs = offset_in_page(blkoff);
 		int fret;
 
 		fret = ceph_fscrypt_encrypt_block_inplace(inode, page[pgidx],
 				CEPH_FSCRYPT_BLOCK_SIZE, pgoffs,
-				baseblk + i, gfp);
+				baseblk + i);
 		if (fret < 0) {
 			if (ret == 0)
 				ret = fret;
 			break;
 		}
diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h
index d0768239a1c9c..6db28464ff803 100644
--- a/fs/ceph/crypto.h
+++ b/fs/ceph/crypto.h
@@ -153,19 +153,18 @@ static inline void ceph_fscrypt_adjust_off_and_len(struct inode *inode,
 int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
 				  struct page *page, unsigned int len,
 				  unsigned int offs, u64 lblk_num);
 int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
 				  struct page *page, unsigned int len,
-				  unsigned int offs, u64 lblk_num,
-				  gfp_t gfp_flags);
+				  unsigned int offs, u64 lblk_num);
 int ceph_fscrypt_decrypt_pages(struct inode *inode, struct page **page,
 			       u64 off, int len);
 int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
 				 u64 off, struct ceph_sparse_extent *map,
 				 u32 ext_cnt);
 int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
-			       int len, gfp_t gfp);
+			       int len);
 
 static inline struct page *ceph_fscrypt_pagecache_page(struct page *page)
 {
 	return fscrypt_is_bounce_page(page) ? fscrypt_pagecache_page(page) : page;
 }
@@ -244,12 +243,11 @@ static inline int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
 	return 0;
 }
 
 static inline int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
 					  struct page *page, unsigned int len,
-					  unsigned int offs, u64 lblk_num,
-					  gfp_t gfp_flags)
+					  unsigned int offs, u64 lblk_num)
 {
 	return 0;
 }
 
 static inline int ceph_fscrypt_decrypt_pages(struct inode *inode,
@@ -267,11 +265,11 @@ static inline int ceph_fscrypt_decrypt_extents(struct inode *inode,
 	return 0;
 }
 
 static inline int ceph_fscrypt_encrypt_pages(struct inode *inode,
 					     struct page **page, u64 off,
-					     int len, gfp_t gfp)
+					     int len)
 {
 	return 0;
 }
 
 static inline struct page *ceph_fscrypt_pagecache_page(struct page *page)
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index a7254cab44cc2..9b79da6d1aee7 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1990,12 +1990,11 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
 			break;
 		}
 
 		if (IS_ENCRYPTED(inode)) {
 			ret = ceph_fscrypt_encrypt_pages(inode, pages,
-							 write_pos, write_len,
-							 GFP_KERNEL);
+							 write_pos, write_len);
 			if (ret < 0) {
 				doutc(cl, "encryption failed with %d\n", ret);
 				ceph_release_page_vector(pages, num_pages);
 				break;
 			}
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 06cd2963e41ee..fc543075b827a 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2434,12 +2434,11 @@ static int fill_fscrypt_truncate(struct inode *inode,
 		memset(iov.iov_base + boff, 0, PAGE_SIZE - boff);
 
 		/* encrypt the last block */
 		ret = ceph_fscrypt_encrypt_block_inplace(inode, page,
 						    CEPH_FSCRYPT_BLOCK_SIZE,
-						    0, block,
-						    GFP_KERNEL);
+						    0, block);
 		if (ret)
 			goto out;
 	}
 
 	/* Insert the header */
-- 
2.50.1
Re: [PATCH v2 6/6] ceph: Remove gfp_t argument from ceph_fscrypt_encrypt_*()
Posted by Alex Markuze 2 months, 4 weeks ago
Reviewed-by: Alex Markuze amarkuze@redhat.com

On Thu, Jul 10, 2025 at 9:15 AM Eric Biggers <ebiggers@kernel.org> wrote:
>
> This argument is no longer used, so remove it.
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
>  fs/ceph/crypto.c | 10 ++++------
>  fs/ceph/crypto.h | 10 ++++------
>  fs/ceph/file.c   |  3 +--
>  fs/ceph/inode.c  |  3 +--
>  4 files changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c
> index 6d04d528ed038..91e62db0c2050 100644
> --- a/fs/ceph/crypto.c
> +++ b/fs/ceph/crypto.c
> @@ -514,12 +514,11 @@ int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
>         return fscrypt_decrypt_block_inplace(inode, page, len, offs, lblk_num);
>  }
>
>  int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
>                                   struct page *page, unsigned int len,
> -                                 unsigned int offs, u64 lblk_num,
> -                                 gfp_t gfp_flags)
> +                                 unsigned int offs, u64 lblk_num)
>  {
>         struct ceph_client *cl = ceph_inode_to_client(inode);
>
>         doutc(cl, "%p %llx.%llx len %u offs %u blk %llu\n", inode,
>               ceph_vinop(inode), len, offs, lblk_num);
> @@ -639,21 +638,20 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
>   * ceph_fscrypt_encrypt_pages - encrypt an array of pages
>   * @inode: pointer to inode associated with these pages
>   * @page: pointer to page array
>   * @off: offset into the file that the data starts
>   * @len: max length to encrypt
> - * @gfp: gfp flags to use for allocation
>   *
> - * Decrypt an array of cleartext pages and return the amount of
> + * Encrypt an array of cleartext pages and return the amount of
>   * data encrypted. Any data in the page prior to the start of the
>   * first complete block in the read is ignored. Any incomplete
>   * crypto blocks at the end of the array are ignored.
>   *
>   * Returns the length of the encrypted data or a negative errno.
>   */
>  int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
> -                               int len, gfp_t gfp)
> +                               int len)
>  {
>         int i, num_blocks;
>         u64 baseblk = off >> CEPH_FSCRYPT_BLOCK_SHIFT;
>         int ret = 0;
>
> @@ -670,11 +668,11 @@ int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
>                 unsigned int pgoffs = offset_in_page(blkoff);
>                 int fret;
>
>                 fret = ceph_fscrypt_encrypt_block_inplace(inode, page[pgidx],
>                                 CEPH_FSCRYPT_BLOCK_SIZE, pgoffs,
> -                               baseblk + i, gfp);
> +                               baseblk + i);
>                 if (fret < 0) {
>                         if (ret == 0)
>                                 ret = fret;
>                         break;
>                 }
> diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h
> index d0768239a1c9c..6db28464ff803 100644
> --- a/fs/ceph/crypto.h
> +++ b/fs/ceph/crypto.h
> @@ -153,19 +153,18 @@ static inline void ceph_fscrypt_adjust_off_and_len(struct inode *inode,
>  int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
>                                   struct page *page, unsigned int len,
>                                   unsigned int offs, u64 lblk_num);
>  int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
>                                   struct page *page, unsigned int len,
> -                                 unsigned int offs, u64 lblk_num,
> -                                 gfp_t gfp_flags);
> +                                 unsigned int offs, u64 lblk_num);
>  int ceph_fscrypt_decrypt_pages(struct inode *inode, struct page **page,
>                                u64 off, int len);
>  int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
>                                  u64 off, struct ceph_sparse_extent *map,
>                                  u32 ext_cnt);
>  int ceph_fscrypt_encrypt_pages(struct inode *inode, struct page **page, u64 off,
> -                              int len, gfp_t gfp);
> +                              int len);
>
>  static inline struct page *ceph_fscrypt_pagecache_page(struct page *page)
>  {
>         return fscrypt_is_bounce_page(page) ? fscrypt_pagecache_page(page) : page;
>  }
> @@ -244,12 +243,11 @@ static inline int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode,
>         return 0;
>  }
>
>  static inline int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode,
>                                           struct page *page, unsigned int len,
> -                                         unsigned int offs, u64 lblk_num,
> -                                         gfp_t gfp_flags)
> +                                         unsigned int offs, u64 lblk_num)
>  {
>         return 0;
>  }
>
>  static inline int ceph_fscrypt_decrypt_pages(struct inode *inode,
> @@ -267,11 +265,11 @@ static inline int ceph_fscrypt_decrypt_extents(struct inode *inode,
>         return 0;
>  }
>
>  static inline int ceph_fscrypt_encrypt_pages(struct inode *inode,
>                                              struct page **page, u64 off,
> -                                            int len, gfp_t gfp)
> +                                            int len)
>  {
>         return 0;
>  }
>
>  static inline struct page *ceph_fscrypt_pagecache_page(struct page *page)
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index a7254cab44cc2..9b79da6d1aee7 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -1990,12 +1990,11 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
>                         break;
>                 }
>
>                 if (IS_ENCRYPTED(inode)) {
>                         ret = ceph_fscrypt_encrypt_pages(inode, pages,
> -                                                        write_pos, write_len,
> -                                                        GFP_KERNEL);
> +                                                        write_pos, write_len);
>                         if (ret < 0) {
>                                 doutc(cl, "encryption failed with %d\n", ret);
>                                 ceph_release_page_vector(pages, num_pages);
>                                 break;
>                         }
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 06cd2963e41ee..fc543075b827a 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -2434,12 +2434,11 @@ static int fill_fscrypt_truncate(struct inode *inode,
>                 memset(iov.iov_base + boff, 0, PAGE_SIZE - boff);
>
>                 /* encrypt the last block */
>                 ret = ceph_fscrypt_encrypt_block_inplace(inode, page,
>                                                     CEPH_FSCRYPT_BLOCK_SIZE,
> -                                                   0, block,
> -                                                   GFP_KERNEL);
> +                                                   0, block);
>                 if (ret)
>                         goto out;
>         }
>
>         /* Insert the header */
> --
> 2.50.1
>
>
Re: [PATCH v2 6/6] ceph: Remove gfp_t argument from ceph_fscrypt_encrypt_*()
Posted by Eric Biggers 2 months, 4 weeks ago
On Thu, Jul 10, 2025 at 02:07:47PM +0300, Alex Markuze wrote:
> Reviewed-by: Alex Markuze amarkuze@redhat.com

Thanks!  In the future, when sending a tag, please include brackets around your
email address, like Reviewed-by: Alex Markuze <amarkuze@redhat.com>.  Otherwise,
when applying the patch, b4 skips the tag:

    NOTE: some trailers ignored due to from/email mismatches:
        ! Trailer: Reviewed-by: Alex Markuze amarkuze@redhat.com
         Msg From: Alex Markuze <amarkuze@redhat.com>
    NOTE: Rerun with -S to apply them anyway

I'll add the brackets, so no need to resend anything.  But other maintainers
could miss this, which would result in your review tags not being applied.

- Eric