From 26163692c3e01f5c51e895197e4f7ae0b674ae5d Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 8 Oct 2019 16:35:41 +0200 Subject: [PATCH 2/2] xfs: Use iomap_dio_rw_wait() Use iomap_dio_rw_wait() instead of opencoding the wait. Signed-off-by: Jan Kara --- fs/xfs/xfs_file.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 1ffb179f35d2..c079a64b9e75 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -547,15 +547,17 @@ xfs_file_dio_aio_write( } trace_xfs_file_direct_write(ip, count, iocb->ki_pos); - ret = iomap_dio_rw(iocb, from, &xfs_iomap_ops, &xfs_dio_write_ops); - /* - * If unaligned, this is the only IO in-flight. If it has not yet - * completed, wait on it before we release the iolock to prevent - * subsequent overlapping IO. + * If unaligned, this is the only IO in-flight. Wait on it before we + * release the iolock to prevent subsequent overlapping IO. */ - if (ret == -EIOCBQUEUED && unaligned_io) - inode_dio_wait(inode); + if (unaligned_io) { + ret = iomap_dio_rw_wait(iocb, from, &xfs_iomap_ops, + &xfs_dio_write_ops); + } else { + ret = iomap_dio_rw(iocb, from, &xfs_iomap_ops, + &xfs_dio_write_ops); + } out: xfs_iunlock(ip, iolock); -- 2.16.4