mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 22:42:10 +00:00
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>
This commit is contained in:
parent
3239d83484
commit
91f9943e1c
5 changed files with 20 additions and 15 deletions
|
@ -146,8 +146,8 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
|
|||
/* File was opened by fanotify and shouldn't generate fanotify events */
|
||||
#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
|
||||
|
||||
/* File is capable of returning -EAGAIN if AIO will block */
|
||||
#define FMODE_AIO_NOWAIT ((__force fmode_t)0x8000000)
|
||||
/* File is capable of returning -EAGAIN if I/O will block */
|
||||
#define FMODE_NOWAIT ((__force fmode_t)0x8000000)
|
||||
|
||||
/*
|
||||
* 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)
|
|||
return -EOPNOTSUPP;
|
||||
|
||||
if (flags & RWF_NOWAIT) {
|
||||
if (!(ki->ki_filp->f_mode & FMODE_AIO_NOWAIT))
|
||||
if (!(ki->ki_filp->f_mode & FMODE_NOWAIT))
|
||||
return -EOPNOTSUPP;
|
||||
ki->ki_flags |= IOCB_NOWAIT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue