diff options
author | Goldwyn Rodrigues <rgoldwyn@suse.com> | 2017-06-20 14:05:43 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-20 15:12:03 +0200 |
commit | b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e (patch) | |
tree | 10a7b6f647945c63f17c6d55c346e84d99130ac3 /fs/aio.c | |
parent | fs: Use RWF_* flags for AIO operations (diff) | |
download | linux-b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e.tar.xz linux-b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e.zip |
fs: Introduce RWF_NOWAIT and FMODE_AIO_NOWAIT
RWF_NOWAIT informs kernel to bail out if an AIO request will block
for reasons such as file allocations, or a writeback triggered,
or would block while allocating requests while performing
direct I/O.
RWF_NOWAIT is translated to IOCB_NOWAIT for iocb->ki_flags.
FMODE_AIO_NOWAIT is a flag which identifies the file opened is capable
of returning -EAGAIN if the AIO call will block. This must be set by
supporting filesystems in the ->open() call.
Filesystems xfs, btrfs and ext4 would be supported in the following patches.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/aio.c')
-rw-r--r-- | fs/aio.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1592,6 +1592,12 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, goto out_put_req; } + if ((req->common.ki_flags & IOCB_NOWAIT) && + !(req->common.ki_flags & IOCB_DIRECT)) { + ret = -EOPNOTSUPP; + goto out_put_req; + } + ret = put_user(KIOCB_KEY, &user_iocb->aio_key); if (unlikely(ret)) { pr_debug("EFAULT: aio_key\n"); |