diff mbox

[RFC,5/8] ext4: decrypt the block that needs to be partially zeroed

Message ID 20180112141129.27507-6-chandan@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chandan Rajendra Jan. 12, 2018, 2:11 p.m. UTC
__ext4_block_zero_page_range decrypts the entire page. This commit
decrypts the block to be partially zeroed instead of the whole page.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
 fs/ext4/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Eric Biggers Jan. 17, 2018, 2:23 a.m. UTC | #1
On Fri, Jan 12, 2018 at 07:41:26PM +0530, Chandan Rajendra wrote:
> __ext4_block_zero_page_range decrypts the entire page. This commit
> decrypts the block to be partially zeroed instead of the whole page.
> 
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
> ---
>  fs/ext4/inode.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d3baa15..db47f6d 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4030,9 +4030,8 @@ static int __ext4_block_zero_page_range(handle_t *handle,
>  		    ext4_encrypted_inode(inode)) {
>  			/* We expect the key to be set. */
>  			BUG_ON(!fscrypt_has_encryption_key(inode));
> -			BUG_ON(blocksize != PAGE_SIZE);
>  			WARN_ON_ONCE(fscrypt_decrypt_page(page->mapping->host,
> -						page, PAGE_SIZE, 0, page->index));
> +						page, blocksize, round_down(offset, blocksize), iblock));
>  		}

Please use proper line breaking here.

Eric
diff mbox

Patch

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d3baa15..db47f6d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4030,9 +4030,8 @@  static int __ext4_block_zero_page_range(handle_t *handle,
 		    ext4_encrypted_inode(inode)) {
 			/* We expect the key to be set. */
 			BUG_ON(!fscrypt_has_encryption_key(inode));
-			BUG_ON(blocksize != PAGE_SIZE);
 			WARN_ON_ONCE(fscrypt_decrypt_page(page->mapping->host,
-						page, PAGE_SIZE, 0, page->index));
+						page, blocksize, round_down(offset, blocksize), iblock));
 		}
 	}
 	if (ext4_should_journal_data(inode)) {