Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / fs / ext4 / inode.c
index e5014a6f76e2ae42f697b400db558660df2961ad..b32a57bc5d5d602ffcb8536ef28ae2684317ed7d 100644 (file)
@@ -415,7 +415,7 @@ int ext4_issue_zeroout(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
 {
        int ret;
 
-       if (ext4_encrypted_inode(inode))
+       if (IS_ENCRYPTED(inode))
                return fscrypt_zeroout_range(inode, lblk, pblk, len);
 
        ret = sb_issue_zeroout(inode->i_sb, pblk, len, GFP_NOFS);
@@ -1148,7 +1148,7 @@ int do_journal_get_write_access(handle_t *handle,
        return ret;
 }
 
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
 static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
                                  get_block_t *get_block)
 {
@@ -1214,8 +1214,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
                    (block_start < from || block_end > to)) {
                        ll_rw_block(REQ_OP_READ, 0, 1, &bh);
                        *wait_bh++ = bh;
-                       decrypt = ext4_encrypted_inode(inode) &&
-                               S_ISREG(inode->i_mode);
+                       decrypt = IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode);
                }
        }
        /*
@@ -1300,7 +1299,7 @@ retry_journal:
        /* In case writeback began while the page was unlocked */
        wait_for_stable_page(page);
 
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
        if (ext4_should_dioread_nolock(inode))
                ret = ext4_block_write_begin(page, pos, len,
                                             ext4_get_block_unwritten);
@@ -3099,7 +3098,7 @@ retry_journal:
        /* In case writeback began while the page was unlocked */
        wait_for_stable_page(page);
 
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
        ret = ext4_block_write_begin(page, pos, len,
                                     ext4_da_get_block_prep);
 #else
@@ -3874,8 +3873,8 @@ static ssize_t ext4_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        loff_t offset = iocb->ki_pos;
        ssize_t ret;
 
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
-       if (ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode))
+#ifdef CONFIG_FS_ENCRYPTION
+       if (IS_ENCRYPTED(inode) && S_ISREG(inode->i_mode))
                return 0;
 #endif
 
@@ -4059,8 +4058,7 @@ static int __ext4_block_zero_page_range(handle_t *handle,
                /* Uhhuh. Read error. Complain and punt. */
                if (!buffer_uptodate(bh))
                        goto unlock;
-               if (S_ISREG(inode->i_mode) &&
-                   ext4_encrypted_inode(inode)) {
+               if (S_ISREG(inode->i_mode) && IS_ENCRYPTED(inode)) {
                        /* We expect the key to be set. */
                        BUG_ON(!fscrypt_has_encryption_key(inode));
                        BUG_ON(blocksize != PAGE_SIZE);
@@ -4136,7 +4134,7 @@ static int ext4_block_truncate_page(handle_t *handle,
        struct inode *inode = mapping->host;
 
        /* If we are processing an encrypted inode during orphan list handling */
-       if (ext4_encrypted_inode(inode) && !fscrypt_has_encryption_key(inode))
+       if (IS_ENCRYPTED(inode) && !fscrypt_has_encryption_key(inode))
                return 0;
 
        blocksize = inode->i_sb->s_blocksize;
@@ -4716,7 +4714,7 @@ static bool ext4_should_use_dax(struct inode *inode)
                return false;
        if (ext4_has_inline_data(inode))
                return false;
-       if (ext4_encrypted_inode(inode))
+       if (ext4_test_inode_flag(inode, EXT4_INODE_ENCRYPT))
                return false;
        return true;
 }
@@ -5066,7 +5064,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
                        ret = -EFSCORRUPTED;
                        goto bad_inode;
                }
-               if (ext4_encrypted_inode(inode)) {
+               if (IS_ENCRYPTED(inode)) {
                        inode->i_op = &ext4_encrypted_symlink_inode_operations;
                        ext4_set_aops(inode);
                } else if (ext4_inode_is_fast_symlink(inode)) {