summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2017-06-20 07:05:49 -0500
committerJens Axboe <axboe@kernel.dk>2017-06-20 07:12:03 -0600
commitedf064e7c6fec3646b06c944a8e35d1a3de5c2c3 (patch)
tree861835f7c0ae787598be8e18eac67f623d90658e /fs/btrfs/inode.c
parent29a5d29ec181ebdc98a26cedbd76ce9870248892 (diff)
downloadlwn-edf064e7c6fec3646b06c944a8e35d1a3de5c2c3.tar.gz
lwn-edf064e7c6fec3646b06c944a8e35d1a3de5c2c3.zip
btrfs: nowait aio support
Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Acked-by: David Sterba <dsterba@suse.com> Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f942293dd7e7..556c93060606 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8754,6 +8754,9 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
dio_data.overwrite = 1;
inode_unlock(inode);
relock = true;
+ } else if (iocb->ki_flags & IOCB_NOWAIT) {
+ ret = -EAGAIN;
+ goto out;
}
ret = btrfs_delalloc_reserve_space(inode, offset, count);
if (ret)