summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-08-29 10:13:20 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-09-04 19:04:23 -0400
commit91f9943e1c7b6638f27312d03fe71fcc67b23571 (patch)
treebf9c2212d93f4fbf9af6f5fafc2e667fa3d29de1 /fs/ext4
parent3239d834847627b6634a4139cf1dc58f6f137a46 (diff)
fs: support RWF_NOWAIT for buffered reads
This is based on the old idea and code from Milosz Tanski. With the aio nowait code it becomes mostly trivial now. Buffered writes continue to return -EOPNOTSUPP if RWF_NOWAIT is passed. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 0d7cf0cc9b87..f83521337b8f 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -223,6 +223,8 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
223 if (IS_DAX(inode)) 223 if (IS_DAX(inode))
224 return ext4_dax_write_iter(iocb, from); 224 return ext4_dax_write_iter(iocb, from);
225#endif 225#endif
226 if (!o_direct && (iocb->ki_flags & IOCB_NOWAIT))
227 return -EOPNOTSUPP;
226 228
227 if (!inode_trylock(inode)) { 229 if (!inode_trylock(inode)) {
228 if (iocb->ki_flags & IOCB_NOWAIT) 230 if (iocb->ki_flags & IOCB_NOWAIT)
@@ -448,9 +450,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
448 return ret; 450 return ret;
449 } 451 }
450 452
451 /* Set the flags to support nowait AIO */ 453 filp->f_mode |= FMODE_NOWAIT;
452 filp->f_mode |= FMODE_AIO_NOWAIT;
453
454 return dquot_file_open(inode, filp); 454 return dquot_file_open(inode, filp);
455} 455}
456 456