diff options
Diffstat (limited to 'fs/ext4/inode.c')
| -rw-r--r-- | fs/ext4/inode.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 34d7e0703cc6..4356ef6d728e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -415,7 +415,7 @@ int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk, | |||
| 415 | { | 415 | { |
| 416 | int ret; | 416 | int ret; |
| 417 | 417 | ||
| 418 | if (ext4_encrypted_inode(inode)) | 418 | if (IS_ENCRYPTED(inode)) |
| 419 | return fscrypt_zeroout_range(inode, lblk, pblk, len); | 419 | return fscrypt_zeroout_range(inode, lblk, pblk, len); |
| 420 | 420 | ||
| 421 | ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS); | 421 | ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS); |
| @@ -1150,7 +1150,7 @@ int do_journal_get_write_access(handle_t *handle, | |||
| 1150 | return ret; | 1150 | return ret; |
| 1151 | } | 1151 | } |
| 1152 | 1152 | ||
| 1153 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 1153 | #ifdef CONFIG_FS_ENCRYPTION |
| 1154 | static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, | 1154 | static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, |
| 1155 | get_block_t *get_block) | 1155 | get_block_t *get_block) |
| 1156 | { | 1156 | { |
| @@ -1217,8 +1217,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, | |||
| 1217 | (block_start < from || block_end > to)) { | 1217 | (block_start < from || block_end > to)) { |
| 1218 | ll_rw_block(REQ_OP_READ, 0, 1, &bh); | 1218 | ll_rw_block(REQ_OP_READ, 0, 1, &bh); |
| 1219 | *wait_bh++ = bh; | 1219 | *wait_bh++ = bh; |
| 1220 | decrypt = ext4_encrypted_inode(inode) && | 1220 | decrypt = IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode); |
| 1221 | S_ISREG(inode->i_mode); | ||
| 1222 | } | 1221 | } |
| 1223 | } | 1222 | } |
| 1224 | /* | 1223 | /* |
| @@ -1303,7 +1302,7 @@ retry_journal: | |||
| 1303 | /* In case writeback began while the page was unlocked */ | 1302 | /* In case writeback began while the page was unlocked */ |
| 1304 | wait_for_stable_page(page); | 1303 | wait_for_stable_page(page); |
| 1305 | 1304 | ||
| 1306 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 1305 | #ifdef CONFIG_FS_ENCRYPTION |
| 1307 | if (ext4_should_dioread_nolock(inode)) | 1306 | if (ext4_should_dioread_nolock(inode)) |
| 1308 | ret = ext4_block_write_begin(page, pos, len, | 1307 | ret = ext4_block_write_begin(page, pos, len, |
| 1309 | ext4_get_block_unwritten); | 1308 | ext4_get_block_unwritten); |
| @@ -3105,7 +3104,7 @@ retry_journal: | |||
| 3105 | /* In case writeback began while the page was unlocked */ | 3104 | /* In case writeback began while the page was unlocked */ |
| 3106 | wait_for_stable_page(page); | 3105 | wait_for_stable_page(page); |
| 3107 | 3106 | ||
| 3108 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 3107 | #ifdef CONFIG_FS_ENCRYPTION |
| 3109 | ret = ext4_block_write_begin(page, pos, len, | 3108 | ret = ext4_block_write_begin(page, pos, len, |
| 3110 | ext4_da_get_block_prep); | 3109 | ext4_da_get_block_prep); |
| 3111 | #else | 3110 | #else |
| @@ -3880,8 +3879,8 @@ static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter) | |||
| 3880 | loff_t offset = iocb->ki_pos; | 3879 | loff_t offset = iocb->ki_pos; |
| 3881 | ssize_t ret; | 3880 | ssize_t ret; |
| 3882 | 3881 | ||
| 3883 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 3882 | #ifdef CONFIG_FS_ENCRYPTION |
| 3884 | if (ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode)) | 3883 | if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode)) |
| 3885 | return 0; | 3884 | return 0; |
| 3886 | #endif | 3885 | #endif |
| 3887 | 3886 | ||
| @@ -4065,8 +4064,7 @@ static int __ext4_block_zero_page_range(handle_t *handle, | |||
| 4065 | /* Uhhuh. Read error. Complain and punt. */ | 4064 | /* Uhhuh. Read error. Complain and punt. */ |
| 4066 | if (!buffer_uptodate(bh)) | 4065 | if (!buffer_uptodate(bh)) |
| 4067 | goto unlock; | 4066 | goto unlock; |
| 4068 | if (S_ISREG(inode->i_mode) && | 4067 | if (S_ISREG(inode->i_mode) && IS_ENCRYPTED(inode)) { |
| 4069 | ext4_encrypted_inode(inode)) { | ||
| 4070 | /* We expect the key to be set. */ | 4068 | /* We expect the key to be set. */ |
| 4071 | BUG_ON(!fscrypt_has_encryption_key(inode)); | 4069 | BUG_ON(!fscrypt_has_encryption_key(inode)); |
| 4072 | BUG_ON(blocksize != PAGE_SIZE); | 4070 | BUG_ON(blocksize != PAGE_SIZE); |
| @@ -4142,7 +4140,7 @@ static int ext4_block_truncate_page(handle_t *handle, | |||
| 4142 | struct inode *inode = mapping->host; | 4140 | struct inode *inode = mapping->host; |
| 4143 | 4141 | ||
| 4144 | /* If we are processing an encrypted inode during orphan list handling */ | 4142 | /* If we are processing an encrypted inode during orphan list handling */ |
| 4145 | if (ext4_encrypted_inode(inode) && !fscrypt_has_encryption_key(inode)) | 4143 | if (IS_ENCRYPTED(inode) && !fscrypt_has_encryption_key(inode)) |
| 4146 | return 0; | 4144 | return 0; |
| 4147 | 4145 | ||
| 4148 | blocksize = inode->i_sb->s_blocksize; | 4146 | blocksize = inode->i_sb->s_blocksize; |
| @@ -4722,7 +4720,7 @@ static bool ext4_should_use_dax(struct inode *inode) | |||
| 4722 | return false; | 4720 | return false; |
| 4723 | if (ext4_has_inline_data(inode)) | 4721 | if (ext4_has_inline_data(inode)) |
| 4724 | return false; | 4722 | return false; |
| 4725 | if (ext4_encrypted_inode(inode)) | 4723 | if (ext4_test_inode_flag(inode, EXT4_INODE_ENCRYPT)) |
| 4726 | return false; | 4724 | return false; |
| 4727 | return true; | 4725 | return true; |
| 4728 | } | 4726 | } |
| @@ -5072,7 +5070,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, | |||
| 5072 | ret = -EFSCORRUPTED; | 5070 | ret = -EFSCORRUPTED; |
| 5073 | goto bad_inode; | 5071 | goto bad_inode; |
| 5074 | } | 5072 | } |
| 5075 | if (ext4_encrypted_inode(inode)) { | 5073 | if (IS_ENCRYPTED(inode)) { |
| 5076 | inode->i_op = &ext4_encrypted_symlink_inode_operations; | 5074 | inode->i_op = &ext4_encrypted_symlink_inode_operations; |
| 5077 | ext4_set_aops(inode); | 5075 | ext4_set_aops(inode); |
| 5078 | } else if (ext4_inode_is_fast_symlink(inode)) { | 5076 | } else if (ext4_inode_is_fast_symlink(inode)) { |
