Merge tag 'iomap-5.4-merge-6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[platform/kernel/linux-rpi.git] / fs / xfs / xfs_file.c
index d952d59..1ffb179 100644 (file)
@@ -370,21 +370,23 @@ static int
 xfs_dio_write_end_io(
        struct kiocb            *iocb,
        ssize_t                 size,
+       int                     error,
        unsigned                flags)
 {
        struct inode            *inode = file_inode(iocb->ki_filp);
        struct xfs_inode        *ip = XFS_I(inode);
        loff_t                  offset = iocb->ki_pos;
        unsigned int            nofs_flag;
-       int                     error = 0;
 
        trace_xfs_end_io_direct_write(ip, offset, size);
 
        if (XFS_FORCED_SHUTDOWN(ip->i_mount))
                return -EIO;
 
-       if (size <= 0)
-               return size;
+       if (error)
+               return error;
+       if (!size)
+               return 0;
 
        /*
         * Capture amount written on completion as we can't reliably account
@@ -441,6 +443,10 @@ out:
        return error;
 }
 
+static const struct iomap_dio_ops xfs_dio_write_ops = {
+       .end_io         = xfs_dio_write_end_io,
+};
+
 /*
  * xfs_file_dio_aio_write - handle direct IO writes
  *
@@ -541,7 +547,7 @@ 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_end_io);
+       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