The patch titled Subject: ext4: nowait aio support has been added to the -mm tree. Its filename is ext4-nowait-aio-support.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/ext4-nowait-aio-support.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/ext4-nowait-aio-support.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Subject: ext4: nowait aio support Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Link: http://lkml.kernel.org/r/20170615160002.17233-9-rgoldwyn@xxxxxxx Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Cc: "Theodore Ts'o" <tytso@xxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Andreas Dilger <adilger.kernel@xxxxxxxxx> Cc: Chris Mason <clm@xxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Cc: David Sterba <dsterba@xxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Josef Bacik <jbacik@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ext4/file.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff -puN fs/ext4/file.c~ext4-nowait-aio-support fs/ext4/file.c --- a/fs/ext4/file.c~ext4-nowait-aio-support +++ a/fs/ext4/file.c @@ -216,7 +216,13 @@ ext4_file_write_iter(struct kiocb *iocb, return ext4_dax_write_iter(iocb, from); #endif - inode_lock(inode); + if (iocb->ki_flags & IOCB_NOWAIT) { + if (!inode_trylock(inode)) + return -EAGAIN; + } else { + inode_lock(inode); + } + ret = ext4_write_checks(iocb, from); if (ret <= 0) goto out; @@ -235,9 +241,15 @@ ext4_file_write_iter(struct kiocb *iocb, iocb->private = &overwrite; /* Check whether we do a DIO overwrite or not */ - if (o_direct && ext4_should_dioread_nolock(inode) && !unaligned_aio && - ext4_overwrite_io(inode, iocb->ki_pos, iov_iter_count(from))) - overwrite = 1; + if (o_direct && !unaligned_aio) { + if (ext4_overwrite_io(inode, iocb->ki_pos, iov_iter_count(from))) { + if (ext4_should_dioread_nolock(inode)) + overwrite = 1; + } else if (iocb->ki_flags & IOCB_NOWAIT) { + ret = -EAGAIN; + goto out; + } + } ret = __generic_file_write_iter(iocb, from); inode_unlock(inode); @@ -435,6 +447,10 @@ static int ext4_file_open(struct inode * if (ret < 0) return ret; } + + /* Set the flags to support nowait AIO */ + filp->f_mode |= FMODE_NOWAIT_AIO; + return dquot_file_open(inode, filp); } _ Patches currently in -mm which might be from rgoldwyn@xxxxxxxx are fs-separate-out-kiocb-flags-setup-based-on-rwf_-flags.patch fs-introduce-filemap_range_has_page.patch fs-use-rwf_-flags-for-aio-operations.patch fs-introduce-rwf_nowait-and-fmode_aio_nowait.patch fs-return-if-direct-write-will-trigger-writeback.patch fs-introduce-iomap_nowait.patch block-return-on-congested-block-device.patch ext4-nowait-aio-support.patch xfs-nowait-aio-support.patch btrfs-nowait-aio-support.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html