summaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
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 /include/linux/fs.h
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 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cbfe127bccf8..94582c379dac 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -146,8 +146,8 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
146/* File was opened by fanotify and shouldn't generate fanotify events */ 146/* File was opened by fanotify and shouldn't generate fanotify events */
147#define FMODE_NONOTIFY ((__force fmode_t)0x4000000) 147#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
148 148
149/* File is capable of returning -EAGAIN if AIO will block */ 149/* File is capable of returning -EAGAIN if I/O will block */
150#define FMODE_AIO_NOWAIT ((__force fmode_t)0x8000000) 150#define FMODE_NOWAIT ((__force fmode_t)0x8000000)
151 151
152/* 152/*
153 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector 153 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
@@ -3149,7 +3149,7 @@ static inline int kiocb_set_rw_flags(struct kiocb *ki, int flags)
3149 return -EOPNOTSUPP; 3149 return -EOPNOTSUPP;
3150 3150
3151 if (flags & RWF_NOWAIT) { 3151 if (flags & RWF_NOWAIT) {
3152 if (!(ki->ki_filp->f_mode & FMODE_AIO_NOWAIT)) 3152 if (!(ki->ki_filp->f_mode & FMODE_NOWAIT))
3153 return -EOPNOTSUPP; 3153 return -EOPNOTSUPP;
3154 ki->ki_flags |= IOCB_NOWAIT; 3154 ki->ki_flags |= IOCB_NOWAIT;
3155 } 3155 }