Now that i_rwsem is held until asynchronous writes complete, there
is no need to force them to execute synchronously, as the i_rwsem
protection is exactly the same as for synchronous writes.

Signed-off-by: Christoph Hellwig <[email protected]>
---
 fs/xfs/xfs_file.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index d0ee7d2932e4..3a734ad4bb10 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -510,9 +510,6 @@ xfs_file_dio_aio_write(
        }
 
        if (iocb->ki_flags & IOCB_NOWAIT) {
-               /* unaligned dio always waits, bail */
-               if (unaligned_io)
-                       return -EAGAIN;
                if (!xfs_ilock_nowait(ip, iolock))
                        return -EAGAIN;
        } else {
@@ -526,14 +523,11 @@ xfs_file_dio_aio_write(
 
        /*
         * If we are doing unaligned I/O, we can't allow any other overlapping
-        * I/O in-flight at the same time or we risk data corruption.  Wait for
-        * all other I/O to drain before we submit and execute the I/O
-        * synchronously to prevent subsequent overlapping I/O.  If the I/O is
-        * aligned, demote the iolock if we had to take the exclusive lock in
-        * xfs_file_aio_write_checks() for other reasons.
+        * If the I/O is aligned, demote the iolock if we had to take the
+        * exclusive lock in xfs_file_aio_write_checks() for other reasons.
         */
        if (unaligned_io) {
-               dio_flags = IOMAP_DIO_RWSEM_EXCL | IOMAP_DIO_SYNCHRONOUS;
+               dio_flags = IOMAP_DIO_RWSEM_EXCL;
        } else {
                if (iolock == XFS_IOLOCK_EXCL) {
                        xfs_ilock_demote(ip, XFS_IOLOCK_EXCL);
-- 
2.24.1


Reply via email to