aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r--fs/ext4/file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 3ed8c048fb12..be77b7732c8e 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -36,9 +36,11 @@
36#include "acl.h" 36#include "acl.h"
37#include "truncate.h" 37#include "truncate.h"
38 38
39static bool ext4_dio_supported(struct inode *inode) 39static bool ext4_dio_supported(struct kiocb *iocb, struct iov_iter *iter)
40{ 40{
41 if (IS_ENABLED(CONFIG_FS_ENCRYPTION) && IS_ENCRYPTED(inode)) 41 struct inode *inode = file_inode(iocb->ki_filp);
42
43 if (!fscrypt_dio_supported(iocb, iter))
42 return false; 44 return false;
43 if (fsverity_active(inode)) 45 if (fsverity_active(inode))
44 return false; 46 return false;
@@ -61,7 +63,7 @@ static ssize_t ext4_dio_read_iter(struct kiocb *iocb, struct iov_iter *to)
61 inode_lock_shared(inode); 63 inode_lock_shared(inode);
62 } 64 }
63 65
64 if (!ext4_dio_supported(inode)) { 66 if (!ext4_dio_supported(iocb, to)) {
65 inode_unlock_shared(inode); 67 inode_unlock_shared(inode);
66 /* 68 /*
67 * Fallback to buffered I/O if the operation being performed on 69 * Fallback to buffered I/O if the operation being performed on
@@ -495,7 +497,7 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from)
495 } 497 }
496 498
497 /* Fallback to buffered I/O if the inode does not support direct I/O. */ 499 /* Fallback to buffered I/O if the inode does not support direct I/O. */
498 if (!ext4_dio_supported(inode)) { 500 if (!ext4_dio_supported(iocb, from)) {
499 if (ilock_shared) 501 if (ilock_shared)
500 inode_unlock_shared(inode); 502 inode_unlock_shared(inode);
501 else 503 else