1 ext4: allow unlocked direct IO when pages are cached
3 From: Jan Kara <jack@suse.cz>
5 Currently we do not allow unlocked (meaning without inode_lock) direct
6 IO when the file has any pages cached. This check is not needed anymore
7 as we keep inode lock until ext4_direct_IO_write() and thus can happily
8 writeback and evict any pages conflicting with current direct IO write.
10 Signed-off-by: Jan Kara <jack@suse.cz>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 fs/ext4/file.c | 3 +--
14 1 file changed, 1 insertion(+), 2 deletions(-)
16 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
17 index 261ac3734c58..7e110c1a649d 100644
20 @@ -91,7 +91,6 @@ ext4_unaligned_aio(struct inode *inode, struct iov_iter *from, loff_t pos)
22 ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
24 - struct file *file = iocb->ki_filp;
25 struct inode *inode = file_inode(iocb->ki_filp);
27 int o_direct = iocb->ki_flags & IOCB_DIRECT;
28 @@ -138,7 +137,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
30 /* check whether we do a DIO overwrite or not */
31 if (ext4_should_dioread_nolock(inode) && !unaligned_aio &&
32 - !file->f_mapping->nrpages && pos + length <= i_size_read(inode)) {
33 + pos + length <= i_size_read(inode)) {
34 struct ext4_map_blocks map;
35 unsigned int blkbits = inode->i_blkbits;